I'm trying to understand some behavior i'm seeing.
My PC (W11) is connected to my router (MT6000 running snapshot) via ethernet (trough 2 switches). The router has a normal DHCP pool configured (192.168.1.100-250).
Yesterday my PC (as DHCP client) had address 108. I rebooted (flashed latest snapshot) the router yesterday at around 11:00. After the reboot my PC still had address 108 (and a new 12h lease). I shut down my PC at around 22:00.
This morning (around 11:00) I started my PC and it had address 109. Why did it change?
My PC is not named in a DNS record, has a fixed MAC nor has it a static address. So i would expect "pure DHCP" behavior (PC asks router for its old address and gets it).
This is not a single occurrence. This happens almost always after a reboot of the router. The next day (lease expiration?) my PC gets an address of 108, 109 or 111 and then cycles back to 108. All 3 addresses are not/never occupied by any other client. So why the change?
The weird thing is that some other clients also show this behavior, like my printer, but the most of them just keep their old address (as expected). Why not my PC?
Your wording is a bit unclear here, but I take it to mean that your PC does not have the same MAC address every time it connects/starts up.
Generally, dnsmasq hands out an IP calculated/hashed from the device's MAC address. The same MAC will receive the same IP (if unoccupied). If the MAC address changes, the IP that is given out changes.
If the old lease has not expired (on the router's database, the default lease time is 12 hours), the PC will be denied the same IP even if it asks for it. As far as the router knows it is still potentially occupied by the device with the old MAC.
Sorry for that. I mean the exact opposite, the MAC address is constant. It does not change over reboots of the PC or router..
That's why the behavior seems strange to me. Also, only a few clients show this behavior. My PC being the most obvious. Most clients hold their old address.
But why gets the majority of clients the same address even after a reboot of the device/router? Only a handful of devices/my PC are assigned a different address even when the original address is free.
I found 2 more devices that show this behavior; my printer (Canon MF650; flips between 127 and 129) and an EV-charger (flips between 145 and 146). All 4 addresses are not used by another device.
That's indeed curious. What does /tmp/dhcp.leases say? Take a few samples and compare when IP addresses change, maybe that will give you (and us) a hint.
Let's also take a look at your config to make sure there isn't anything funny in there:
Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have:
ubus call system board
cat /etc/config/network
cat /etc/config/dhcp