Configuring a static IPv6 address that inherits delegated prefix

7

4

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.

Pablo

Posted 2014-09-04T01:31:28.503

Reputation: 95

1

possible duplicate of Configuring IPv6 on Debian - Global manual permanent addresses with delegated prefix

– heavyd – 2014-09-04T03:07:35.580

Edited my other question to be just about temporary address. I shouldn't have asked a 2 part question, it makes it difficult to mark the correct answer. – Pablo – 2014-09-05T11:22:23.353

Answers

6

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.

Zaz

Posted 2014-09-04T01:31:28.503

Reputation: 1 843

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 – 2015-06-09T14:45:11.540

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 – 2015-06-09T21:47:06.463

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 – 2015-06-09T22:17:26.797

Works great, noticed it doesn't create the MAC-based ff:fe address, but that's no big loss. – Pablo – 2015-06-10T17:34:46.500

Do you know of a way to add multiple tokens / configure multiple such "static dynamic" addresses? – wedi – 2018-08-15T07:01:50.217

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

Jürgen

Posted 2014-09-04T01:31:28.503

Reputation: 21

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...

Grogi

Posted 2014-09-04T01:31:28.503

Reputation: 101

Hmm. Thanks for the reply Grogi. However, the host in question is my DHCP server. – Pablo – 2014-09-10T02:22:35.447