No network on CentOS 6


When installing a minimal CentOS 6 system, minimal really, really means minimal. After a reboot the network interfaces do not start, so network connectivity is non existing.

Looking into that I noticed that the file /etc/sysconfig/network-scripts/ifcfg-eth0 contained

DEVICE=eth0
HWADDR=11:22:33:44:55:66
NM_CONTROLLED=yes
ONBOOT=no
BOOTPROTO=dhcp
TYPE=Ethernet
USERCTL=no
PEERDNS=yes
IPV6INIT=no

The lines that mess things up are NM_CONTROLLED=yes meaning the interfaces are managed with NetworkManager, which isn’t actually installed as part of a minimal install. You want a minimal install, you get a minimal install. And ONBOOT=no, meaning do not start the interface on boot. How stupid is that!

The trick is to run something like system-config-network-tui to set the IP addresses manually, but as you might imagine, that’s not installed either.

So you best edit /etc/sysconfig/network-scripts/ifcfg-eth0 by hand and set it to: ~ DEVICE=eth0 HWADDR=11:22:33:44:55:66 NM_CONTROLLED=no ONBOOT=yes BOOTPROTO=none TYPE=Ethernet USERCTL=no PEERDNS=yes IPV6INIT=no IPADDR=192.168.0.1 NETMASK=255.255.255.0 GATEWAY=192.168.0.254 DNS1=192.168.0.254 ~

The USERCTL=…​ line is optional: If set to yes it lets non-root users control the interface.

After setting this a service network restart will do the trick.

See also