Linux – Disable inet6 link-local address from one interface

ipv6link-locallinux

Anyone know how I can disable the link-local address from just one interface on CentOS 5.6?
This is what I tried:

root-> egrep -i ipv6 /etc/sysconfig/network-scripts/ifcfg-eth0
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_ROUTER=no

root-> egrep -i ipv6 /etc/sysctl.conf 
#disable ipv6 from eth0
net.ipv6.conf.eth0.disable_ipv6 = 1
net.ipv6.conf.eth0.autoconf = 0

root-> ip -f inet6 a show dev eth0
 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
    inet6 fe80::20c:29ff:fe3c:16af/64 scope link 
       valid_lft forever preferred_lft forever


root-> ip -f inet6 a del fe80::20c:29ff:fe3c:16af/64 dev eth0

root-> ip -f inet6 a show dev eth0

Nothing here

But then the address comes back:

root-> ifdown eth0 && ifup eth0

root-> ip -f inet6 a show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
    inet6 fe80::20c:29ff:fe3c:16af/64 scope link 
       valid_lft forever preferred_lft forever

Thanks.

Best Answer

It will be the CentOS network scripts doing something that go against what you're trying to do. My guess is that if you do everything as you have up until:

ifdown eth0 && ifup eth0

but instead run:

ifconfig eth0 down && ifconfig eth0 up

you should be OK. ifdown and ifup are system scripts which do much more than just bringing an interface up and down. I suggest writing your own custom script to modify the properties of the interface, outwith ifdown/ifup.

Or raise this as a bug with CentOS as quite possibly their system scripts aren't strictly doing what they are supposed to be doing, in this case.