RedHat / CentOS EL5 Static IPv6 woes

Does RedHat EL5 / CentOS like doing static IPv6? NO

It is easy to add a static IPv6 address, but it will still auto configure a dynamic one. Many times you don’t care. But sometimes you just want 1 address on the box then….

[root@myhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=myhost.mydomain
GATEWAY=1.2.3.1
IPV6FORWARDING=no
IPV6INIT=yes
# this does NOT work, but set it anyway in the hopes that someday it will
IPV6_AUTOCONF=no
IPV6_ROUTER=no
# should be here but had to move to eth0 to prevent an error message
# xIPV6_DEFAULTGW="1:2:3:4::1" 

[root@myhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Whatever.... Ethernet
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
HWADDR=01:02:03:04:05:06
#
IPADDR=1.2.3.4
NETMASK=255.255.255.0
NETWORK=1.2.3.0
BROADCAST=1.2.3.255
GATEWAY=1.2.3.1
#
# IPV6INIT=yes in network
IPV6ADDR="1:2:3:4::4/64"
IPV6_DEFAULTGW="1:2:3:4::1"

The above “should” be enough, but alas…
(you will probably have to add the line)

[root@myhost ~]# vi /etc/sysctl.conf

...

# Disable IPv6 Autoconf
net.ipv6.conf.default.autoconf=0

Now for the running kernel…

[root@myhost ~]# echo 0 > /proc/sys/net/ipv6/conf/all/autoconf
[root@myhost ~]# echo 0 > /proc/sys/net/ipv6/conf/eth0/autoconf

Finally…

[root@myhost ~]# service network restart

Leave a Reply