8

My ISP (comcast) delegates a prefix, my router is passing along the prefix delegation (pd) onto the LAN. My Debian machine is getting the prefix and appending using EUI-64 address. That's nice but not very memorable. I prefer to have an additional "vanity" address within the PD prefix.

Some specificity:

  • The PD is (e.g., 2601:8:abcd:abcd/64)
  • My Linux box autoconfigures eui-64: 2601:8:abcd:abcd:DEAD:BEff:feEF:CAFE (for MAC DE:AD:BE:EF:CA:FE)

What I'd like is to manually create an interface: 2601:8:abcd:abcd::2 as a static global address, but if the Comcast prefix delegation changes, have the interface adopt the new delegated prefix and use the static suffix.

2

3 Answers 3

9

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.

5
  • That definitely looks promising. Looks like I have to upgrade my kernel though to take advantage of it. I'll update when I've had a chance to upgrade.
    – Pablo
    Jun 9, 2015 at 14:45
  • You must be running an old kernel. In case you (or anyone else) is interested, token is a feature added to iproute2 in 2013.
    – Zaz
    Jun 9, 2015 at 21:47
  • Yeah. I saw that as well but when I checked my kernel build date it was 2012. I had downloaded the newer iproute2 package that supported token and it complained about lack of support.
    – Pablo
    Jun 9, 2015 at 22:17
  • Works great, noticed it doesn't create the MAC-based ff:fe address, but that's no big loss.
    – Pablo
    Jun 10, 2015 at 17:34
  • Do you know of a way to add multiple tokens / configure multiple such "static dynamic" addresses?
    – wedi
    Aug 15, 2018 at 7:01
2

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
0

In addition to announcing the network prefix, you would need to use stateful DHCPv6 service.

Similar to DHCPv4, DHCPv6 server in stateful mode assigns hosts the addresses from the range you desire - and it can be a very small range, for instance 2601:8:abcd:abcd::10-2601:8:abcd:abcd::99. I've been using dnsmasq in my routers.

Typically, in addition to address assigned by DHCPv6, hosts will still autonomously generate unicast IPv6 address - each interface will have two (or even more) of them. You can switch that behavior off by modifying configuration of the router - disabling the autonomous address configuration flag will do the trick. But will also render majority Android devices unable to get IPv6 address; Android (at least with KitKat 4.4.4) still does not properly support DHCPv6...

1
  • Hmm. Thanks for the reply Grogi. However, the host in question is my DHCP server.
    – Pablo
    Sep 10, 2014 at 2:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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