DHCP static leases occasionally not working

Hi all,
i recently modified my ZTE MF286D LTE CAT12 modem to install OpenWRT for just 1 basic function for my domotics: having more than 10 DHCP static leases.

I eventually managed to configure all my needed leases (about 60 IPs) but i noticed that some devices at their reboot occasionally use old leases despite static one configured.
an example below:
broadlinkIR device with configured IP 192.168.199.20

DHCP static lease is configured and worked good.

today device was rebooted due to power failure and it got different IP not shown on "active leases" section.

instead if I try to creatae new static lease i find it

it got the .119 on same subnet! of course i could create a new static lease for .119 but this would require me to modify involved configuration (read: Home Assistant etc..)

this is just an example.
very same issue is occurring with 2 additional RTSP cameras which at each reboot change their IP between old lease and static ones and thus requiring me to update HA configuration each time. Very annoying.

it this a bug or a feature? :rofl:

my device information:
|Modello|ZTE MF286D|
|Architettura|ARMv7 Processor rev 5 (v7l)|
|Piattaforma di destinazione|ipq40xx/generic|
|Versione del firmware|OpenWrt 23.05.0 r23497-6637af95aa / LuCI openwrt-23.05 branch git-23.306.39416-c86c256|
|Versione del kernel|5.15.134|

thank you in advance for any useful input :slight_smile:

Not a solution, use host names instead of IPs ?

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/wireless
cat /etc/config/dhcp
cat /etc/config/firewall
root@OpenWrt:~# ubus call system board
{
        "kernel": "5.15.134",
        "hostname": "OpenWrt",
        "system": "ARMv7 Processor rev 5 (v7l)",
        "model": "ZTE MF286D",
        "board_name": "zte,mf286d",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "23.05.0",
                "revision": "r23497-6637af95aa",
                "target": "ipq40xx/generic",
                "description": "OpenWrt 23.05.0 r23497-6637af95aa"
        }
}
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 'fdbb:**:**'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'
        list ports 'wan'

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

config interface 'wan'
        option device '/dev/cdc-wdm0'
        option proto 'qmi'
        option auth 'none'
        option apn 'web.omnitel.it'
        option dhcp '0'

config device
        option name 'wan'
        option macaddr 'D4:72:26:**:**:**'

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

config wifi-device 'radio0'
        option type 'mac80211'
        option path 'platform/soc/a000000.wifi'
        option channel '1'
        option band '2g'
        option htmode 'HT20'
        option cell_density '0'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'seaaren2'
        option encryption 'sae-mixed'
        option key '**'

config wifi-device 'radio1'
        option type 'mac80211'
        option path 'platform/soc/a800000.wifi'
        option channel '36'
        option band '5g'
        option htmode 'VHT80'
        option cell_density '0'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 'seaaren2'
        option encryption 'sae-mixed'
        option key '**'

config wifi-iface 'wifinet2'
        option device 'radio0'
        option mode 'ap'
        option ssid 'seaaren-domo'
        option encryption 'psk-mixed'
        option key '**'
        option network 'lan'

root@OpenWrt:~# 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 resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option localservice '1'
        option ednspacket_max '1232'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        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 'broadlinkIR'
        option dns '1'
        option mac 'ec:0b:ae:**:**:**'
        option ip '192.168.199.20'


# REDACTED #
#... other hosts ...#
#config host ...#

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

config defaults
        option syn_flood '1'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        list network 'lan'

config zone
        option name 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        list network 'wan'

config forwarding
        option src 'lan'
        option dest 'wan'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-IGMP'
        option src 'wan'
        option proto 'igmp'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-MLD'
        option src 'wan'
        option proto 'icmp'
        option src_ip 'fe80::/10'
        list icmp_type '130/0'
        list icmp_type '131/0'
        list icmp_type '132/0'
        list icmp_type '143/0'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        list icmp_type 'router-advertisement'
        list icmp_type 'neighbour-advertisement'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-IPSec-ESP'
        option src 'wan'
        option dest 'lan'
        option proto 'esp'
        option target 'ACCEPT'

config rule
        option name 'Allow-ISAKMP'
        option src 'wan'
        option dest 'lan'
        option dest_port '500'
        option proto 'udp'
        option target 'ACCEPT'

root@OpenWrt:~#

yes a good workaround if all devices have same local DNS and GW but i would like to solve issue

Is the problem happening with wired, wireless, or both types of devices?

both.

the device shown is wireless but i also have a LAN IP camera which has very same issue.

at first i was thinking that issue was devices-side because with original firmware they were sticking to static lease as expected.

seems these devices have a pool of "valid" IP addresses and randomly choose one among them at each boot. whenever they get not expected IP, they always have the same one.

for example, broadlink takes .119 instead of .20 and LAN camera takes .103 instead of .34.
probably, these IPs were valid with old firmware.
Broadlink was also reset to factory settings so theoretically should not have any remember of old lease.

Is it at all possible you have another DHCP server on the network? Or that these IPs are actually the 'fallback' IP addresses that are used if a DHCP server doesn't respond?

3 Likes

Enable logging on the DHCP server, reboot the devices, and see what messages you get when it gets a new address or and old one.

plus, tcpdump the DHCP traffic.

hi all,
i think topic can be closed

the only 2 devices acting badly were reset and paired again to wifi network and since then they only get the correct IP.

I think something related to some odd firmware behavior (eg. having a "pool of valid" IP addresses and picking one among them despite DHCP server proposal)

thank you for support

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.