[CentOS] Cannot set alias IP address

Nikolaos Milas

nmilas at noa.gr
Mon Jun 18 08:31:03 UTC 2012


Hi,

I have an eth0 interface (it's a CentOS 6 guest VM on a KVM host) which 
is configured as follows (see below) with a primary public IP address of 
xxx.xxx.xxx.130 (which works fine). I cannot set an alias IP address. I 
want eth0 to also use another IP address (xxx.xxx.xxx.131, so I create 
/etc/sysconfig/network-scripts/ifcfg-eth0:1. Then:

# service network restart
Shutting down interface eth0:  Device state: 3 (disconnected)
                                                            [  OK ]
Shutting down loopback interface:                          [  OK ]
Bringing up loopback interface:                            [  OK ]
Bringing up interface eth0:  Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/2
                                                            [  OK ]
# ping xxx.xxx.xxx.130
PING xxx.xxx.xxx.130 (xxx.xxx.xxx.130) 56(84) bytes of data.
64 bytes from xxx.xxx.xxx.130: icmp_seq=1 ttl=64 time=0.078 ms
64 bytes from xxx.xxx.xxx.130: icmp_seq=2 ttl=64 time=0.044 ms
^C
--- xxx.xxx.xxx.130 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1767ms
rtt min/avg/max/mdev = 0.044/0.061/0.078/0.017 ms

# ping xxx.xxx.xxx.131
PING xxx.xxx.xxx.131 (xxx.xxx.xxx.131) 56(84) bytes of data.
 From xxx.xxx.xxx.130 icmp_seq=2 Destination Host Unreachable

If I try:

# ifup eth0:1
Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/3
state: activated
Connection activated

then I totally lose network connectivity.

What am I doing wrong? Please advise!

--------------------------------------------------------------
eth0
--------------------------------------------------------------
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT="yes"
HWADDR="DE:DB:EE:CD:8E:03"
TYPE=Ethernet
BOOTPROTO=static
GATEWAY=xxx.xxx.xxx.129
NETWORK=xxx.xxx.xxx.128
IPADDR=xxx.xxx.xxx.130
NETMASK=255.255.255.248
BROADCAST=xxx.xxx.xxx.135
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6ADDR=2001:xxxx:xxxx:xxxx::130
IPV6_DEFAULTGW=2001:xxxx:xxxx:14::1
DNS1=xxx.xxx.xxx.211
DNS2=xxx.xxx.xxx.210
DNS3=2001:xxxx:xxxx:xxxx::210
IPV4_FAILURE_FATAL=no
IPV6_FAILURE_FATAL=no
DOMAIN="example.com example.com"
--------------------------------------------------------------

I've tried:
--------------------------------------------------------------
eth0:1
--------------------------------------------------------------
DEVICE="eth0:1"
ONPARENT="yes"
BOOTPROTO=none
IPADDR=xxx.xxx.xxx.131
NETMASK=255.255.255.248
BROADCAST=xxx.xxx.xxx.135
--------------------------------------------------------------

and:
--------------------------------------------------------------
eth0:1
--------------------------------------------------------------
DEVICE="eth0:1"
NM_CONTROLLED="yes"
ONBOOT="yes"
HWADDR="DE:DB:EE:CD:8E:03"
TYPE=Ethernet
BOOTPROTO=static
ONPARENT="yes"
GATEWAY=xxx.xxx.xxx.129
NETWORK=xxx.xxx.xxx.128
IPADDR=xxx.xxx.xxx.131
NETMASK=255.255.255.248
BROADCAST=xxx.xxx.xxx.135
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6ADDR=2001:xxxx:xxxx:xxxx::131
IPV6_DEFAULTGW=2001:xxxx:xxxx:xxxx::1
DNS1=xxxx.xxxx.xxxx.211
DNS2=xxxx.xxxx.xxxx.210
DNS3=2001:xxxx:xxxx:xxxx::210
IPV4_FAILURE_FATAL=no
IPV6_FAILURE_FATAL=no
DOMAIN="example.com example.com"
--------------------------------------------------------------

Thanks,
Nick





More information about the CentOS mailing list