Why the default eth0 interface is down by default on CentOS?

Edit /etc/sysconfig/network-scripts/ifcfg-$IFNAME. Change the ONBOOT line's value to yes.

$IFNAME will be eth0 on many EL6 boxes, but on EL7 and EL6 boxes using the Consistent Network Device Naming scheme, it might be something else, like en3p1. Use the command ip link to get a list of network interfaces, including the ones that are currently down.

In your future installs, pay more attention. You blew past an option in the network configuration section that let you tell it to bring the interface up on boot. This on-boot option is off by default in EL6 and EL7, whereas in previous versions, it was on by default.

To make the network interface come up on first boot at install time in EL7, go to the ConfigureGeneral tab in the network configuration screen, then check the box labeled Automatically connect to the network when available.

As to why they changed this, I'd guess security reasons. It gives you a chance to tighten things down a bit from the default setup before bringing up the network interface for the first time.


If you don't have a DHCP server in your network, you must set a static IP address. Please consider the following example:

vim /etc/sysconfig/network-scripts/ifcfg-eth0

BOOTPROTO=none
DEVICE=eth0
IPADDR=192.168.1.10 # your IP address
NETMASK=255.255.255.0 # your netmask
NETWORK=192.168.1.0 
ONBOOT=yes

Add GATEWAY to your /etc/sysconfig/network file:

NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=hostname.domainname
GATEWAY=192.168.1.1 # your gateway

Issue the following command to start network on boot:

chkconfig network on

Restart your network service:

service network restart

Take a look at your network interfaces

ifconfig

You didn't mention what version of CentOS you are using. If I'm not mistaken, 6.x uses NetworkManager by default.

I rarely install X windows on my servers, so NetworkManager is just a pain for me. I disable it and enable the standard 'network' service.

chkconfig NetworkManager off
chkconfig network on

service NetworkManager stop
service network start

To enable DHCP on the interface, run system-config-network, edit the appropriate device, save, and restart the network service. Alternately, you can edit /etc/sysconfig/network-scripts/ifcfg-eth0 and add

ONBOOT=yes
BOOTPROTO=dhcp

Save changes and restart the network service.