Linux – How to enable IPv6 Autoconfiguration with static address in Linux (RHEL)

centosipipv6linuxredhat

I have a static IPv6 address I would like to assign. When I add the address to the /etc/sysconfig/network-scripts/ifcfg-eth0 file and restart networking I realize I get several IPv6 addresses. The first one is my static address (Prefix::host) and the second one is my autoconfiguration address (Prefix::MAC_ADDRESS).

I realized traffic was going out of the autoconfiguration address so my solution was to disable it. I added "IPV6_AUTOCONF=no" to the /etc/sysconfig/network-scripts/ifcfg-eth0 file. That solved the issue since the autoconfiguration address was gone.

However since there is no autoconfiguration I was not getting the default gateway. I believe Solaris has something called "token based IPv6" where you can specify the host portion of the address and autoconfiguration still runs to assign the prefix, dns, and default gateway. Can I do this in linux?

Best Answer

Token IPv6 addresses is a thing in Linux, man ip-token. Essentially,
ip token set ::123/64 dev eth0 There isn't really configuration supporting this in EL scripts, so I just dump it in a /sbin/ifup-local script.

Auto configuration addresses are not necessarily based on your MAC address. sysctl -w net.ipv6.conf.default.use_tempaddr=1 should turn on privacy extensions and also prefer your static global addresses, if you want that kind of predictability. Save to /etc/sysctl.d/ if you are happy with it and want it permanently. See ip-sysctl.txt for other options.