Centos – make permanent virtual interface

centoslinuxnetworking

I want to have two IPs sharing the same interface and it's just working fine by creating a virtual interface using the following command (eth0 is my original interface):

ifconfig eth0:0 <someip> netmask <somenetmask>

It works fine and I can see it using ifconfig until I restart the system.
So, I did create ifcfg-eth0:0 in /etc/sysconfig/network-scripts/ with this content:

DEVICE=eth0:0
IPADDR=<some ip>
NETMASK=<some netmask>
ONBOOT=yes

However, when I put this virtual interface up, it overwrites the original interface and when I put original interface up, it overwrites the virtual interface. I just can't use both at the same time when I'm using the permanent way.

P.S.: I use the following commands to put interface up:

# To make up    
ifup eth0 
ifup eth0:0

I'm using cent-OS

Best Answer

I can't replicate that problem with Centos. Have you tried eth0:1 instead of eth0:0? Also, I noticed that ifup eth0 brings up all virtual interfaces, so you don't need to ifup eth0:1.

Tested with Centos 6.4.

Related Question