diary at Telent Netowrks

Static IPv6 addresses#

Sat, 05 Dec 2020 22:00:48 +0000

Advent of Blog, day 5

Short one, today. After all that writing about airsonic and sniproxy the other day, I went to put some music on yesterday and found that it didn't work any more.

A series of suppositions

I broke my network significantly last week by switching from GNOME to KDE

... Let's just take a moment to reflect on how utterly bonkers it is that switching the desktop environment should break networking, but GNOME apparently has NetworkManager as a dependency, or possibly vice versa ...

and in the course of fixing that, I seem to have enabled systemd-networkd, which had changed the way that the machine was getting an IPv6 address. Where I previously had 2001:nnn:nnn:nnn::ed9, now I have 2001:nnn:nnn:nnn::148 and 2001:nnn:nnn:nnn:xxxx:xxxx:xxxx:xxxx.

IPv6 address allocation is simultaneously much simpler and much more complicated than IPv4 was, but the short form is: you can have a global address via SLAAC or via DHCPv6 or both. Addresses from SLAAC are 64 bits of prefix (here, 2001:nnn:nnn:nnn) plus 64 bits derived from your 48 bit MAC address. Addresses from DHCP are the prefix plus whatever the DHCP server gives you when you present it with a DUID, so I'm going to assume that these ::148 and ::ed9 are from DHCP - my MAC address isn't full of zeroes - and that networkd is presenting a different DUID than NetworkManager was.

There are, I guess, two possible routes to win here: find out how to make networkd present the same DUID as NetworkManager did, or reconfigure OpenWrt to accept the new one and give me the old address. I'm going for the latter approach, so, let's login to the router and use uci show dhcp to find the per-host setting


There are two things I now know to be wrong with this:

So we can fix them both:

uci set 'dhcp.@host[0].duid=00020000ab11406665c3f2e75232'
uci set 'dhcp.@host[0].hostid=0e9d'
/etc/init.d/odhcpd stop; /etc/init.d/odhcpd start

And down/up the interface on the client to make a new request (don't use renew, it doesn't help here)

sudo networkctl down vbridge0 ;sleep 1; sudo networkctl up vbridge0

and now I have my local services accessible again. Yay me.

You may be wondering why I have vbridge0 as my primary interface on that machine and not enp1 or en0s31f6 or en4s31f6z1q3zz9zzzα, and the answer is: it's a bridge between the ethernet interface and one or more tap devices for virtual hosts. I don't think anything I've described here would be different for a hardware ethernet, but don't quote me, I haven't tried it.