Configuring a static IPv6 address that inherits delegated prefix
I think what you're looking for is: ip token set ::dead:beef/64 dev eth0
From what I understand, you run that before running whatever you usually run to get an IP6 address, and 0:0:dead:beef
will be used instead of the normal EUI-64.
Strangely, this doesn't seem to add a corresponding link-local address, instead adding the normal EUI-64 with the fe80::/64
prefix. You can fix this manually with:
ip addr flush scope link dev eth0
ip addr add fe80::dead:beef/64 dev eth0
Replace the suffix, prefix size, and interface (::dead:beef
, /64
, eth0
) as appropriate.
As in the meantime Network Manager is used by default in almost all GNU/Linux distributions (according to http://news.softpedia.com/news/networkmanager-1-4-adds-support-for-setting-ipv6-tokenized-interface-identifiers-507601.shtml) I thought this other discussion at https://unix.stackexchange.com/a/403541/259695 may be helpful. The token can be set by
nmcli connection modify eth0 ipv6.method "auto" # if not already
nmcli connection modify eth0 ipv6.addr-gen-mode "eui64" # use interface token
nmcli connection modify eth0 ipv6.token "::dead:beef" # or "::2" - as you like
which will write IPV6_TOKEN=::dead:beef
to /etc/sysconfig/network-scripts/ifcfg-eth0 to survive a reboot. To immediate apply this restart the interface by
nmcli connection up id eth0 # restart