Monday, September 02, 2024

Re: IPv6 static host address inside dynamic network

> On Sep 2, 2024, at 18:30, Mike Fischer <fischer+obsd@lavielle.com> wrote:
>
> To my knowledge there is no mechanism or hook to trigger when the public IPv6 prefix changes. (It would be nice to have such a mechanism though.)

Yeah. I see rtsold has a couple scripts it knows how to run, so that is a
place. But having a hook in slaacd(8) (or somewhere else?) would be nice.
Heck, I'd love to be able to configure "these are my IIDs for this interface"
in a conf file. That would be a little mixed between "autoconfiguration"
and manual though I guess.
Please speak up if you also think it would be valuable to have slaacd
configuration for either multiple IIDs for an interface, or a hook script
to be called when receiving and applying a RA.

> The following (adjust for your interface) is one way to extract the current public IPv6 prefix:
> $interface='em0'
> slaacctl show interface "$interface" \
> | grep 'prefix:' \
> | grep -v 'prefix: fd' \
> | cut -d' ' -f2 \
> | awk -F'::/' '{print substr($1,1,19)}'

I think this will not work when the network changes. Right now I see
two matches for that, one from the router I'm building which is getting
its IPv6 from a different location than the prior/current gateway.
I have the "new" network from that advertisement last night, with a
lifetime of 0. With some effort, I could write something to parse
slaacctl output with more thought. But, I'm not wholly sure I'd be
able to know enough about what the possible outputs mean.

> If you have static Interface IDs (IIDs, the lower 64 bits of the IPv6 address) then once you have determined that your prefix has changed you can trigger actions such updating DDNS, reconfiguring services listening on a specific public IPv6 address, etc.
>
> I use this in my /etc/hostname.if files to get a static IID with the current public IPv6 prefix:
> inet6 autoconf -temporary -soii
> This generates an EUI64 IID based on the MAC address.

I only have "inet6 autoconf" for the same purpose. Then, after sleeping
a few seconds, a couple of "inet6 alias" lines for the static secondary
addresses. But, of course, that only works for the historic static
IPv6 network I am moving away from.

Thanks for your thoughts!

No comments:

Post a Comment