What am I missing?
Quote from: Xelas on August 26, 2020, 09:38:39 amWhat am I missing?Knowledge? I would say that you need a block/reject rule for DNS ports to all destinations except 172.16.1.5
Quote from: sorano on August 26, 2020, 09:52:22 amQuote from: Xelas on August 26, 2020, 09:38:39 amWhat am I missing? I would say that you need a block/reject rule for DNS ports to all destinations except 172.16.1.5no, because its blocked by default.
Quote from: Xelas on August 26, 2020, 09:38:39 amWhat am I missing? I would say that you need a block/reject rule for DNS ports to all destinations except 172.16.1.5
This isn't working, as I can change the DNS setting manually on a PC on the LAN and happily bypass the firewall.
LAN is: 172.16.1.1/24pihole is at 172.16.1.5opnsense unbound is obviously at 172.16.1.1I'm trying to redirect all DNS traffic to the pihole. pihole should then go to 172.16.1.1 (to allow local dns resolution to work) then the router goes out to 8.8.8.8 or whatever.Then I added a forward NAT:Interface: LANProtocol: TCP/UDPSource LAN addressSource port range: DNSDestination / Invert: CheckedDestination:172.16.1.5/32Destination Port: DNSRedirect target IP: 172.16.1.5Redirect target port: DNSNAT reflection: DisableThis isn't working, as I can change the DNS setting manually on a PC on the LAN and happily bypass the firewall.What am I missing?
Then I added a forward NAT:Interface: LANProtocol: TCP/UDPSource LAN addressSource port range: DNSDestination / Invert: CheckedDestination:172.16.1.5/32Destination Port: DNSRedirect target IP: 172.16.1.5Redirect target port: DNSNAT reflection: Disable
This guy’s guide worked for me and several others I believe.https://homenetworkguy.com/how-to/configure-dns-opnsense-pihole/Cheers,
...Source port should be ANY, not DNS (destination is DNS). You'll also need a second rule for ipv6 if you're using ipv6. For ipv6, use the link-local address on the pihole as that won't change. Not sure you need that first rule.
Quote from: Xelas on August 26, 2020, 09:38:39 amThen I added a forward NAT:Interface: LANProtocol: TCP/UDPSource LAN addressSource port range: DNSDestination / Invert: CheckedDestination:172.16.1.5/32Destination Port: DNSRedirect target IP: 172.16.1.5Redirect target port: DNSNAT reflection: DisableI think for SOURCE you would want LAN NET not LAN Address. But I find that if you do that then the PiHOLE itself will be included in the Port Forward and cause DNS to fail. So I used the Invert feature and setup my Port Forward like thisINT PROTO SOURCE PORT DESTINATION PORT NAT IP NAT PORTLAN TCP/UDP !172.16.1.5 ANY !172.16.1.5 53(DNS) 172.16.1.5 53(DNS)
That rule makes a ton of sense, thank you! It also looks like it eliminates needing to have another rule ahead of it to handle the pihole as a special case, so it kills 2 birds with 2 stone. Elegant. I'll give this a shot tonight or tomorrow night after my family shuts down. Don't want to clobber precious Netflix time :-)