I am already a little bit familiar with Linux distros like Debian or Ubuntu (yeah, very similar) but I wanted to try Red Hat based - CentOS 6.2 . I have installed it on my Windows 7 host in virtualBox and tried to play with it a little.

I have come across a small problem, namely : the default eth0 interface is down by default. I use the option with NAT ( the virtual machine is 'behind' the host ). Even if I bring the interface up with

ifconfig eth0 up it does not work right away. I get this after bringing the interface up:

What should be done more to configure the network on CentOS machine?CentOS showing the output of ifconfig.  Note that eth0 is down.

P.S. Sorry for screenshot but I do not know how to get the text out of the VirtualBox.

  • 2
    There is no eth1 on your screenshot... Btw, try to run DHCP on your interface: dhclient eth0. – pbm Apr 17 '12 at 18:58
  • @pbm 1) I changed eth1 to eth0 in the description. 2) dhclient eth0 worked :) thanks. How can I make it default - run like this after reboot ? – Patryk Apr 17 '12 at 19:18
  • I'm not sure, but check out this blog post: blog.malaya-digital.org/… – pbm Apr 17 '12 at 19:49

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.

| improve this answer | |
  • Precisely the info I was looking for. Thank you! – SamAndrew81 Mar 22 '19 at 16:57

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

IPADDR= # your IP address
NETMASK= # your netmask

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

GATEWAY= # 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

| improve this answer | |

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


Save changes and restart the network service.

| improve this answer | |

From what I have gathered from experimenting and reading, I agree with uther that Network Manager seems to load by default, but the network service does not.

When I recently had a VM host starting up without eth0 showing up in ifconfig output, it was because I had Network Manager running, network not running, and NM_CONTROLLED=no in my /etc/sysconfig/network-scripts/ifcfg-eth0 file.

As soon as I ran service network restart, eth0 showed up in ifconfig output. Rebooting, however, caused it to go away again.

The solution for me appears to be setting NM_CONTROLLED=no in /etc/sysconfig/network-scripts/ifcfg-eth0, then turning on the network service on startup (chkconfig network on, as uther and alexnorthsoul point out). I could (should?) probably turn NetworkManager off by default, but it is working for me now and I am nervous about touching anything else.

By the way, my goal was to get the system to honor the my selected static IP. When I left NetworkManager running and set NM_CONTROLLED=yes (or omitted it), I got eth0 showing up in ifconfig, but the address was a DHCP address, not my static IP. So turning off NetworkManager spared me from DHCP, and turning on network caused it to load my settings that included the static IP.

I am no sys admin, but rather a developer, so these are not words from a CentOS expert, but just a survivor of configuring the VMs I needed.

| improve this answer | |

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.