Trouble adding static hosts [SOLVED]

I'm having issues attempting to add static host ips to openwrt 24.10. /etc/config/dhcp follows:

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 mac '14:98:77:77:C5:5A'
    option ip '192.168.1.10'
    option name 'm1'

config host
    option mac 'D8:BB:C1:F7:AC:C7'
    option ip '192.168.1.11'
    option name 'i7'

These host additions I appended to stock dhcp aren't respected, dnsmasq ignores them and assigns addresses from its range when the hosts connect. I'm on 24.10, but it's been a very long time since I've used openwrt. My end-goal is to have my static local addresses resolvable so I can ssh i7 or ssh i7.lan, etc.

change the configuration file (you should solve)
and relaunching "service dnsmasq reload" or restarting the router
and restart the PC so that they get a new IP address other than the one stored at this moment

config host
    option mac '14:98:77:77:C5:5A'
    option ip '192.168.1.10'
    option name 'm1'
    option dns '1'

config host
    option mac 'D8:BB:C1:F7:AC:C7'
    option ip '192.168.1.11'
    option name 'i7'
    option dns '1'

or through the graphic interface "luci":

immagine

documentation:

Not working for me.

config host
    option mac '14:98:77:77:C5:5A'
    option ip '192.168.1.10'
    option name 'm1'
    option dns '1'

config host
    option mac 'D8:BB:C1:F7:AC:C7'
    option ip '192.168.1.11'
    option name 'i7'
    option dns '1'

I made the dhcp changes, adding the dns option to the hosts, saved the file and relaunched dnsmasq. I rebooted machine i7 and it grabbed an ip from the dhcp pool, not the static ip I wanted.
A router reboot didn't change anything.

What operating system does this machine use?

i7 is a windows 11 laptop.

you can try the following commands on this machine and check what ip address it gets

ipconfig /release
ipconfig /renew

from:
https://www.reddit.com/r/commandline/comments/8ulork/what_does_ipconfig_release_ipconfig_renew_do/

Yes depending on the host os, it can happen that the lease is cached and if it is still valid the host tries to renew the lease but don't request a new one.

1 Like

ipconfig /release
ipconfig /renew

It still pulls an address from the pool. Similar issue with a Mac m1. I deleted the ethernet device, recreated it with setting dhcp and it was assigned an address from the pool, not the static ip.

I don't see any problems in the /etc/config/dhcp file
just to understand can you also post your /etc/config/network

You can check if there are errors on your configuration files with the following command (on your router):

for x in /etc/config/*; do uci show "${x##*/}" >/dev/null || echo "$x is broken"; done

If the problem persists I suggest this:

  1. then let's try to enable verbose logs (to understand the underlying problem)

from:

to:

  1. delete the current /tmp/dhcp.lease (on router):
rm /tmp/dhcp.lease
  1. restart the service (on router):
/etc/init.d/dnsmasq restart
  1. and relaunch the commands on the windows pc
ipconfig /release
ipconfig /renew
  1. then attach the logs (see you next post):
logread
rm /tmp/dhcp.leases
ipconfig /release
ipconfig /renew

did the above. and log's at the link. I am seeing my leases now, (DHCP and DNS/static leases), but they still appear to be ignored.

This could be the reason.
Fri Apr 4 21:22:16 2025 user.notice dnsmasq: found already running DHCP-server on interface 'br-lan' refusing to start, use 'option force 1' to override

2 Likes

Just for chuckles I nuked ipv6 & odhcp. It made no difference.

The error @trendy was pointing out is that the DHCP server on OpenWrt did not start because there is another one running on the network somewhere. That is to say, another device has an active DHCP server. You need to find that DHCP server and disable it.

3 Likes

Fixed! DHCP was running on a tp-link access point. Stopped it and all was well. Thanks to everyone who took the time to reply.

2 Likes

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.