When working with CentOS 6.2 virtual machines on Hyper-V, many administrators encounter a frustrating issue where the primary network interface eth0
fails to initialize during system boot. While manually executing ifup eth0
resolves the connectivity, this workaround isn't viable for headless servers requiring remote SSH access.
First, let's verify the key configuration files:
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
IPADDR=10.10.0.3
NETMASK=255.255.255.0
GATEWAY=10.10.0.1
USERCTL=no
ONBOOT=yes
The error messages during manual ifup
execution reveal an important clue:
/etc/sysconfig/network-scripts/ifup-ipv6: line 56: /etc/sysconfig/network: No such file or directory
This indicates the system is missing a critical network configuration file. Create it with:
echo "NETWORKING=yes" > /etc/sysconfig/network
echo "HOSTNAME=localhost.localdomain" >> /etc/sysconfig/network
The DMESG output shows the VM is using the Digital DS21140 Tulip driver:
eth0: Digital DS21140 Tulip rev 32 at MMIO 0xfebff000, 00:15:5d:2b:2b:07, IRQ 9.
For Hyper-V VMs, consider adding these parameters to your ifcfg-eth0:
NM_CONTROLLED=no
TYPE=Ethernet
HWADDR=00:15:5D:2B:2B:07
After making these changes, ensure proper permissions and test the configuration:
chmod 644 /etc/sysconfig/network
chmod 644 /etc/sysconfig/network-scripts/ifcfg-eth0
service network restart
Confirm the interface comes up automatically after reboot:
reboot
ping -c 4 google.com
ifconfig eth0
If issues persist, check the boot sequence:
chkconfig --list network
ls -la /etc/rc3.d/S*network*
For Hyper-V environments specifically, verify the synthetic network adapter settings in the VM configuration.
When working with CentOS 6.2 virtual machines on Hyper-V, you might encounter a frustrating issue where the eth0
network interface fails to start automatically after reboot. While manually running ifup eth0
resolves the issue temporarily, this isn't a practical solution for production environments.
First, let's verify the current network configuration. The ifcfg-eth0
file appears correctly configured with ONBOOT=yes
:
DEVICE=eth0
BOOTPROTO=none
IPADDR=10.10.0.3
NETMASK=255.255.255.0
GATEWAY=10.10.0.1
USERCTL=no
ONBOOT=yes
The network service is properly enabled in runlevel 3:
# chkconfig --list | grep network
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
The error messages when running ifup eth0
manually provide important clues:
# ifup eth0
/etc/sysconfig/network-scripts/ifup-ipv6: line 56: /etc/sysconfig/network: No such file or directory
/etc/sysconfig/network-scripts/ifup-aliases: line 125: /etc/sysconfig/network: No such file or directory
The system is missing the critical /etc/sysconfig/network
file, which contains global network settings. This is required for proper network initialization.
Here's how to permanently resolve the issue:
First, create the missing network configuration file:
# cat > /etc/sysconfig/network <
For Hyper-V specific optimization, add these parameters to ifcfg-eth0
:
NM_CONTROLLED=no
TYPE=Ethernet
PEERDNS=yes
IPV6INIT=no
After making these changes, verify the configuration:
# service network restart
# chkconfig network on
# reboot
Check the interface status after reboot:
# ifconfig eth0
# ip addr show eth0
# route -n
If issues persist, consider these additional steps:
# yum update
# rm -f /etc/udev/rules.d/70-persistent-net.rules
# echo "HWADDR=$(ifconfig eth0 | awk '/HWaddr/ {print $5}')" >> /etc/sysconfig/network-scripts/ifcfg-eth0
For environments where network initialization order causes problems, create a custom startup script:
# cat > /etc/init.d/fixeth0 <<'EOF'
#!/bin/bash
# chkconfig: 2345 99 01
# description: Fix eth0 startup
sleep 5
/sbin/ifup eth0
EOF
# chmod +x /etc/init.d/fixeth0
# chkconfig --add fixeth0