[RESOLVED] Force DNS redirect for untrusted VLAN with Pihole

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Goto page Previous  1, 2
Author Message
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3005
Location: Germany

PostPosted: Wed Mar 20, 2024 21:32    Post subject: Reply with quote
Code:
iptables -t nat -I PREROUTING -i br1 ! -d $(nvram get br1_ipaddr) -p tcp --dport 53 -j DNAT --to $(nvram get br1_ipaddr):53
iptables -t nat -I PREROUTING -i br1 ! -d $(nvram get br1_ipaddr) -p udp --dport 53 -j DNAT --to $(nvram get br1_ipaddr):53

_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP
Sponsor
rnix
DD-WRT User


Joined: 23 Feb 2016
Posts: 200

PostPosted: Wed Mar 20, 2024 21:48    Post subject: Reply with quote
It worked fine and I now feel embarrased as my previous setup was indeed a mess Embarassed Thank you ho1Aetoo

Code:

iptables -t nat -I PREROUTING -i br0 ! -s 10.10.10.254 ! -d $(nvram get lan_ipaddr) -p tcp --dport 53 -j DNAT --to $(nvram get lan_ipaddr):53
iptables -t nat -I PREROUTING -i br0 ! -s 10.10.10.254 ! -d $(nvram get lan_ipaddr) -p udp --dport 53 -j DNAT --to $(nvram get lan_ipaddr):53

iptables -t nat -I PREROUTING -i br1 ! -d $(nvram get br1_ipaddr) -p tcp --dport 53 -j DNAT --to $(nvram get br1_ipaddr):53
iptables -t nat -I PREROUTING -i br1 ! -d $(nvram get br1_ipaddr) -p udp --dport 53 -j DNAT --to $(nvram get br1_ipaddr):53


I will also edit my earlier post so someone would not mistakenly use incorrect rules.
Goto page Previous  1, 2 Display posts from previous:    Page 2 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum