Odhcpd: loglevel and leasetime

After renumbering the DHCP leases on the local networks, I am observing a couple of oddities:

  1. some hosts are still using their previous IPV6 addresses, even after restarting them, restarting the server and clearing the lease files
  2. "Active DHCPv6 Leases" shows a "Leasetime remaining" of 19h or so for one of them and "unlimited" for the others: what gives? I can't see anything in the output of "ubus call dhcp ipv6leases" which would explain this difference.

I thought of increasing the loglevel but then I was slightly taken aback because this keyword is not mentioned in the documentation though I could find it in the source. Also, setting the loglevel to 4, 6 or just leaving it out seems to have no impact on logs (with restarts and reconnections as required).

Any pointers? I sort of expected that the leasetimes for IPV6 would be the same as for IPV4, given they're configured per lease or globally in /etc/config/dhcp

With restarting the server, do you mean restarting dnsmasq + odhcpd?
By default, dnsmasq handles IPv4 leases and odhcpd handles IPv6 leases.

I noticed this too a while ago. But the lease time is now correctly displayed. (on snapshot build)
There was commit to odhcpd to avoid giving out leases with unlimited lease time.
Maybe it is related to it, I don't know...

Did you try a loglevel setting of 7?

They are the same, works fine here on my system.
I set a global lease time of 12h and some devices have individual lease times (1h, 7d) and all properly show up in the overview page (IPv4 + IPv6).
However...
They are two different lease times for IPv6 leases.
The lease time you configure in /etc/config/dhcp is used for the ULA addresses.
And then there is the lease time for GULA addresses, this lease time is taken from the upstream router. At least I think that is the case... :smile: I mean, it would make sense...

If you want to overwrite this lease time you can use:
option ra_useleasetime '1'

Use configured leasetime as limit for the preferred and valid lifetime of a prefix

in the global dhcp config section...

But I have one problem... my Win10 machine doesn't properly renew its IPv6 lease.
Manual renew (ipconfig /renew6) works fine everytime.
I'm not sure if this a odhcpd bug or a win10 bug ...

1 Like

Yes, /etc/init.d/dnsmasq restart

Ah, interesting, looks like a UI bug since ubus looks fine.

Tried it now, restarted, disconnected and reconnected the laptop: nothing about IPV6 in the logs.

How do I find out the upstream leasetime without changing it? Also, I am using a static /48 from he.net so the two /64 on my networks (home and guest) do not change.

Rereading your notes after checking once more the active lease list, it looks like it could be just a UI glitch: the laptop on guest wlan has indeed a short leasetime as configured, while the hosts on the home lan have a full day.
EDIT: of course, the issue with a few hosts who keep using the older address is still open, that's why I hoped for the logs. I'll try wireshark if the issue doesn't go away in a couple of days.

Also restart odhcpd with:
/etc/init.d/odhcpd restart

You can try:
ifstatus interface
For example:
ifstatus wan6

Then look for something like this:

 "ipv6-prefix": [
                {
                        "address": "2a02::BLANKED",
                        "mask": 59,
                        "preferred": 599345,
                        "valid": 1204145,
                        "class": "wan6",
                        "assigned": {
                                "lan": {
                                        "address": "2a02::BLANKED",
                                        "mask": 64
                                }
                        }
                }
        ],

valid and preferred should be the upstream lease time in seconds. (actually it is valid, I think :smile:)

1 Like

My bad: I completely forgot about it, since both daemons are configured from the same file. Thanks for catching that, now it works as expected wrt logs.

I don't have them at all, plus I see this:
"dynamic": false

Good, now I just have to find out how to convince the clients to forget about the previous assignment, I guess.

Sorry, I missed this. When using 6in4 everything is configured as "static".
I think there is no lease time involved here? But I'm not sure...
Well, that would explain the unlimited lease times you see?
odhcpd got several commits:
https://git.openwrt.org/?p=project/odhcpd.git;a=commit;h=6db312a698e920ff61505ef1f42469880829774d

https://git.openwrt.org/?p=project/odhcpd.git;a=commit;h=a90cc2e147b0f6e429c4e5e3e4e42e00b01ec32c

https://git.openwrt.org/?p=project/odhcpd.git;a=commit;h=f61964c66be050716089d31f13688c1ab382f0b7

I also have "dynamic": false in my output.

What is the ifstatus output of the he.net tunnel interface?

This looks like my "problem". Thanks.

"dynamic:false" came from the tunnel interface.