OPNsense Forum

English Forums => 26.1, 26,4 Series => Topic started by: TarteTatin on April 20, 2026, 11:03:21 AM

Title: [Solved] Enforcing DNS through OPNsense - NAT redirect issue and fix
Post by: TarteTatin on April 20, 2026, 11:03:21 AM
Hi,

I set up DNS enforcement on my OPNsense home network to force all devices through my local Unbound resolver (with blocklists), regardless of their configured DNS server.

Setup:

Problem:
Computers, VMs and Docker containers already using OPNsense as their DNS server started experiencing intermittent timeouts. The NAT redirect was intercepting their queries (already correctly destined for OPNsense) and creating a redirect loop.

Fix:
Added a "no redirect" NAT rule, matching DNS traffic already destined for OPNsense, before the destination NAT rule redirecting all port 53 traffic to OPNsense.

Final NAT order:
Title: Re: Enforcing DNS through OPNsense - NAT redirect issue and fix
Post by: nero355 on April 20, 2026, 02:40:50 PM
How did/does your re-direct rule look like exactly ?

My guess is you have been filtering ALL DNS TRAFFIC instead of just DNS traffic that isn't going to OPNsense ?
Title: Re: Enforcing DNS through OPNsense - NAT redirect issue and fix
Post by: TarteTatin on April 20, 2026, 07:08:22 PM
Hey nero355,

You're right, I did not see the "invert destination" option. Now I did check it and specified my firewall.

Thanks to you, I had a better look at it!
Title: Re: [Solved] Enforcing DNS through OPNsense - NAT redirect issue and fix
Post by: nero355 on April 20, 2026, 11:55:36 PM
Quote from: TarteTatin on April 20, 2026, 07:08:22 PMYou're right, I did not see the "invert destination" option. Now I did check it and specified my firewall.

Thanks to you, I had a better look at it!
COOL! :)