Repository navigation
LAN DNS traffic is no longer redirected to dnsmasq #1871
Description
Steps to reproduce
- Enable Threat Shield DNS from the UI (
Security > Threat Shield DNS) selecting thelanzone - Check the resulting configuration:
uci show adblock.global.adb_nftdevforce→'lan' - Resolve the actual device behind that zone: the zone
lanmaps to networkgreen, which maps to deviceeth0 - Inspect the generated ruleset:
nft list chain inet adblock pre-routing - From a LAN client, send a DNS query to an external resolver, bypassing the firewall's DNS:
dig @8.8.8.8 -x <client_ip> +short
Expected behavior
DNS traffic from the selected zones is redirected to the local dnsmasq instance on port 53, and DoT on port 853 is rejected, so that clients configured with a custom DNS server are still filtered by Threat Shield DNS.
Actual behavior
The enforcement rules are generated using the firewall zone name as iifname. Since iifname matches on the actual network device name, the rules never match any packet and the counters stay at zero:
root@NethSec:~# nft list chain inet adblock pre-routing
table inet adblock {
chain pre-routing {
type nat hook prerouting priority mangle; policy accept;
iifname "lan" meta nfproto { ipv4, ipv6 } meta l4proto { tcp, udp } th dport 53 counter packets 0 bytes 0 redirect to :53
iifname "lan" meta nfproto { ipv4, ipv6 } meta l4proto { tcp, udp } th dport 853 counter packets 0 bytes 0 goto _reject
}
}
The value should be a network device (eth0 in this setup), not a zone name:
adblock.global.adb_nftdevforce='lan' # actual
adblock.global.adb_nftdevforce='eth0' # expected
Workaround
Add the enforcement rules manually, using the real device name instead of the zone name. Retrieve the device of each zone you want to enforce:
. /lib/functions/network.sh
network_get_device dev green && echo "$dev"Then add the rules to the existing chain (replace eth0 with the device from the previous command):
nft add rule inet adblock pre-routing iifname "eth0" \
meta nfproto { ipv4, ipv6 } meta l4proto { udp, tcp } th dport 53 counter redirect to :53
nft add rule inet adblock pre-routing iifname "eth0" \
meta nfproto { ipv4, ipv6 } meta l4proto { udp, tcp } th dport 853 counter goto _rejectVerify with nft list chain inet adblock pre-routing that the counters start increasing.
Caveat: these rules live in memory only. They are lost on reboot and every time adblock is reloaded or restarted — including the scheduled cron reload — so they need to be re-applied, e.g. from a hotplug/startup script.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone ✅
Activity
m-dilorenzi commentedon Aug 27, 2026
QA
Image: dev image
Fresh image install (config from scratch)
Security > Threat Shield DNS, select thelanzone (thegreenzone) and enable the service.iifname:Migration of an old broken system (broken → repaired)
Security > Threat Shield DNS, select thelanzone (thegreenzone) and enable the service.ns-threat_shieldandns-apipackages and copy them to the machine and install the two packages withapk addcommand to simulate the packages update.ns_tsdns_zonesand the devices were rebuilt:dig+ counter check) to confirm interception.New interface in an enforced zone
lanzone, note the current devices:eth2) to thelan/greenzone from the UI (or via uci) and save/commit.digcommand from a client on the new interface and verify the counters rise.adb_nftdevforce.Tbaile commentedon Sep 3, 2026
I've got a single KO from the upgrade path, probably related to adblock and our code.
I've did an image upgrade, instead of the packages cause I didn't read properly, this made the adblock completely ineffective.
NFT rules are good, but blocking doesn't happen, when we dive into adblock status we are missing versions of adblock.
A restart of only adblock populates the versions and the blocking now works.
However, rebooting the machine makes adblock lock itself again.
I need further investigation on the matter.
Tbaile commentedon Sep 4, 2026
KO is not related to this issue, see: #1885