10

Whenever I reboot a CentOS Hyper-V VM, eth0 does not start automatically. All I need to do is perform ifup eth0 and all is fixed, but that isn't feasible from ssh! I am starting in runlevel 3.


[root@localhost ~]# cat /etc/*release*
CentOS release 6.2 (Final)

After I perform ifup eth0 on the console:

[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:15:5D:2B:2B:07
      inet addr:10.10.0.3  Bcast:10.10.0.255  Mask:255.255.255.0
      inet6 addr: fe80::215:5dff:fe2b:2b07/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:34 errors:0 dropped:0 overruns:0 frame:0
      TX packets:49 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:4656 (4.5 KiB)  TX bytes:6399 (6.2 KiB)
      Interrupt:9 Base address:0xa000

[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

[root@localhost ~]# chkconfig --list | grep network
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off

After trying to turn off Network Manager

[root@localhost ~]# chkconfig NetworkManager off
error reading information on service NetworkManager: No such file or directory
[root@localhost ~]# service NetworkManager status
NetworkManager: unrecognized service


The most recent clean boot
[root@localhost ~]# grep eth0 /var/log/messages
Jul  7 02:12:44 localhost kernel: eth0: Digital DS21140 Tulip rev 32 at MMIO 0xfebff000, 00:15:5d:2b:2b:07, IRQ 9.
Jul  7 02:13:15 localhost kernel: eth0: Using EEPROM-set media 100baseTx-FDX.

[root@localhost ~]# dmesg | grep eth0
eth0: Digital DS21140 Tulip rev 32 at MMIO 0xfebff000, 00:15:5d:2b:2b:07, IRQ 9.
eth0: Using EEPROM-set media 100baseTx-FDX.
eth0: no IPv6 routers present


The only problems I have EVER seen, is when I do the command of ifup eth0 I get the following errors, but eth0 still gets started:
[root@localhost ~]# 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
Cameron Aziz
  • 275
  • 1
  • 4
  • 13

6 Answers6

11

Hmm. From your last message, look for the /etc/sysconfig/network file.

I have:

$ cat /etc/sysconfig/network
NETWORKING=yes

You can also have (on my CentOS 5 box):

NETWORKING=yes
HOSTNAME=foo.example.org
GATEWAY=192.168.1.1

Documentation is here (at least for 5, which should be very similar)

I'm not sure what the default is for the "NETWORKING" setting. It's possible it's "no" and that's why it's not starting on boot.

cjc
  • 24,916
  • 3
  • 51
  • 70
  • you got it! thanks a million. file didnt exist, a quick touch and vi did the trick. – Cameron Aziz Jul 07 '12 at 16:33
  • 4
    How was this missing on your system? Running `system-config-network` after the initial installation would get things in the right place if they weren't defined during the installation process. – ewwhite Jul 07 '12 at 16:51
7

Open /etc/sysconfig/network-scripts/ifcfg-eth0 file and replace line

ONBOOT=no

with

ONBOOT=yes

save and exit the file, and restart the linux system.

masegaloeh
  • 18,236
  • 10
  • 57
  • 106
Mrugesh
  • 71
  • 1
  • 1
3

Disable the NetworkManager service with chkconfig or ntsysv and see if that helps.

If it's not running, check your /var/log/boot.log, dmesg and /var/log/messages. Following a clean boot, grep eth0 /var/log/messages or dmesg | grep eth0 should give you an idea of what's happening.

Is this a new VM or a cloned system (P2V)?

ewwhite
  • 197,159
  • 92
  • 443
  • 809
1

I had the same issue with a headless Centos8 on my rpi. The config file in /etc/sysconfig/network-scripts/ is accurate according to DHCP protocols, however, each time I rebooted I got "Ethernet not found". My fix was changing to static network config.

0

Make sure in the folder /etc/sysconfig/network-scripts/ you have only the relevant files, and no others!

Take special care with vi editor or similar that create backup files ended with ~

When this happens, I've seen some linux distros failing to bring up some interfaces at boot.

JCM
  • 143
  • 1
  • 6
0

Try adding a Legacy Network Adapter, which is an emulated Intel e1000 GB Nic. This fixed the issue for me of Centos not automatically starting networking.

FoxDeploy
  • 211
  • 3
  • 7