Sub interface on Red Hat 6/CentOS 6

I was attempting to create an alias interface (aka sub interface) to have a second IP address on the same physical interface. I start with eth0 configured on the machine with a static IP of with a netmask of I could create a temporary interface using the command ‘ifconfig eth0:1 up” and the interface will come online and respond to traffic. However after a reboot this interface will go away (normal behavior). In order to keep this interface perpetually I duplicate the config file at /etc/sysconf/network-scripts/ifcfg-eth0 and rename it if cfg-eth0:0, then change the IP information accordingly (the addresses are in the same subnet). To bring this online I have used both of the following commands with the same result:

ifup eth0:1
service network restart

Both of these commands will cause eth0:1 to come online and start responding to pings, but will take eth0 offline (it stops responding to pings).

ifconfig -a will show a eth0 with the ipaddress assigned to eth0:1. Rebooting the machine will bring both interfaces online as intended, however restarting the network services (service network restart) will break the config as described above.

The Problem:

There once was a time long ago when the IP addresses on a linux machine was controlled with the config files. In Red Hat distros, these config files are located in /etc/sysconfig/network-scripts/. Back in 2005, in an attempt to make this process a little easier, Red Hat developed the Network Manger. The Nework Connections GUI that you find in the System > Preferences menu talks to the Network Manager service. You can also use the textual user interface (TUI) with the command:


Well it turns out that the Network Manager does not support multiple IPs per interface. So when restarting the networking service it uses NetworkManager to bring the interfaces online, thus no sub-interface loaded. When rebooting the interfaces are brought online before, and by the same process as, NetworkManager.

The Solution:

Disabling the NetworkManager service will allow you to bring both interfaces online:

service NetworkManager stop
chkconfig NetworkManager off

The first will turn off network manager so that you can use alias interfaces with the old fashioned config files. The second will disable it permanently.

Once this is done you can restart the network service (service network restart) and do an ifconfig -a and you should see both the original interface (eth0) and the sub interface (eth0:1)