Dhcp static leases

hello community,how are you? i hope well,i`m having trouble with dhcp server on my tp-link archer c7, i uses static leases for certain servers and some other devices. for example i configure a static ip for my smart tv on 192.168.0.175....when i connect that device the dhcp gives 192.168.0.110 it does not respect the static lease i configured. the same happens to other devices like dns servers like unbound. any idea how to fix this? thanks a lot!

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
2 Likes

okey THANKS`

"kernel": "5.15.162",
	"hostname": "OpenWrt",
	"system": "Qualcomm Atheros QCA956X ver 1 rev 0",
	"model": "TP-Link Archer C7 v4",
	"board_name": "tplink,archer-c7-v4",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "23.05.4",
		"revision": "r24012-d8dd03c46f",
		"target": "ath79/generic",
		"description": "OpenWrt 23.05.4 r24012-d8dd03c46f"`

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 'fd8a:8bb7:ca04::/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 ip6assign '60'
	list ipaddr '192.168.0.1/24'
	list dns '192.168.0.176'
	list dns '192.168.0.193'
	option defaultroute '0'

config device
	option name 'eth0.2'
	option macaddr 'ac:84:c6:53:d7:12'

config interface 'wan'
	option device 'eth0.2'
	option proto 'dhcp'
	option peerdns '0'
	list dns '1.1.1.1'
	list dns '1.0.0.1'
	option type 'bridge'

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'

config interface 'WG_server'
	option proto 'wireguard'
	option private_key 'REDACTED'
	option listen_port '51820'
	list addresses '10.8.0.6/24'
	option defaultroute '0'
	list dns '1.1.1.1'

config wireguard_WG_server
	option description 'xiaomi'
	option public_key 'REDATED
	option private_key 'REDACTED'
	option preshared_key 'REDACTED'
	list allowed_ips '10.8.0.3/32'
	option route_allowed_ips '1'
	option endpoint_host 'nickvandub1.duckdns.org'
	option endpoint_port '51820'
	option persistent_keepalive '25'

config wireguard_WG_server
	option description 'macbook_pro'
	option public_key 'REDACTED'
	option private_key 'REDACTED'
	option preshared_key 'REDACTED'
	list allowed_ips '10.8.0.4/32'
	option route_allowed_ips '1'
	option endpoint_host 'REDACTED'
	option endpoint_port '51820'
	option persistent_keepalive '25'

cat /etc/config/dhcp

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

config host
	option name 'router'
	list mac 'REDACTED'
	option ip '192.168.0.1'
	option leasetime 'infinite'
	list match_tag 'known'

config host
	option name 'truenas-scale'
	option ip '192.168.0.135'
	list tag 'scale'
	option leasetime 'infinite'
	list mac 'REDACTED'

config host
	option name 'Qnap-nas'
	list mac 'REDACTED'
	option ip '192.168.0.117'
	option leasetime 'infinite'

config host
	option name 'raspberry'
	list mac 'REDACTED'
	option ip '192.168.0.193'
	option leasetime 'infinite'

config host
	option name 'Adguard-2'
	list mac 'REDACTED'
	option ip '192.168.0.176'
	option leasetime 'infinite'

config host
	option ip '192.168.0.175'
	option leasetime 'infinite'
	list tag 'smart-tv'
	option name 'smart-tv'
	list match_tag 'known'
	list mac 'REDACTED'

config host
	option ip '192.168.0.219'
	option name 'smart-tv-wifi'
	option leasetime 'infinite'
	list match_tag 'known'
	list mac 'REDACTED'

config host
	option ip '192.168.0.111'
	option leasetime 'infinite'
	option name 'Macbook-pro'
	list mac 'REDACTED'

config host
	option name 'Switch'
	list mac 'REDACTED'
	option ip '192.168.0.127'
	option leasetime 'infinite'

config host
	option name 'TLWA1201'
	list mac 'REDACTED'
	option ip '192.168.0.148'
	option leasetime 'infinite'

config host
	option name 'NC200'
	option ip '192.168.0.128'
	list mac 'REDACTED'
	option leasetime 'infinite'

config host
	option name 'pi-hole'
	list mac 'REDACTED
	option ip '192.168.0.177'
	option leasetime 'infinite'

config host
	option name 'xiaomi'
	option ip '192.168.0.113'
	option leasetime 'infinite'
	list mac 'REDACTED'

config host
	option name 'belu'
	list mac 'REDACTED'
	option ip '192.168.0.195'
	option leasetime 'infinite'

config host
	option name 'MBP-de-Ivan'
	option ip 'REDACTED'
	list mac 'D0:A6:37:E5:96:50'
	option leasetime 'infinite'
	list match_tag 'known'

config domain
	option name 'Smart-tv-lan'
	option ip '192.168.0.175'

config domain
	option name 'Smart-tv-wifi'
	option ip '192.168.0.218'

Remove the two lines related to the tags and also the lease time.

Then restart both the router and the tv to force it to request a new lease.

i tried to do what you told me, using vi command but it does not allow me to save de file. i can edit, but not save it.

That is strange. Is it giving you an error?

1 Like

Did you used/tried :wq ?

1 Like

yes i could save it,it saves the file,indeed i have restarted dnsmasq....but keep giving any ip to that host except the one i have configured.

Is that the complete dhcp file? There is a whole lot of stuff missing, including the dhcp server config stanza. Are you certain that this is the active dhcp server??

1 Like

i guess that is complete, i ran commands as they were requested,and that was the output.

Something is wrong, then. The file is missing a lot of stuff.

Make a backup and then reset to defaults. You can then manually copy the network config file to your router and copy/paste the static leases at the bottom of the dhcp file.

1 Like

okey thanks a lot!

1 Like

I forgot to mention you can also manually copy over the wireless config file, too.

1 Like

i did that, now works fine. thanks a lot!.

1 Like

Great! Glad to hear it.

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:

1 Like

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