Unbound+odhcpd - static DNS server IP to guest interface

I use unbound + odhcpd (don't wanna use Dnsmasq) and want to serve 8.8.8.8 as DNS server via DHCP to clients on interface "guest" and keep serving my router IP address via DHPC as DNS server to the others interfaces.

This is easy with Dnsmasq but seems impossible using unbound.

Any help is appreciated. Thanks!

What is your /etc/config/dhcp content?

1 Like
config dhcp 'lan'
        option interface 'lan'
        option start '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option force '1'
        option limit '45'
        option ra_management '1'
        option ra 'hybrid'
        list ra_flags 'none'
        option dhcpv6 'hybrid'
        option ndp 'hybrid'

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

config dhcp 'guest'
        option interface 'guest'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option start '50'
        option force '1'
        list dhcp_option '6,8.8.8.8,1.1.1.1'

config odhcpd 'odhcpd'
        option maindhcp '1'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/lib/unbound/odhcpd.sh'
        option loglevel '4'

config dhcp 'wan6'
        option interface 'wan6'
        option ignore '1'
        option ra 'relay'
        list ra_flags 'none'
        option dhcpv6 'relay'

config dhcp 'Camera'
        option interface 'Camera'
        option dhcpv4 'server'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option force '1'

Try to replace this with:

list dns '8.8.8.8'
list dns '1.1.1.1'
1 Like

Solved, thanks a lot! The only downside is that on the others interfaces it advertise 8.8.8.8 as dns1 and the openwrt server ip as dns2. I rather advertise 8.8.8.8 only on guest interface

That’s only happening after making this change? What if you add the router IP manually with the same list dns option on the other interfaces? Does it “fix” it? It’d only be a workaround, but need to understand how it behaves.

There was some temporary bug. After rebooting my device and the router everything works perfectly. Thanks a lot

1 Like

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