RHEL 6 and networking

To someone surprise Red Hat Enterprise Linux 6 does not configure network when you do the default minimal installation. You can still make the Anaconda installer to do it for you but you need to hit Configure network button on the domain name setting page. If you forget you don't have a network. Tough luck.

Since RHEL6 use NetworkManager by default users that just installed text-only server can be surprised twice as their /etc/sysconfig/network-scripts/ifcfg-eth0 can look like:

DEVICE="eth0"
HWADDR="XX:XX:XX:XX:XX:XX"
NM_CONTROLLED="yes"
ONBOOT="no"


By setting ONBOOT to "yes" does not change a thing! Since there is no NetworkManager the interface cannot magically go up. What you need to do is to add BOOTPROTO="dhcp" or BOOTPROTO="static" respectively. It does not matter if you change NM_CONTROLLED to "no" or "yes" because, again, it has not been installed with the default (or minimal) server installation. On the other hand you can set it to "no" just in case you install it later on.

Now, what you really need it this:

DEVICE="eth0"
HWADDR="XX:XX:XX:XX:XX:XX"
NM_CONTROLLED="no"
ONBOOT="yes"
BOOTPROTO="dhcp"


for DHCP configuration. For static one do something like:

DEVICE="eth0"
HWADDR="XX:XX:XX:XX:XX:XX"
NM_CONTROLLED="no"
ONBOOT="yes"
BOOTPROTO="static"
IPADDR=XXX.XXX.XXX.XXX
NETMASK=XXX.XXX.XXX.XXX


Please note you cannot set both DNS1 and DNS2 here because this setting is solely for PPP connections. You need to update your /etc/resolv.conf adding "nameserver XXX.XXX.XXX.XXX" line(s). And don't forget to set GATEWAY="XXX.XXX.XXX.XXX" in the /etc/sysconfig/network config file! Now:

service network restart

You are done. One more trick today. No internet and you are not sure about the options in ifcfg-eth0 or network sysconfig files? Everything is documented! Just remember this file: /usr/share/doc/initscripts-*/sysconfig.txt. I know this can be pretty challenging thus I recommend just to remember sysconfig.txt and find it with slocate or GNU find. Or train the rpm -qd initscripts command which shows all the documentation files from the initscripts RPM packages. Use the force, Luke.
15 March 2011 | rhel | english
twitter.com linkedin.com
google.com/+ facebook.com
flickr.com youtube.com