OPNsense Forum

English Forums => 25.7 Series => Topic started by: pftoopn on September 07, 2025, 07:18:25 AM

Title: DNS forwarding to adguard on raspberry pi with dnsmasq DHCP
Post by: pftoopn on September 07, 2025, 07:18:25 AM
Hi All,

I'm planning to move off of pfsense to opnsense. With pfsense, I was using kea DHCP, which allowed me to put the DNS server, adguard on a raspberry pi, in the DHCP server settings. Adguard would then point back to Unbound on pfsense for recursive DNS. This was only for my LAN. My VLANs use Unbound directly, and I want to keep it this way.

Kea DHCP seems to be a real PITA to setup on opnsense. So I'm using dnsmasq for DHCP. It doesn't have the option to point to a DNS server like kea.

How would I get this same setup running under dnsmasq DHCP?
Title: Re: DNS forwarding to adguard on raspberry pi with dnsmasq DHCP
Post by: Monviech (Cedrik) on September 07, 2025, 08:07:35 AM
dnsmasq has the option to point to a DNS server, you can find it in DHCP Options.
Title: Re: DNS forwarding to adguard on raspberry pi with dnsmasq DHCP
Post by: pftoopn on September 07, 2025, 08:31:16 AM
Quote from: Monviech (Cedrik) on September 07, 2025, 08:07:35 AMdnsmasq has the option to point to a DNS server, you can find it in DHCP Options.

Thank you for the response. There are 2 options, options and boot. Which do I choose and what settings?
Title: Re: DNS forwarding to adguard on raspberry pi with dnsmasq DHCP
Post by: Monviech (Cedrik) on September 07, 2025, 08:34:51 AM
Its standardized:

https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xhtml

You choose a DHCP option, and option 6 (domain server).
Title: Re: DNS forwarding to adguard on raspberry pi with dnsmasq DHCP
Post by: pftoopn on September 07, 2025, 08:38:19 AM
This is what I have setup. It's not working. Looking at adguard, there are no blocked queries for websites I know get blocked ads.
Title: Re: DNS forwarding to adguard on raspberry pi with dnsmasq DHCP
Post by: Monviech (Cedrik) on September 07, 2025, 08:45:15 AM
It doesnt work instantly, the clients need to update their dhcp lease.

E.g on windows

"ipconfig /renew"

or restart the devices.
Title: Re: DNS forwarding to adguard on raspberry pi with dnsmasq DHCP
Post by: pftoopn on September 07, 2025, 08:48:18 AM
I'm on a Mac, and I renewed the DHCP lease. It doesn't show my adguard DNS. Thanks for helping to this point.
Title: Re: DNS forwarding to adguard on raspberry pi with dnsmasq DHCP
Post by: Monviech (Cedrik) on September 07, 2025, 08:56:30 AM
Please give the following output from the ssh shell (cli)

# sockstat -l | grep 67

# cat /usr/local/etc/dnsmasq.conf

(unsure if thats the correct conf path out of my head right now)
Title: Re: DNS forwarding to adguard on raspberry pi with dnsmasq DHCP
Post by: pftoopn on September 07, 2025, 09:13:23 AM
I wanted to check something. On my iPad, I did the same thing. It is serving the correct DNS now. I'll figure out what is the issue with the Mac or just reboot it. Thanks again.
Title: Re: DNS forwarding to adguard on raspberry pi with dnsmasq DHCP
Post by: Monviech (Cedrik) on September 07, 2025, 09:15:30 AM
Hehe okay, have a nice weekend.