Infinite leasetime

Noticed that a couple of my hosts have unlimited leasetime for IPV6 addresses, even though they live in a pool which has 24h lease defined, in fact the IPV4 addresses follow that rule just fine.

config dhcp 'casa'
        option interface 'casa'
        option limit '100'
        option leasetime '24h'
        option dhcpv6 'server'
        option ra 'server'
        option ra_management '1'
        option force '1'
        option start '11'
        list dhcp_option 'option:dns-server,0.0.0.0'
[...]
config host 'shanpu'
        option ip 'x.y.z.15'
        option mac 'mac1'
        option duid '0001something'
        option hostid '0015'
        option dns '1'

Another host in a 30min pool correctly shows up with a limited lease. Any pointers?

2 Likes

@vgaetera cool, so if I understand it correctly:

  1. it was a bug and the fixed commit might not be in 19.07.3
  2. you worked around it by forcing a per-host leasetime
    Is that right?

I'm using odhcpd-ipv6only, I haven't changed this part.

1 Like

Perhaps that's a different issue which affects only static leases.
It's hard to confirm without appropriate testing.

On the other hand, you can check whether the lease time is correct by monitoring:

ubus call dhcp ipv6leases

"ubus call dhcp ipv6leases" says:

"preferred-lifetime": -1,
"valid-lifetime": -1

for both hosts currently online with a lease and on all prefixes (ULA and HE.net)

1 Like

This is my build from the master branch, it seems working:

# ubus call dhcp ipv6leases | grep -e lifetime
							"preferred-lifetime": 40964,
							"valid-lifetime": 40964
							"preferred-lifetime": 40964,
							"valid-lifetime": 40964

However, I'm not sure if this will ever be fixed in the current stable branch.

2 Likes

Ok, for the moment it's enough to know about this.
Though the fact that somehow on the guest network the 30min leasetime seems to work is... puzzling.
(edit: this host is now off)

1 Like

I'm using odhcpd for both DHCP v4 and v6, on master, and I'm seeing these values:

# ubus call dhcp ipv6leases|grep lifetime
							"preferred-lifetime": 2644,
							"valid-lifetime": 4444
							"preferred-lifetime": 4444,
							"valid-lifetime": 4444
							"preferred-lifetime": 2644,
							"valid-lifetime": 6244
							"preferred-lifetime": 6244,
							"valid-lifetime": 6244
							"preferred-lifetime": 2644,
							"valid-lifetime": 6244
							"preferred-lifetime": 6244,
							"valid-lifetime": 6244

Configuration:

config dhcp 'lan'
	option interface 'lan'
	option leasetime '12h'
	option start '40'
	option limit '60'
	list dhcp_option '3,10.0.0.1'
	list dhcp_option '6,10.0.0.1'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	option ra_management '1'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'
1 Like
3 Likes

I have tried both
ra_useleasetime '1' (which I had for quite some time)
and
ra_useleasetime 1
restarting odhcpd in between but the ubus call still reports the client as having unlimited lease.

The fact that one host has a 30m lease instead of unlimited is pretty interesting, though, because all three VLANs have the option set.

Did you restart the network of the host?

1 Like

disconnected and reconnected, also later hibernated and thawed, no changes.

Can you try a reboot?

yes, as expected rebooting did nothing more than disconnect / reconnect.
it still is listed as "-1" lifetime.
I guess I'll try again when a newer version comes out, thanks.

I remember it was giving me also a headache to change the assigned dhcp IPv6.
Some combination of:

  1. stop odhcpd
  2. delete /tmp/hosts/odhcpd
  3. shut down host
  4. start odhcpd
  5. start the host
    Did the trick eventually.

An active lease unfortunately takes precedence over a configuration for a static lease there (you don't need to delete the whole file, just the offending lease/ line from it is suffucient).

1 Like

I used this trick too when it was picking up the wrong address but so far the lifetime is stuck at -1.
Maybe I'll try again with a new release, it's pretty pointless to waste time on a minor detail once the correct lease is used.