oDHCPd static lease issue

odhcpd has no concept of tags or per-host dhcp options. dnsmasq does, however.

1 Like

I know the Unbound README points to /var/lib, I had Unbound's settings point that way too. There was nothing there though, for me. Using Unbound and odhcpd as well, and have been using it for a while.

Anyway - was just pointing out that it is a valid path, when it comes to odhcpd itself.

You may also want to be aware of this new gotcha with odhcpd:

Yeah, I tried option and list, neither have worked.

I see. When trying to switch to DNSMasq as my DHCP then, I am not getting any DNS. Here is my config now:

/etc/config/dhcp:

config dhcp 'lan'
        option interface 'lan'
        option start '2'
        option limit '253'
        option leasetime '24h'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config dnsmasq 'DHCP'
        option rebind_protection '0'
        option localservice '0'
        list server '127.0.0.1#53'
        list interface 'lan'
        list notinterface 'wan'
        option readethers '1'
        option noresolv '1'
        option dnsseccheckunsigned '0'
        option authoritative '1'

config host
        option name 'PC'
        list mac 'x:x:x:x:x:x'
        option ip '10.0.0.2'
        option leasetime 'infinite'
        list tag 'tag1'

config tag 'tag1'
        option dhcp_option '6,x.x.x.x'

/etc/config/unbound:

config unbound 'ub_main'
        option dhcp_link 'dnsmasq'
        option dns64 '0'
        option domain 'lan'
        option edns_size '1232'
        option extended_stats '0'
        option hide_binddata '1'
        option interface_auto '1'
        option listen_port '53'
        option localservice '1'
        option manual_conf '0'
        option num_threads '2'
        option protocol 'default'
        option rate_limit '0'
        option rebind_localhost '1'
        option rebind_protection '1'
        option recursion 'default'
        option resource 'default'
        option root_age '9'
        option ttl_min '120'
        option ttl_neg_max '1000'
        option unbound_control '2'
        option validator '1'
        option validator_ntp '1'
        option verbosity '1'
        list iface_wan 'wan'
        option enabled '1'
        option iface_lan 'lan'
        list iface_trig 'lan'
        list iface_trig 'wan'

config zone '???'
        option enabled '1'
        option fallback '0'
        option tls_index '???'
        option tls_upstream '1'
        option zone_type 'forward_zone'
        list zone_name '.'
        list server '???'
        option dns_assist 'none'

I am positive that it is something to do with my DNSMasq configuration, but I'm unsure of what.

Not really all taht surprising -- you've significantly altered the /etc/config/dhcp file.

The dnsmasq section that is responsible for dns is this by default:

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'

Interesting. Well, changing that to its default settings has the same result.

Does it have anything to do with this? For https-proxy I had to set DNSMasq to this (albeit port 5053). What should I modify to make Unbound work?

list server '127.0.0.1#53'

What that line does is it relies on a different DNS resolver service running on localhost. So... remove it and see if it fixes things.

Unfortunately, still does nothing once I remove it.

What do the logs say when you restart dnsmasq?

It might be worth considering just starting over from scratch -- it's possible there are deeper issues.

daemon.info dnsmasq[1]: started, version 2.90 cachesize 1000
daemon.info dnsmasq[1]: DNS service limited to local subnets
daemon.info dnsmasq[1]: compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-nftset no-auth no-cryptohash no-DNSSEC no-ID loop-detect inotify dumpfile
daemon.info dnsmasq[1]: UBus support enabled: connected to system bus
daemon.info dnsmasq-dhcp[1]: DHCP, IP range 10.0.0.2 -- 10.0.0.254, lease time 1d
daemon.warn dnsmasq[1]: ignoring nameserver 127.0.0.1 - local interface
daemon.info dnsmasq[1]: using only locally-known addresses for test
daemon.info dnsmasq[1]: using only locally-known addresses for onion
daemon.info dnsmasq[1]: using only locally-known addresses for localhost
daemon.info dnsmasq[1]: using only locally-known addresses for local
daemon.info dnsmasq[1]: using only locally-known addresses for invalid
daemon.info dnsmasq[1]: using only locally-known addresses for bind
daemon.info dnsmasq[1]: using only locally-known addresses for lan
daemon.info dnsmasq[1]: read /etc/hosts - 12 names
daemon.info dnsmasq[1]: read /tmp/hosts/dhcp.DHCP - 2 names
daemon.info dnsmasq-dhcp[1]: read /etc/ethers - 0 addresses

If I remove 127.0.0.1#1053, it says "no upstream servers configured". If I add it, it says it is ignoring it? But it is required to point DNSMasq to Unbound:

https://github.com/openwrt/packages/blob/master/net/unbound/files/README.md#unbound-and-odhcpd

looks like you have some DoH/DoT/Stubby type things happening there.

The fastest fix is to reset to defaults.

Unbound is set to do DoT, correct, which is what I am wanting. I'll reset my entire system then try and see if it works.

Unbound is working though, because I am able to find addresses from my router, but nothing is being assigned to my devices. So it's a DNSMasq issue.

Back to square one: DNSMasq, just like oDHCPd, when the entire OS is reset to default, is now no longer assigning static leases even though I have a static lease for my device set. No amount of restarting both devices or releasing changes it, it continues to give it "192.168.1.90" even though I have it set static as "192.168.1.2".

Unsure why.

Let’s see the complete config

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

/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 'fdc9:f8b9:aaff::/48'

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

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        list dns '192.168.1.1'
        option delegate '0'

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

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

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

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

/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 localservice '1'
        option ednspacket_max '1232'
        list server '127.0.0.1#1053'
        option noresolv '1'

config dhcp 'lan'
        option interface 'lan'
        option start '2'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'

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 'PC'
        option ip '192.168.1.2'
        option leasetime 'infinite'
        list mac '???'

/etc/config/unbound:

config unbound 'ub_main'
        option dhcp_link 'dnsmasq'
        option dns64 '0'
        option domain 'lan'
        option edns_size '1232'
        option extended_stats '0'
        option hide_binddata '1'
        option interface_auto '1'
        option listen_port '53'
        option localservice '1'
        option manual_conf '0'
        option num_threads '2'
        option protocol 'default'
        option rate_limit '0'
        option rebind_localhost '1'
        option rebind_protection '1'
        option recursion 'default'
        option resource 'default'
        option root_age '9'
        option ttl_min '120'
        option ttl_neg_max '1000'
        option unbound_control '0'
        option validator '1'
        option validator_ntp '1'
        option verbosity '1'
        list iface_wan 'wan'
        option enabled '1'
        option iface_lan 'lan'
        list iface_trig 'lan'
        list iface_trig 'wan'

config zone '???'
        option enabled '1'
        option fallback '0'
        option tls_index '???'
        option tls_upstream '1'
        option zone_type 'forward_zone'
        list zone_name '.'
        option dns_assist 'none'
        list server 'x.x.x.x'

Irony. Static IP address is being assigned now. But now no DNS is being served to the system. When I uninstall Unbound, DNS resumes normal operation. When I reinstall Unbound and use the config specified, it refuses to resolve anything.

This is quite a headache. Some settings for both /etc/config/dhcp and /etc/config/unbound are incorrect and that is causing the issue.