0

Why CentOS doesn't run eth0 in startup?

In ifconfig there is only the lo interface. I must type

service network restart

to run interface eth0, why?

network-scripts eth0:

DEVICE=eth0
HWADDR=00:1D:09:67:E2:FB
TYPE=Ethernet
UUID=b6e7650e-b2e8-419e-ac6b-a26941053d2d
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
  • Do you have network and NetworkManager services enabled (chkconfig --list) ? Note, that this interface is set to be manged by NetworkManager. – Kalavan Sep 14 '16 at 14:26
  • chkconfig --list i.imgur.com/yVt2U11.png – sessam5 Sep 14 '16 at 15:27
  • Are there any related messages in your log files ? – user9517 supports GoFundMonica Sep 14 '16 at 17:24
  • What does /etc/sysconfig/network look like? Particularly, the value of NETWORKING=. – Aaron Copley Sep 15 '16 at 0:46
  • Is it a VM? Has the NIC been changed since the system was built? Look for messages in dmesg about eth0 being renamed to eth1 or something. – Aaron Copley Sep 15 '16 at 0:50
2

Are you booting in some non-standard runlevel? You can check it with one of:

runlevel
who -r

You can also check if network daemon is running before you try to restart it:

service network status
2

When you install Centos 7 (or Centos 6), there is a link in the main configuration screen for networking. You have to click on that screen and then turn on networking in the top right of the resulting screen. That will install centos with networking enabled. Likely whoever installed your system didn't do that.

In your situation since you are using 'service' rather than 'systemctl', I guess you are running Centos 6 or earlier. I think running

 chkconfig network on

Will make networking start on boot.

Your solution does not work

This is what I have in my network and network-scripts/ifcfg-eth0 files for a Centos 6 machine on which networking successfully starts at boot. My configuration is a little diffferent than yours, in that I don't use dhcp:

[root@developmentServer1 sysconfig]# cat network
NETWORKING=yes
HOSTNAME=developmentServer1
GATEWAY=192.168.1.1
[root@developmentServer1 sysconfig]# cat network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:15:17:9D:95:16"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="3d9bdb48-568c-4336-a89b-50312a5b7ff1"
IPADDR=192.168.1.22

I do not even have a defined service named "NetworkManager":

[root@developmentServer1 sysconfig]# chkconfig --list | grep -i network
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@developmentServer1 sysconfig]# cat /etc/redhat-release
CentOS release 6.4 (Final)
[root@developmentServer1 sysconfig]#

If you do, the suggestion to disable it is a worthwhile one to try.

  • Hello. Your solution dont work :/ Regards – sessam5 Sep 14 '16 at 14:11
1

Not sure which version of CentOS you're running, but versions 6 and 7 have different ways to enable the networking service on boot.

If you're on CentOS 6 and this is a server, you will want to set NM_CONTROLLED=no on your ifcfg-* files, for sanity. In CentOS 7, NetworkManager is the default service to manage networking and shouldn't be disabled.

On CentOS / RHEL 6:

chkconfig network on

On CentOS / RHEL 7 (systemd):

systemctl enable NetworkManager

If neither of these solve your issue, you'll want to add more details to the question, like any error messages in the boot sequence, system logs, ip ad or ifconfig -a output, etc.

  • i have a CentoOS6. I set "chkconfig network on" and set "NM_CONTROLLED=no". Dont work :/ – sessam5 Sep 14 '16 at 15:33
  • what about the output of ip ad or ifconfig -a? Do other hosts on the same LAN get IPs through DHCP? Does the eth0 MAC address match the HWADDR= directive in your ifcfg-eth0 file? – André Fernandes Sep 14 '16 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.