How to setup adguard home installed raspberry pi?

I have installed adguardhome on the raspberry pi. Next, what settings do I need to make on the openwrt router to make adguardhome take effect? Thanks for helping.


  1. I installed adguardhome not directly in openwrt, but on raspberry pi.
  2. The openwrt I use now has both IPV4 and IPV6.

I'm from a country where my native language is not English, the above is translated by Google.

Point your DNS server to the Rasperry Pi IP address.

1 Like

you can install AGH on your router directly if you have enough space and ram.

Alternately if you want to run any other type of DNS service like AGH or PiHole on another device you must get Dnsmasq to pass option 6 as part of the dhcp request. This will set your downstream clients to use the broadcasted DNS. However, be aware that without dns interception rules, anyone using a hardcoded or alternate set DNS will bypass your filtering.

# DHCP option 6: which DNS (Domain Name Server) to include in the IP configuration for name resolution
uci add_list dhcp.lan.dhcp_option='6,'"<IP of PI>"

Or edit the setting here in luci. As i have AGH installed on the router i just pass the routers ip but you would put your PI IP here.


are these the rules to force DNS? where X.X.X.X is the pihole/adguard dns server? This should be on the firewall custom rules?

iptables -t nat -A PREROUTING -i br-lan -p udp --dport 53 -j DNAT --to X.X.X.X:port
iptables -t nat -A PREROUTING -i br-lan -p tcp --dport 53 -j DNAT --to X.X.X.X:port
1 Like Yes its detailed here.

1 Like

using these rules (DNS enforcing), it seems the raspberry and the router blocks itself or at least I don't get more ping or unable to connect? I'm getting a loophole? where I should exempt the dns server (raspberry pi) and the router (openwrt) ? or what I'm doing wrong?

I installed ADH on a raspberry pi, I didn't add any extra rules to the firewall's custom rules, and everything is working fine so far. I think the above firewall custom rules are only valid when ADH is installed on the same device as openwrt. For exam only.

I see, thank you.

you potentially require an exception to the rule as you are running your pihole on an another host.

What you require is a rule stating ALL dns requests to me be redirected to x DNS (except for x DNS)

see here

please note that he has highlighted the exception rule with **. You should not do that in the config file as it wont like it :slight_smile:

1 Like

Yes those rules are for same host DNS. However if you are not intercepting DNS queries then anyone setting their own DNS settings behind your router will bypass your DNS entirely. Additionally that rule ONLY intercepts plain DNS queries. To block DOH or other encrypted queries takes additional rules.

(edit) I've added a note to the wiki to highlight that.

thank you @mercygroundabyss

1 Like