I want to add some rules into iptables so that my Google/Nest smart devices stop calling Google DNS directly, and the Google DNS calls they do are redirected to my AdGuard Home DNS server which will reply with the appropriate DNS records. I know I can probably use DNSFiltering, but want to experiment with IPTable rules.
I originally just blocked the DNS calls as follows:
These are my rules to redirect Google DNS to my AGH server (192.168.10.14). I put them together after reading various posts about doing this, they look correct to me?
Also wanting to know which script should I add these rules into.
According to User scripts · RMerl/asuswrt-merlin.ng Wiki · GitHub I could likely use
firewall-start
nat-start
and I am thinking
firewall-start
nat-start
is the correct one.
Any comments or advice will be appreciated
I originally just blocked the DNS calls as follows:
iptables -I FORWARD -d 8.8.8.8 -j REJECT
iptables -I FORWARD -d 8.8.4.4 -j REJECT
These are my rules to redirect Google DNS to my AGH server (192.168.10.14). I put them together after reading various posts about doing this, they look correct to me?
iptables -t nat -A PREROUTING -p udp -d 8.8.8.8 --dport 53 -j DNAT --to 192.168.10.14
iptables -t nat -A PREROUTING -p tcp -d 8.8.8.8 --dport 53 -j DNAT --to 192.168.10.14
iptables -t nat -A PREROUTING -p udp -d 8.8.4.4 --dport 53 -j DNAT --to 192.168.10.14
iptables -t nat -A PREROUTING -p tcp -d 8.8.4.4 --dport 53 -j DNAT --to 192.168.10.14
iptables -t nat -A POSTROUTING -j MASQUERADE
Also wanting to know which script should I add these rules into.
According to User scripts · RMerl/asuswrt-merlin.ng Wiki · GitHub I could likely use
firewall-start
nat-start
and I am thinking
nat-start
is the correct one.
Any comments or advice will be appreciated
Last edited: