Connecting an entire home or small office network through a VPN router sounds ideal until you try to open your local network-attached storage (NAS) or access a local development server by its hostname. Suddenly, nas.lan, printer.local, or proxmox.home.arpa stop resolving.
At 365Finds, we run into this friction constantly during router hardware tests. Commercial VPN setups and default client scripts apply a blunt-force fix to avoid DNS leaks: they hijack port 53 and shove every single query down the encrypted tunnel to the VPN provider’s public recursive resolvers. The commercial provider's upstream resolver naturally has no record of your internal RFC 1918 private subnets. The lookup returns NXDOMAIN. Local access collapses, leaving users to choose between two bad outcomes: either type raw IP addresses like it is 1985, or disable the tunnel's DNS enforcement and risk leaking private browsing activity to the local ISP.
You do not need to make that compromise. Split DNS on your router allows the local resolver daemon to answer private domain queries locally, forward internal enterprise domains across the tunnel if needed, and route all public internet queries securely through the VPN without leaking a single packet to your ISP.
Why Router VPN Clients Break Local Name Resolution
The breakdown happens because of how typical VPN integration scripts manage DNS hierarchy:
- Blind Tunnel Overrides (
peerdns): When WireGuard or OpenVPN brings up a tunnel interface, the client often accepts pushed DNS servers and forces the router’s operating system to rewrite/etc/resolv.conf. - Global Port 53 Hijacking: To pass commercial "DNS leak tests," routers often employ firewall NAT rules redirecting all UDP/TCP port 53 traffic straight to the VPN server's DNS.
- Loss of Local Context: Client machines send local hostname queries (like
homeassistant.lan) to the router. If the router blindly dumps the request into the VPN tunnel, the public VPN resolver responds with non-existent domain errors. - Upstream Leakage Risk: If you attempt a naive fix by configuring your local DHCP server to hand out your router IP for local names and your ISP/VPN for internet lookups, clients query resolvers simultaneously. Windows and macOS will happily blast your private
.lanqueries to the public internet, or send sensitive public queries unencrypted across your WAN.
To fix this reliably, the router must serve as the authoritative gatekeeper. All client machines query only the router's local DNS service. The router then performs conditional forwarding: local domains stay inside the LAN, designated private remote domains travel across the VPN tunnel, and general internet traffic routes exclusively to the VPN resolver.
Core Architecture of a Leak-Free Split DNS Pipeline
Local Client Query
│
▼
[ Router Local DNS Daemon: dnsmasq / Unbound ]
│
├── Is query in local zone (.lan, .home.arpa)? ──> Resolve via Local DHCP/Static Leases (LAN)
│
├── Is query in corporate/remote subnet zone? ──> Forward down VPN Tunnel to Internal Resolver
│
└── Is query for public internet (e.g. eff.org)? ──> Forward securely via VPN DNS Resolver
To maintain this architecture, three rules must be strictly enforced on the router:
- Block Direct WAN Egress: No LAN client may communicate directly with external port 53 or port 853 resolvers outside the router's managed routing table.
- Suppress Incomplete Lookups: The local resolver must reject unqualified names (
domain-needed) and private IP reverse lookups (bogus-priv) from leaking into external WAN or VPN tunnels. - Whitelist Rebinding on Local Suffixes: Router security features that block upstream responses containing private IP ranges (DNS rebinding protection) must be explicitly told which internal domains are legitimate.
Configuring Split DNS Across Router Platforms
Different router operating systems implement DNS services differently. OpenWrt uses dnsmasq, Asuswrt-Merlin layers custom web controls and JFFS scripts over dnsmasq, and enterprise firewalls like pfSense and OPNsense utilize Unbound.
1. OpenWrt (dnsmasq)
OpenWrt provides the cleanest native control over DNS routing if you disable automatic DNS overrides on your VPN interface.
Step 1: Prevent the VPN from Hijacking Global DNS
When configuring a WireGuard or OpenVPN interface in OpenWrt, stop the tunnel from overwriting system resolvers:
- In the LuCI web interface, navigate to Network > Interfaces, edit your VPN interface (e.g.,
wg0orvpn), and select the Advanced Settings tab. - Uncheck Use DNS servers advertised by peer (sets
option peerdns '0'). - In terminal via UCI:
uci set network.vpn.peerdns='0'
uci commit network
/etc/init.d/network restart
Step 2: Configure Upstream Resolvers and Leak Shields
Open /etc/config/dhcp or go to Network > DHCP and DNS > General Settings:
- Ensure Local domain is defined (e.g.,
lanorhome.arpa). - Set the router to discard unqualified queries and private reverse lookups:
uci set dhcp.@dnsmasq[0].domainneeded='1'
uci set dhcp.@dnsmasq[0].boguspriv='1'
uci set dhcp.@dnsmasq[0].localise_queries='1'
uci set dhcp.@dnsmasq[0].authoritative='1'
Step 3: Define Conditional Forwarding and Upstream DNS
Direct general public DNS queries to the VPN provider's DNS IP (for example, 10.8.0.1 or your provider’s designated resolver), while routing local domains locally:
# Add upstream VPN DNS resolver
uci add_list dhcp.@dnsmasq[0].server='10.8.0.1'
# If connecting to an enterprise split-tunnel (e.g., corp.internal)
uci add_list dhcp.@dnsmasq[0].server='/corp.internal/10.8.0.1'
uci add_list dhcp.@dnsmasq[0].server='/10.in-addr.arpa/10.8.0.1'
# Rebind protection whitelist for local domains
uci add_list dhcp.@dnsmasq[0].rebind_domain='lan'
uci add_list dhcp.@dnsmasq[0].rebind_domain='corp.internal'
uci commit dhcp
/etc/init.d/dnsmasq restart
2. Asuswrt-Merlin (DNS Director & VPN Director)
Asus routers running Asuswrt-Merlin feature VPN Director (policy-based routing) and DNS Director (enforced DNS assignment). Because these features can easily conflict, 365Finds recommends explicit configuration.
Step 1: Configure LAN DHCP
- Go to LAN > DHCP Server.
- Leave DNS Server 1 empty or set it explicitly to the router’s LAN IP (e.g.,
192.168.1.1). Never put an external IP address here; all LAN clients must query the router. - Under RT-AC/AX/BE features, ensure Advertise router's IP in addition to user-specified DNS is disabled if you configure custom DNS.
Step 2: Adjust VPN Client DNS Settings
- Navigate to VPN > VPN Client.
- Under your active OpenVPN or WireGuard profile, locate Accept DNS Configuration.
- Set this to Exclusive if all routed clients should use VPN DNS, or Strict if using policy-based split tunneling. "Exclusive" forces
dnsmasqto push queries originating from tunneled IPs into the tunnel’s DNS without poisoning the router's base lookup table.
Step 3: Handle Split Domains via JFFS
If you run an internal server (such as a Pi-hole, AdGuard Home, or private NAS zone) that requires split forwarding:
- Enable JFFS custom scripts under Administration > System.
- SSH into your Asus router and edit
/jffs/configs/dnsmasq.conf.add:
# Forward local lab domain to your internal resolver
server=/home.arpa/192.168.1.50
server=/lab.internal/192.168.1.50
# Ensure upstream queries do not leak local reverse lookups
bogus-priv
domain-needed
- Restart the daemon:
service restart_dnsmasq
3. pfSense / OPNsense (Unbound DNS Resolver)
In pfSense, Unbound functions as an authoritative validating resolver. It offers granular control over which network interface issues outbound queries.
Step 1: Set Interface Bindings
- Navigate to Services > DNS Resolver > General Settings.
- Network Interfaces: Select only
LAN, any internal VLANs, andLocalhost. Do not select WAN or VPN interfaces here. This restricts client query listening to safe, local zones. - Outgoing Network Interfaces: Select your active VPN interface (e.g.,
OVPN_WANorWG_VPN). This guarantees that all upstream recursive queries leave the firewall exclusively across the encrypted tunnel.
Step 2: Prevent WAN Fallback and Overrides
- Go to System > General Setup.
- Uncheck Allow DNS server list to be overridden by DHCP/PPP on WAN. This stops your ISP from overwriting gateway resolvers when DHCP renews.
- If DNS servers are specified under DNS Server Settings, assign the Gateway for those IPs explicitly to your VPN gateway.
Step 3: Configure Domain Overrides for Split DNS
- Under Services > DNS Resolver > General Settings, scroll down to Domain Overrides.
- Click Add to route specific internal or enterprise domains:
- Domain:
corp.internal(oroffice.lan) - IP Address: IP of your internal domain controller or DNS server (e.g.,
10.200.1.5)
- Domain:
- For local devices managed directly by pfSense, verify Register DHCP leases in the DNS Resolver and Register DHCP static mappings in the DNS Resolver are enabled.
Step 4: Intercept Port 53 Traffic (NAT Port Forward)
To ensure stubborn devices or embedded operating systems do not bypass your resolver by querying public DNS directly, redirect port 53 back into the firewall:
- Navigate to Firewall > NAT > Port Forward and create a rule:
- Interface:
LAN - Protocol:
TCP/UDP - Destination: Invert Match (
[x]), Destination:LAN Address - Destination Port Range:
53to53 - Redirect Target IP:
127.0.0.1 - Redirect Target Port:
53 - Description: Redirect rogue DNS queries to local Unbound resolver.
- Interface:
Technical Comparison of Platform Configurations
| Platform | Primary DNS Daemon | Split Forwarding Syntax | Leak Prevention Mechanism | Best Use Case |
|---|---|---|---|---|
| OpenWrt | dnsmasq | server=/internal.domain/IP in dhcp config | option peerdns '0', domainneeded, boguspriv | Lightweight, open-source routers; granular terminal control |
| Asuswrt-Merlin | dnsmasq | server=/internal.domain/IP in /jffs/configs/dnsmasq.conf.add | DNS Director rules; VPN Client DNS set to "Exclusive" | Home networks wanting high-speed Wi-Fi 6/7 with policy routing |
| pfSense / OPNsense | Unbound | Domain Overrides in Resolver GUI | Outgoing interface lock to VPN; Port 53 NAT intercept | Small business, homelabs, complex multi-VLAN environments |
Mitigating Hidden DNS Leaks and Edge Cases
Even with split DNS configured properly, three modern protocol behaviors can silently unravel your setup.
1. The DNS-over-HTTPS (DoH) Bypass
Modern web browsers (Firefox, Chrome, Safari) and mobile operating systems aggressively push Encrypted DNS / DoH. If a browser activates DoH, it makes encrypted HTTPS connections on port 443 directly to Cloudflare, Google, or NextDNS.
- The Result: The browser bypasses your router's split DNS completely. It will fail to resolve your local
.lanhostnames, and it will bypass your tunnel's DNS policies. - The Solution:
- Block DNS-over-TLS (port 853) at the firewall level for all LAN clients.
- Implement the official DoH canary domain in
dnsmasq:# Return NXDOMAIN for Firefox/Chrome DoH canaries server=/use-application-dns.net/ - If your network requires absolute enforcement, block known DoH public IP addresses or enforce an outbound Layer 7 proxy policy.
2. mDNS and the .local Suffix Trap
Many home administrators assign .local as their router's DHCP domain name. This violates RFC 6762. The .local top-level domain is strictly reserved for Multicast DNS (mDNS / Bonjour / ZeroConf).
When a macOS, Linux (systemd-resolved), or Windows machine encounters a .local hostname, it often routes the lookup via multicast link-local packets (224.0.0.251:5353) rather than sending a unicast DNS query to your router's port 53. If the host is on a different VLAN or the mDNS repeater is disabled, lookup fails.
- Best Practice: Use
.home.arpaas standardized under RFC 8375 for non-public home networks, or a valid domain name you own (e.g.,internal.yourdomain.com).
3. DNS Rebinding Protections
Most modern router firmware blocks upstream resolvers from returning private RFC 1918 IP addresses (e.g., 192.168.x.x, 10.x.x.x, 172.16.x.x) to protect against browser-based intranet hijacking.
- If your split DNS forwards a corporate or private sub-domain (such as
vault.internal) to a remote VPN resolver, and that resolver returns an internal IP address, your router'sdnsmasqorUnboundwill drop the packet by default. - Always add your forwarded domains to the explicit rebind whitelist:
- In OpenWrt:
rebind_domain='corp.internal' - In Asuswrt-Merlin:
rebind-domain-ok=/corp.internal/indnsmasq.conf.add - In pfSense: Add
corp.internalunder Private Domains in the Unbound Resolver settings.
- In OpenWrt:
Verification and Leak Testing
Do not rely solely on commercial one-click leak tests; these sites only check whether their own tracking servers detect your ISP’s public IP address. Verify both local resolution and tunnel isolation from a connected LAN terminal.
1. Test Local Name Resolution
Run an explicit query against the router's LAN IP:
nslookup nas.home.arpa 192.168.1.1
The query must return your local RFC 1918 address immediately with an authoritative answer from the router.
2. Verify Corporate / Split-Domain Forwarding
nslookup git.corp.internal 192.168.1.1
The response should originate from your internal VPN resolver address without timing out.
3. Audit for Public Leaks
Use standard diagnostic utilities to inspect the public resolution path:
dig whoami.akamai.net @192.168.1.1
Or query a leak identification service:
curl https://am.i.mullvad.net/dns
The returned resolver address must strictly identify your VPN provider's DNS endpoints. If your residential ISP’s name or IP appears anywhere in the output, check whether your router's WAN interface is receiving upstream servers via DHCP and ensure peerdns or WAN DNS override checkboxes are properly disabled.