DHCP Reservation Not Working

I'm new to OpenWRT, but when I moved from my old router to OpenWRT I set up DHCP static leases for my fixed IP devices. These were DHCP reservations on the old router. The problem is that one of my devices no longer will use the IP... it picked a different one. I know I could manually configure TCP/IP on that device, but I would rather figure it out. My other reservations seem fine.

Is the static lease the same thing as a DHCP reservation? All I want is for certain devices to consistently get the same IP from the router.

Any help would be greatly appreciated.

let's take a look at your config to understand what might be happening.

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
1 Like

Here is the dump:
root@OpenWrt:~# ubus call system board
{
"kernel": "5.15.167",
"hostname": "OpenWrt",
"system": "Qualcomm Atheros QCA956X ver 1 rev 0",
"model": "TP-Link Archer C7 v5",
"board_name": "tplink,archer-c7-v5",
"rootfs_type": "squashfs",
"release": {
"distribution": "OpenWrt",
"version": "23.05.5",
"revision": "r24106-10cc5fcd00",
"target": "ath79/generic",
"description": "OpenWrt 23.05.5 r24106-10cc5fcd00"
}
}
root@OpenWrt:~# ^C

root@OpenWrt:~# 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 'fd09:c2d3:7db5::/48'

config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0.1'

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 'eth0.2'
option macaddr '1c:3b:f3:6c:9f:ef'

config interface 'wan'
option device 'eth0.2'
option proto 'dhcp'
option peerdns '0'
list dns '192.168.1.144'

config interface 'wan6'
option device 'eth0.2'
option proto 'dhcpv6'
option reqaddress 'try'
option reqprefix 'auto'
option peerdns '0'
list dns '192.168.1.144'

config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'

config switch_vlan
option device 'switch0'
option vlan '1'
option ports '2 3 4 5 0t'

config switch_vlan
option device 'switch0'
option vlan '2'
option ports '1 0t'

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

config dnsmasq
option domainneeded '1'
option boguspriv '1'
option filterwin2k '0'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
option nonegcache '0'
option cachesize '1000'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
option nonwildcard '1'
option localservice '1'
option ednspacket_max '1232'
option filter_aaaa '0'
option filter_a '0'

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 ip '192.168.1.121'
option leasetime 'infinite'
option name 'P8P67'
list mac 'F4:6D:04:99:AF:3F'

config host
option ip '192.168.1.144'
option leasetime 'infinite'
option name 'pi4'
list mac 'E4:5F:01:67:3A:EB'

config host
option ip '192.168.1.53'
option leasetime 'infinite'
option name 'Grandstream'
list mac 'C0:74:AD:16:4A:57'

config host
option ip '192.168.1.172'
option leasetime 'infinite'
option name 'BEELINKMINIS'
list mac '7C:83:34:B8:FF:24'

config host
option name 'BeelinkMiniS'
option duid '000100012E91EB287C8334B8FF24'
option mac '7C:83:34:B8:FF:24'

root@OpenWrt:~#

root@OpenWrt:~# ubus call system board
{
        "kernel": "5.15.167",
        "hostname": "OpenWrt",
        "system": "Qualcomm Atheros QCA956X ver 1 rev 0",
        "model": "TP-Link Archer C7 v5",
        "board_name": "tplink,archer-c7-v5",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "23.05.5",
                "revision": "r24106-10cc5fcd00",
                "target": "ath79/generic",
                "description": "OpenWrt 23.05.5 r24106-10cc5fcd00"
        }
}
root@OpenWrt:~# ^C

root@OpenWrt:~# 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 'fd09:c2d3:7db5::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0.1'

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 'eth0.2'
        option macaddr '1c:3b:f3:6c:9f:ef'

config interface 'wan'
        option device 'eth0.2'
        option proto 'dhcp'
        option peerdns '0'
        list dns '192.168.1.144'

config interface 'wan6'
        option device 'eth0.2'
        option proto 'dhcpv6'
        option reqaddress 'try'
        option reqprefix 'auto'
        option peerdns '0'
        list dns '192.168.1.144'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '2 3 4 5 0t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '1 0t'

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

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option nonegcache '0'
        option cachesize '1000'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option nonwildcard '1'
        option localservice '1'
        option ednspacket_max '1232'
        option filter_aaaa '0'
        option filter_a '0'

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 ip '192.168.1.121'
        option leasetime 'infinite'
        option name 'P8P67'
        list mac 'F4:6D:04:99:AF:3F'

config host
        option ip '192.168.1.144'
        option leasetime 'infinite'
        option name 'pi4'
        list mac 'E4:5F:01:67:3A:EB'

config host
        option ip '192.168.1.53'
        option leasetime 'infinite'
        option name 'Grandstream'
        list mac 'C0:74:AD:16:4A:57'

config host
        option ip '192.168.1.172'
        option leasetime 'infinite'
        option name 'BEELINKMINIS'
        list mac '7C:83:34:B8:FF:24'

config host
        option name 'BeelinkMiniS'
        option duid '000100012E91EB287C8334B8FF24'
        option mac '7C:83:34:B8:FF:24'

root@OpenWrt:~#

can you spot the difference ?

I'm not sure if you can set an IP address outside of the DHCP range. The valid range is 192.168.1.100 - 192.168.1.249. Does the Grandstream entry work as expected?

1 Like

I always set my static leases outside the DHCP range so that should work.

If you want to also set IPv6 do it like this:

config host
	option dns '1'
	option name 'EA8500'
	option mac 'C0:56:27:XX;XX;XX'
	option ip '192.168.0.6'
	option leasetime '6h'
	option duid '00030001a0562723456f'
	option hostid '06'

and get rid of the double entries for the same MAC address (see frollics post)

1 Like

Yes the Grandstream entry works fine.

1 Like

I don't even know what that second entry with the DUID is... is that something to do with IPV6? I don't use IPV6 at all, so if I delete that will it start working?

wasn't the point I was trying to make, but you should delete all entries you don't want ...

Great, thanks for confirming this! I'm actually surprised that this works, but it's good to know.

2 Likes

I see that the new feature (multiple MACs) seems to be part of the issue, but how do i fix it? what does a "correct" entry look like?