Hi there,
Brief description of what I'd ultimately would like to achieve : my daughter's laptop is managed by her college and it's using some weird DNS outside of my control : I want to redirect her DNS requests to my pihole, so that I can ensure she's protected from everything that weird DNS when at home.
And actually, I blocked "webtoons" sites in pihole coz' she's spending here time on that instead of doing her homework.
So, I'm trying to use DNS hijacking on openwrt, on my tplink archer c6, running openwrt 22.03.
It is setup in "dumb AP mode" with some changes : I added a bridge and vlans as I'd like to have a "LAN" wifi for people, and an IoT wifi for IoT devices on another vlan/subnet with no internet access.
For now, I've tried to intercept my own DNS requests and to trace them or count them using nft. Unfortunately , I cant succeed in that. However, I do see packets coming in on wlan0, and goig out on eth0.1 ... hence I'm here asking for help.
The tcpdump is seeing the packets:
root@OpenWrt:~# tcpdump -i any 'host 192.168.1.16 and udp dst port 53'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
09:51:25.088769 IP 192.168.1.16.49733 > dns.google.53: 36838+ A? google.fr. (27)
09:51:25.088799 IP 192.168.1.16.49733 > dns.google.53: 36838+ A? google.fr. (27)
09:51:25.100670 IP 192.168.1.16.54961 > dns.google.53: 7066+ AAAA? google.fr. (27)
09:51:25.100695 IP 192.168.1.16.54961 > dns.google.53: 7066+ AAAA? google.fr. (27)
root@OpenWrt:~# tcpdump -i eth0.1 'host 192.168.1.16 and udp dst port 53'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0.1, link-type EN10MB (Ethernet), capture size 262144 bytes
09:59:07.778067 IP 192.168.1.16.59813 > dns.google.53: 31314+ A? google.fr. (27)
09:59:07.789149 IP 192.168.1.16.53086 > dns.google.53: 35348+ AAAA? google.fr. (27)
I have installed the nft nridge kmod packet:
root@OpenWrt:~# opkg list-installed|grep bridge
kmod-nft-bridge - 5.10.161-1
There is something I must be missing, I've tried to create prerouting/forward/postrouting rules to no avail:
nft add table bridge filter
nft add chain bridge filter prerouting '{ type filter hook prerouting priority 0 ; }'
nft add rule bridge filter prerouting ip saddr 192.168.1.16 udp dport 53 counter nftrace set 1
nft add chain bridge filter postrouting '{ type filter hook postrouting priority 0 ; }'
nft add rule bridge filter postrouting ip saddr 192.168.1.16 udp dport 53 counter nftrace set 1
nft add chain bridge filter forward '{type filter hook forward priority 0; }'
nft add rule bridge filter forward ip saddr 192.168.1.16 udp dport 53 counter nftrace set 1
nft add table ip filter
nft add chain ip filter prerouting '{ type filter hook prerouting priority 0 ; }'
nft add rule ip filter prerouting ip saddr 192.168.1.16 udp dport 53 counter nftrace set 1
nft add chain ip filter postrouting '{ type filter hook postrouting priority 0 ; }'
nft add rule ip filter postrouting ip saddr 192.168.1.16 udp dport 53 counter nftrace set 1
nft add chain ip filter forward '{type filter hook forward priority 0; }'
nft add rule ip filter forward ip saddr 192.168.1.16 udp dport 53 counter nftrace set 1
With all these rules... I don't see anything when I run nft monitor trace
and all rules remain at count 0 when listing rules with nft -a list ruleset
. But tcpdump is happily showing packets
Any idea what I could be missing ?
Any help would be appreciated.