I’m trying to create a script in my dhcpv6 client that adds an nd prefix for my LAN (a ::/64) from my ISP provided /56. How can I do this? I was thinking of something like:
but this doesn’t work, and it wouldn’t work for ::/56 prefixes where there are abbreviated IPs. Any working examples would be extremely appreciated! Thank you
I solved this by adding the below to my DHCPv6 Client Advanced Configuration:
:if ($"pd-valid" = 1) do={
:local lanVZ ([:pick $"pd-prefix" 0 [:find $"pd-prefix" "/"]]."/64");
:log info "VZ value is $lanVZ";
/ipv6 nd prefix set interface=sfp-sfpplus1-LAN prefix=$"lanVZ" [find prefix~"2600:4041"]
/ipv6 nd prefix add interface=sfp-sfpplus1-LAN prefix=$"lanVZ";
}
This way my LAN network is always provided a correct /64 prefix from my dynamic ISP assigned /56 via neighbor discovery. The IPv6 address from my ISP always begins with 2600:4041 so I use that to identify if the prefix needs to be added (removed for some reason) or updated (what usually happens). This is a bit of a hack but I can’t figure out a better way to do this yet. Hope this helps someone.
Not sure I know what that is. I saw a “from pool” option in the dhcpv6 server but I’m not using dhcpv6 on my LAN only neighbor discovery. Is there a better way to do this??
hah, oh wow that saves me a lot of time. thanks so much. but stupid question - it looks like when I do it this way the valid lifetime is 30 days and there isn’t a way to change that. My ISP changes my prefix regularly and if there’s a reboot or refresh/renew of the IPv6 address on my router the prefix changes and clients will still use the old prefix. Is there a way to fix that?
with my method I was able to specify the valid lifetime to 5 minutes so clients would refresh their ipv6 address more quickly (invalidate the old address)