How to add a network interface alias (for example eth0:0) on CentOS6 or RHEL6 in the "correct" way that is through NetworkManager without NM_CONTROLLED=no. And this has to be done without GUI.

Thank you, a

  • Is eth0 managed by NetworkManager? – Michael Hampton Sep 10 '12 at 4:33
  • yes # cat ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none NM_CONTROLLED=yes – Antoni Sawicki Sep 10 '12 at 5:00
  • 1
    NM_CONTROLLED=yes doesn't necessarily mean that the interface is managed by NetworkManager. NM_CONTROLLED=yes is the default value and is present even on systems which don't have NetworkManager installed. – Stefan Lasiewski Jan 28 '14 at 0:40

run following commands as root:-

  1. cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
  2. vi /etc/sysconfig/network-scripts/ifcfg-eth0:0

Find entry that read as follows:


Replace with:


Find entry that read as follows:


Replace it with additional IP address you want to give the machine:



ifup eth0:0

or service network restart

similarly you can add additional ip addresses.

for more details refer to :- http://www.cyberciti.biz/faq/linux-creating-or-adding-new-network-alias-to-a-network-card-nic/

| improve this answer | |
  • You didn't read the question. The answer you presented is the "old" or "incorrect" way, that is without NetworkManager. If you do it the new file ifcfg-eth0:0 will be deleted unless it has NM_CONTROLLED=no option. My question was how to add it through NetworkManager correctly. – Antoni Sawicki Sep 10 '12 at 18:56
  • Also if you're going to point to documentation at least point to the documentation most relevant to CentOS which is the upstream Distro. access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/… – Red Tux Sep 11 '12 at 1:49
  • Network Manager Provides GUI tools to configure a network.It cant be used without GUI.Please explain your purpose of using it with command line.Until and unless you make it clear what actually your purpose is we cannot help you.The answer i presented is non-NM method i did this because you didnt made it clear what actually your purpose is. – achal tomar Sep 11 '12 at 21:11
  • I need to add the second IP address or interface alias from a shell script and it has to be compatible with NM. Thanks. – Antoni Sawicki Sep 12 '12 at 4:19
  • Well in that case you can refer to:-ubuntuforums.org/showthread.php?t=1259634 This is for ubuntu but making a script out of it for RHEL6 is not a difficult task.It must work in your case i hope. – achal tomar Sep 12 '12 at 6:19

NetworkManager has only a very basic CLI nmcli which, unfortunately, is not capable of creating connections at this time (but can bring them up and down).

If you need to configure a machine without a GUI it's strongly recommended you use the normal (non-NM) method as described in the documentation and do not use NetworkManager at all. I will note that you haven't actually given a reason to use NetworkManager on this system, so I have to recommend against it.

If you really have to do this, the NetworkManager way on Red Hat-derived systems is to add all of the IP addresses to the same /etc/sysconfig/network-scripts/ifcfg-eth0 file. This was described in the NetworkManager documentation under Device Aliases.


| improve this answer | |
  • I would refer to SELinux statement that programs should be made compatible with SELinux rather than disable it. Same principle happens here. I want my shell script to be compatible with NM rather than disable it. – Antoni Sawicki Sep 12 '12 at 4:25
  • I've posted the directions, but I still have to recommend against it, since you haven't shared with us a good reason for using NetworkManager. – Michael Hampton Sep 12 '12 at 4:35

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.