> Am 02.09.2024 um 22:21 schrieb Chris Ross <cross+open...@distal.com>:
> 
> I’m trying to move from a static IPv6 network to a dynamic allocation from an
> ISP.  The hard part is that some of my hosts have secondary addresses for
> specific services to use.  I need to find a way to listen to router adverts
> but then manually add an alias with a static lower 64 bits.  Looking for
> suggestions.
> 
> FreeBSD’s recent rtsold has a -A option to run a script.  I don’t see anything
> in slaacd or dhcpleased that seems to provide anything like that.
> 
> Let me know any thoughts you have.  Ideally, not rolling my own tool to 
> monitor
> the interface for a changing primary IPv6 network.
> 
>                   - Chris

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

So the only way to react to such changes is by polling.

The trick here is to find a way to determine the current public IPv6 prefix.

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)}'

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.

Note: I do not know how to generate completely manual IIDs that automatically 
combine with the current public IPv6 prefix. But it might be possible to have 
one EUI64 IID and use that to trigger the reconfiguration of the other IPv6 
addresses with manual IIDs.


HTH
Mike

Reply via email to