Dynamic IPv6 prefix, old prefix not deprecated (by some clients)

Hi,
my new ISP forces me to reconnect every 24 hours and with the reconnect i get not only a new IPv4 address, but also a new IPv6 prefix. After the reconnect odhcp announces the new prefix and announces the old prefix as deprecated (for some time). This works for my iPhone, iPad and linux-servers as they immediately start using the new prefix for SLAAC. The old prefix is kept for a few hours (but not used) and then deleted. In my understanding, this is how it should work.

My MacBook on the other hand is not following along. If i wake the MacBook from sleep after odhcp stops announcing the old prefix as deprecated, i think MacOS is still trying to use the old prefix (and this test fails). I see ip addresses for the old and the new prefix in settings under TCP/IP, but i have to reconnect the wifi to get IPv6 working again.
I am struggling to verify this assumption, because i have not found a counterpart to ip addr on MacOS to view valid_lf and preferred_lft of the prefix.

Has anyone an idea on how to solve this? Is there maybe an option to announce the old prefix as deprecated for a longer time or to force MacOS to use only recently announced prefixes?

/etc/config/dhcp:

config odhcpd 'odhcpd'
	option maindhcp '1'
	option leasefile '/var/lib/odhcpd/dhcp.leases'
	option leasetrigger '/usr/lib/unbound/odhcpd.sh'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '24h'
	option dhcpv4 'server'
	option ra 'server'
	list ra_flags 'none'
	option ra_mininterval '30'
	option ra_maxinterval '100'

Can we see the lan and wan6 network configs?

This should be:

list ra_flags 'other-config'

Although this sounds like an issue of macbook when it wakes up, I would use lower ra_lifetime and leasetime.

ifconfig is the macOS equivalent to ip addr if I remember correctly.

Please also have a look at this thread: Dynamic IPV6 prefix

config interface 'lan'
	option proto 'static'
	option netmask '255.255.255.0'
	option ipaddr '10.153.200.1'
	option ip6assign '64'
	option ip6hint '0'
	option device 'br-lan.10'

config interface 'wan'
	option device 'wan.7'
	option proto 'pppoe'
	option username 'XXX'
	option password 'XXX'
	option ipv6 'auto'

Ok ra_lifetime is already lowered to 300 with the settings above. I think it is automatically calculated from ra_mininterval or ra_maxinterval. Some time ago it tried to set ra_useleasetime, which crashed odhcp. I will try again.

Yes, in part. It is not showing the lifetime of the prefix.

Thanks, i was aware of this thread. In my case using the new prefix works, but not when the macbook sleeps through odhcp announcing the deprecation of the old prefix. At least i think that this is the problem.

On the mac try:

ipconfig getra [interface]

Its not super easy to read but I think it might get you the preferred and valid time.

This only shows the advertised valid and pref times of the prefix. I can not view the values for the old prefix, which is still listed in settings under used IPv6 addresses.

For now i am using:

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option ra 'server'
	list ra_flags 'other-config'
	option ra_mininterval '30'
	option ra_maxinterval '100'
	option ra_lifetime '300'
	option ra_useleasetime '1'

This gets me a valid and pref time of 43200 s for the prefix. If i set option leasetime to a lower value. The valid time of the prefix is reduced, but the pref time stays 43200 s, which results in the devices not acquiring an IPv6-address at all.

I think i solved the issue by adding option preferred_lifetime '2h'. For the first two hours after the prefix change odhcp announces the old prefix with a preferred lifetime of 0. This works on all my devices and they are deprecating the old prefix, but if the macbook sleeps through the prefix change and has no connection in the first two hours it still tries to use the old prefix. With the setting above the old prefix should have a preferred lifetime of 0 when i wake the macbook (e.g. 3 hours after prefix change).

relevant part of /etc/config/dhcp:
config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option ra 'server'
	list ra_flags 'other-config'
	option ra_mininterval '30'
	option ra_maxinterval '100'
	option ra_lifetime '300'
	option ra_useleasetime '1'
	option preferred_lifetime '2h'

I will do some further testing.

1 Like

So unfortunately, I never got it to work properly. Even my iPad will not connect through IPv6 sometimes. Both iPad and MacBook are accumulating the IPv6 addresses and are probably getting confused by which one to use. I just disabled distributing IPv6 addresses via SLAAC (and DHCPv6) for now.

I did some further testing and found a configuration that seems like it is working for me. Both MacOS and iOS just keep the old IPv6 SLAAC addresses longer than they should. But with ifconfig en0 i was able to check that at least MacOS deprecates the old IPv6 addresses immediately. One thing i noticed is that i have to restart my MacBook (or at least turn off and on WiFi) after a router restart to get it working properly.

Excerpt of /etc/config/dhcp

config dhcp 'lan'
	option interface 'lan'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	option ra_mininterval '30'
	option ra_maxinterval '100'
	option ra_useleasetime '1'

Maybe this is helpful to someone having the same problem.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.