[Solved] OpenWrt dnsmasq ignores configuration

The last lines in the file /etc/config/dhcp are these:

config host
       option dns '1'
       option mac 'fc:22:f4:76:bb:03'
       option ip '172.16.1.1'

However, the dnsmasq server ignores those lines and assigns another address 192.168.2.200 to the client. After reboot:
From logread:
Tue Dec 17 07:45:19 2024 daemon.info dnsmasq-dhcp[1]: DHCPOFFER(br-lan) 192.168.2.200 fc:22:f4:76:bb:03

From tcpdump:

07:45:19.230300 IP (tos 0xc0, ttl 64, id 58910, offset 0, flags [none], proto UDP (17), length 328)
    Y.lan.67 > 192.168.2.200.68: BOOTP/DHCP, Reply, length 300, xid 0x40254f7b, Flags [none]
	  Your-IP 192.168.2.200
	  Server-IP Y.lan
	  Client-Ethernet-Address fc:22:f4:76:bb:03 (oui Unknown)

etc

It ignores the address 172.16.1.1 in the config file.
The address may seem suspect, but I'd like to experiment. Perhaps
it isn't possible to use that address (an unused, reserved IP-address).
The other machines, connected to the Ethernet port, have 192.168.2.* addresses. The OpenWrt router has the address 192.168.2.1 on that
Ethernet port.

The reason for experimenting is that I assume that the particular machine (a
Zyxel router) does not like to be assigned 192.168.2.200 on its WAN port.

Is is possible to use 172.16.1.1 in the DHCP configuration?
Am I misunderstanding this? (Probably.)

Do you have a 172.16.1.0/24 network setup on the router?

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
root@Y:~# ubus call system board
{
	"kernel": "5.15.137",
	"hostname": "Y",
	"system": "ARMv8 Processor rev 3",
	"model": "Raspberry Pi 4 Model B Rev 1.5",
	"board_name": "raspberrypi,4-model-b",
	"rootfs_type": "ext4",
	"release": {
		"distribution": "OpenWrt",
		"version": "23.05.2",
		"revision": "r23630-842932a63d",
		"target": "bcm27xx/bcm2711",
		"description": "OpenWrt 23.05.2 r23630-842932a63d"
	}
}
root@Y:~# 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 'xxx'

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

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

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

config route 'route1'
        option interface 'lan'
        option target '192.168.3.0'
        option netmask '255.255.255.0'
        option gateway '192.168.2.222'

config route 'route2'
        option interface 'lan'
        option target '172.16.0.0'
        option netmask '255.255.0.0'
        option gateway '172.16.1.1'

root@Y:~# 
root@Y:~# 
root@Y:~# 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'
	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 dns '1'
       option mac 'xxx'
       option ip '192.168.2.222'

config host
       option dns '1'
       option mac 'xxx'
       option ip '192.168.2.130'

config host
       option dns '1'
       option mac 'xxx'
       option ip '192.168.2.127'

config host
       option dns '1'
       option mac 'xxx'
       option ip '172.16.1.1'

Where does this network exist? I don't see any 172.16.0.0/16 networks attached to this router.

But more importantly, dnsmasq will not issue an IP address that is in a network for which there is no DHCP server, and it also cannot have a DHCP server unless there is an appropriate network interface.

Thank you!
There is no 172.16.0.0/16 network, since I'm messing up things...
I think things are getting clearer because of your answer!

you're welcome.

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.
Thanks! :slight_smile:

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