PC gets new DHCP address

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.

Once the PC releases or fails to renew the lease, the DHCP server has no obligation to reserve (or even to try to reserve) the assignment.

If another device makes a request for that same address, for example, the server is free to reassign It.

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.

I rebooted the router and took a few snapshots before and after. Will report back when the first lease has expired.

Why not just assign it as as static IP? That's what I always do to my fixed/wired devices especially my PC. Network -> DHCP -> Static Leases.

1 Like

I'm aware of static leases and use it for some of my devices.
Just trying to understand why DHCP behaves like it does.

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:
grafik
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

OK, I found a device that got a new ip address after a router reboot.

This morning the router got rebooted. Just before reboot the dhcp.leases file looked like this:


Notice the device " Gateway02D533" as it has an IP address of 132.

Just after restart dhcp.leases looked like this:


The device got an adjacent address for some reason. The original address (132) seems to be free.

The log (BTW i love the new log-filter functions) shows this:

Wed Apr 23 11:16:44 2025 daemon.info dnsmasq-dhcp[1]: DHCPDISCOVER(br-lan) xx:xx:xx:02:d5:33
Wed Apr 23 11:16:44 2025 daemon.info dnsmasq-dhcp[1]: DHCPOFFER(br-lan) 192.168.1.133 xx:xx:xx:02:d5:33
Wed Apr 23 11:16:44 2025 daemon.info dnsmasq-dhcp[1]: DHCPDISCOVER(br-lan) xx:xx:xx:02:d5:33
Wed Apr 23 11:16:44 2025 daemon.info dnsmasq-dhcp[1]: DHCPOFFER(br-lan) 192.168.1.133 xx:xx:xx:02:d5:33
Wed Apr 23 11:16:45 2025 daemon.info dnsmasq-dhcp[1]: DHCPREQUEST(br-lan) 192.168.1.133 xx:xx:xx:02:d5:33
Wed Apr 23 11:16:45 2025 daemon.info dnsmasq-dhcp[1]: DHCPACK(br-lan) 192.168.1.133 xx:xx:xx:02:d5:33 Gateway02D533

Here you go (I redacted some addresses and names).

root@MT6000_Router:~# ubus call system board
{
        "kernel": "6.6.87",
        "hostname": "MT6000_Router",
        "system": "ARMv8 Processor rev 4",
        "model": "GL.iNet GL-MT6000",
        "board_name": "glinet,gl-mt6000",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "firmware_url": "https://downloads.openwrt.org/",
                "revision": "r29297-f65c44f67f",
                "target": "mediatek/filogic",
                "description": "OpenWrt SNAPSHOT r29297-f65c44f67f",
                "builddate": "1745325902"
        }
}
root@MT6000_Router:~# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd5e:48ff:941c::/48'
        option packet_steering '1'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'
        list ports 'lan5'

config device
        option name 'lan1'
        option macaddr '94:83:xx:xx:xx:xx'

config device
        option name 'lan2'
        option macaddr '94:83:xx:xx:xx:xx'

config device
        option name 'lan3'
        option macaddr '94:83:xx:xx:xx:xx'

config device
        option name 'lan4'
        option macaddr '94:83:xx:xx:xx:xx'

config device
        option name 'lan5'
        option macaddr '94:83:xx:xx:xx:xx

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config device
        option name 'eth1'
        option macaddr '94:83:xx:xx:xx:xx'

config interface 'wan'
        option device 'eth1'
        option proto 'dhcp'

config interface 'wan6'
        option device 'eth1'
        option proto 'dhcpv6'

root@MT6000_Router:~# cat /etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option cachesize '1000'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option localservice '1'
        option ednspacket_max '1232'
        list server '/mask.icloud.com/'
        list server '/mask-h2.icloud.com/'
        list server '/use-application-dns.net/'
        list server '127.0.0.1#5053'
        list server '127.0.0.1#5054'
        option doh_backup_noresolv '-1'
        option noresolv '1'
        list doh_backup_server '/mask.icloud.com/'
        list doh_backup_server '/mask-h2.icloud.com/'
        list doh_backup_server '/use-application-dns.net/'
        list doh_backup_server '127.0.0.1#5053'
        list doh_backup_server '127.0.0.1#5054'
        list doh_server '127.0.0.1#5053'
        list doh_server '127.0.0.1#5054'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

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

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

config host
        option name 'MyNAS'
        option dns '1'
        option ip '192.168.1.10'
        option leasetime '24h'
        list mac '00:1E::xx:xx:xx:xx'

config domain
        option name 'cam1'
        option ip '192.168.1.64'

config domain
        option name 'cam2'
        option ip '192.168.1.65'

config domain
        option name 'cam3'
        option ip '192.168.1.66'

config domain
        option name 'device1'
        option ip '192.168.1.101'

config domain
        option name 'device2'
        option ip '192.168.1.105'

config domain
        option name 'device3'
        option ip '192.168.1.130'

config domain
        option name 'device3'
        option ip '192.168.1.145'

config domain
        option name 'device4'
        option ip '192.168.1.151'

config domain
        option name 'device5'
        option ip '192.168.1.177'

config domain
        option name 'device6'
        option ip '192.168.1.206'

config domain
        option name 'device7'
        option ip '192.168.1.207'

Maybe this may be of help. I also made a copy of the routing table of the router.
This one was of last night.


The device "Gateway02D533" has address 132. Another device has 133 (Xbox).

After reboot the routing table looked like this:

The device "Gateway02D533" occupies the addresses 132 and 133.