To get a better idea of what gaps and opportunities exist with IPv6 networks, I have been rolling out a lab environment that is 100% single-stack IPv6. One of the great things about IPv6 is that it makes address space planning so much simpler. The standard /64 subnet size is so large that hosts can choose random IPs with practical certainty that there will be no conflicts. This allows new hosts to self-configure without a central management service. So easy! But, how do I find these new servers, especially physical hosts, once they are provisioned? I wrote a small utility to help with that called
At first I figured mDNS would do the trick here. But after testing it I found that Avahi would return an interface IP at random. This was a problem since each interface was going to have a number of different IPv6 addresses that had different uses.
Every host has at least four IPs:
The only one I am interested in for internal connectivity is the Stable Privacy ULA on the primary network interface. The Stable GUA might be changed by the ISP. The Temporary GUA will change all the time. The link local address isn’t routable.
Also, what even is the primary network interface? Well that’s a subjective thing that depends on what the operator wants to accomplish. In this case I want the interface that has a ULA address (
fd00::/8) that is connected to the network segment that is routed to the rest of my network.
The way I decided to solve this was to create a service that would reply to an interrogation with the IP that was most like the IP to which it was asked to respond. The definition of “most like” is an IP that has the most left hand bits matching the source IP of the interrogator.
The result is that I can query a network full of hosts that have a bunch of IPv6 addresses on different interfaces. One such host might look like this:
thogan@gurp2:~$ ip ad | grep inet6 inet6 ::1/128 scope host inet6 fdbc:6a5c:a49a:1005:c568:25de:87af:9c65/64 scope global dynamic mngtmpaddr stable-privacy inet6 2601:441:8301:83d4:4dc6:363c:fc3b:a259/64 scope global dynamic mngtmpaddr stable-privacy inet6 fe80::bf37:9554:b1d9:c085/64 scope link stable-privacy inet6 fe80::1a66:daff:fe0f:270a/64 scope link inet6 fdbc:6a5c:a49a:ffff::1/64 scope global tentative inet6 fe80::1/64 scope link tentative
And all hosts will respond with IPs that are consistently of the same address type and on the desired subnet:
thogan@gurp2:~$ ipannounce -mode sol -selector fdbc:: -solport 5191 Running as solicitor using address fdbc:6a5c:a49a:1005:c568:25de:87af:9c65 Solicitor listening on [::]:5191 gurp2 fdbc:6a5c:a49a:1005:c568:25de:87af:9c65 gurp1 fdbc:6a5c:a49a:1005:184:c73e:56f:ac59 gurp3 fdbc:6a5c:a49a:1005:d61e:7b5a:47d1:a00d horf1 fdbc:6a5c:a49a:1005:3277:7671:30bd:52d0 horf5 fdbc:6a5c:a49a:1005:b12f:26bf:a4b7:89b5 horf3 fdbc:6a5c:a49a:1005:357a:5944:5a04:cb1a horf2 fdbc:6a5c:a49a:1005:e835:d3d9:d8de:6053 horf4 fdbc:6a5c:a49a:1005:e76f:bfeb:4ecf:4a87
GitHub project here: https://github.com/arcandspark/ipannouce