Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In CentOS 6.4, when using 'ifdown' on a virtual interface, the IPv6 addresses configured on the physical interface are also removed. I expect only the virtual interface to be changed.

How can I prevent 'ifdown' on a virtual interface from affecting the IPv6 addresses on the physical interface?

We run CentOS 6.4 servers with one physical network card, and multiple virtual interfaces. As well, we have multiple IPv6 addresses bound to the physical interface.

For example, /etc/sysconfig/network-scripts/ifcfg-eth0 is:

DEVICE=eth0
IPV6_DEFAULTGW="AAAA:BBBB:CCCC:D::1"
IPV6INIT="yes"
USERCTL="no"
DNS2="8.8.4.4"
DNS1="8.8.8.8"
IPADDR="xx.x.xxx.201"
PRIMARY="yes"
NETMASK="255.255.255.192"
BOOTPROTO="static"
IPV6ADDR_SECONDARIES="AAAA:BBBB:CCCC:D::202 AAAA:BBBB:CCCC:D::203"
IPV6ADDR="AAAA:BBBB:CCCC:D::201"
ONBOOT="yes"

And the output from ifconfig:

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr D4:AE:52:B4:AF:8C  
          inet addr:xx.x.xxx.201  Bcast:xx.x.xxx.255  Mask:255.255.255.192
          inet6 addr: AAAA:BBBB:CCCC:D::201/64 Scope:Global
          inet6 addr: AAAA:BBBB:CCCC:D::202/64 Scope:Global
          inet6 addr: AAAA:BBBB:CCCC:D::203/64 Scope:Global
          inet6 addr: fe80::d6ae:52ff:feb4:af8c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:607986 errors:0 dropped:0 overruns:0 frame:0
          TX packets:244764 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:99225727 (94.6 MiB)  TX bytes:40528574 (38.6 MiB)
          Interrupt:36 Memory:da000000-da012800

There are also multiple virtual interfaces, such as ifcfg-eth0:29 are defined for extra IPv4 addresses:

DEVICE=eth0:29
USERCTL="no"
IPADDR="xx.x.xxx.202"
NETMASK="255.255.255.192"
BOOTPROTO="static"
ONBOOT="yes"

And ifconfig output:

# ifconfig eth0:29
eth0:29   Link encap:Ethernet  HWaddr D4:AE:52:B4:AF:8C  
          inet addr:xx.x.xxx.202  Bcast:xx.x.xxx.255  Mask:255.255.255.192
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:36 Memory:da000000-da012800 

The configuration works well when all interfaces are up. However, when I bring down one of the virtual interfaces:

/sbin/ifdown eth0:29

The IPv6 seconaries on eth0 are removed!

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr D4:AE:52:B4:AF:8C  
          inet addr:xx.x.xxx.201  Bcast:xx.x.xxx.255  Mask:255.255.255.192
          inet6 addr: fe80::d6ae:52ff:feb4:af8c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:617867 errors:0 dropped:0 overruns:0 frame:0
          TX packets:249076 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:100506865 (95.8 MiB)  TX bytes:41031979 (39.1 MiB)
          Interrupt:36 Memory:da000000-da012800 

After some investigation, I see that in /etc/sysconfig/network-scripts/ifdown-ipv6, the given device name (eth0:29) is shortened (to eth0), and at the end of the script "ipv6_cleanup_device" is called which removes all the ipv6 addresses from the physical interface, instead of the virtual one (which doesn't have any).

How can I prevent 'ifdown eth0:29' from modifying the IPv6 addresses on the physical interface?

share|improve this question
    
Simple, stop using virtual interfaces. They are deprecated. You can add as many IPv4 addresses directly to eth0 as you need. –  Zoredache Apr 30 '13 at 17:48

1 Answer 1

Don't use these old deprecated alias interfaces. Instead, add all the IP addresses to eth0.

Edit /etc/sysconfig/network-scripts/ifcfg-eth0 and add the addresses:

IPADDR2="xx.x.xxx.202"
NETMASK2="255.255.255.192"
IPADDR3="..."

and so on.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.