I think I have just jumbled up the situations. Apologies for the confusion.
Based on my current nftables, my intention is to route / force all traffics whether hardcoded or not to go through pihole.
This is the first situation where I run nslookup google.com with and without 1.1.1.1 out of pihole
The following is when I run nslookup google.com with and without 1.1.1.1 in pihole.
I believe by running nslookup with 1.1.1.1 and return with 1.1.1.1 shows that there's bypass from my pihole from somewhere else when I have explicitly blocked 1.1.1.1
My nftables rules are as follows. I wonder if I missed out something or I am going the wrong direction? Thanks and apologies for the confusion.
(click for rule details)
table inet nat {
chain prerouting {
type nat hook prerouting priority dstnat; policy accept;
iifname "eth0" udp dport 53 counter packets 18411 bytes 1275269 dnat ip to 192.168.0.2
iifname "eth0" tcp dport 53 counter packets 2 bytes 128 dnat ip to 192.168.0.2
iifname "eth0" udp dport 53 counter packets 8 bytes 848 dnat ip6 to 2001:e68:5450:9ba:20a6:e591:c8d3:c76
iifname "eth0" tcp dport 53 counter packets 0 bytes 0 dnat ip6 to 2001:e68:5450:9ba:20a6:e591:c8d3:c76
}
}
table inet filter {
chain input {
type filter hook input priority filter; policy accept;
ct state established,related counter packets 496713 bytes 43190785 accept
iif "lo" counter packets 8900 bytes 606975 accept
ip daddr 192.168.0.2 udp dport 53 counter packets 280024 bytes 19925463 accept
ip daddr 192.168.0.2 tcp dport 53 counter packets 2 bytes 128 accept
ip6 daddr 2001:e68:5450:9ba:20a6:e591:c8d3:c76 udp dport 53 counter packets 8 bytes 848 accept
ip6 daddr 2001:e68:5450:9ba:20a6:e591:c8d3:c76 tcp dport 53 counter packets 0 bytes 0 accept
ip daddr != 192.168.0.2 udp dport 53 counter packets 0 bytes 0 drop
ip daddr != 192.168.0.2 tcp dport 53 counter packets 0 bytes 0 drop
ip6 daddr != 2001:e68:5450:9ba:20a6:e591:c8d3:c76 udp dport 53 counter packets 0 bytes 0 drop
ip6 daddr != 2001:e68:5450:9ba:20a6:e591:c8d3:c76 tcp dport 53 counter packets 0 bytes 0 drop
ip daddr { 1.0.0.1, 1.1.1.1, 8.8.4.4, 8.8.8.8, 9.9.9.9, 45.90.28.0, 45.90.30.0, 77.88.8.1, 77.88.8.8, 94.140.14.14, 94.140.15.15, 149.112.112.112, 208.67.220.220, 208.67.222.222 } tcp dport { 443, 853 } counter packets 0 bytes 0 drop
ip daddr { 1.0.0.1, 1.1.1.1, 8.8.4.4, 8.8.8.8, 9.9.9.9, 45.90.28.0, 45.90.30.0, 77.88.8.1, 77.88.8.8, 94.140.14.14, 94.140.15.15, 149.112.112.112, 208.67.220.220, 208.67.222.222 } udp dport 443 counter packets 0 bytes 0 drop
ip6 daddr { 2001:4860:4860::8844, 2001:4860:4860::8888, 2606:4700:4700::1001, 2606:4700:4700::1111, 2620:fe::9, 2620:fe::fe, 2620:119:35::35, 2620:119:53::53 } tcp dport { 443, 853 } counter packets 0 bytes 0 drop
ip6 daddr { 2001:4860:4860::8844, 2001:4860:4860::8888, 2606:4700:4700::1001, 2606:4700:4700::1111, 2620:fe::9, 2620:fe::fe, 2620:119:35::35, 2620:119:53::53 } udp dport 443 counter packets 0 bytes 0 drop
}
chain forward {
type filter hook forward priority filter; policy drop;
ct state established,related counter packets 0 bytes 0 accept
ip daddr 192.168.0.2 udp dport 53 counter packets 0 bytes 0 accept
ip daddr 192.168.0.2 tcp dport 53 counter packets 0 bytes 0 accept
ip6 daddr 2001:e68:5450:9ba:20a6:e591:c8d3:c76 udp dport 53 counter packets 0 bytes 0 accept
ip6 daddr 2001:e68:5450:9ba:20a6:e591:c8d3:c76 tcp dport 53 counter packets 0 bytes 0 accept
ip daddr != 192.168.0.2 udp dport 53 counter packets 0 bytes 0 drop
ip daddr != 192.168.0.2 tcp dport 53 counter packets 0 bytes 0 drop
ip6 daddr != 2001:e68:5450:9ba:20a6:e591:c8d3:c76 udp dport 53 counter packets 0 bytes 0 drop
ip6 daddr != 2001:e68:5450:9ba:20a6:e591:c8d3:c76 tcp dport 53 counter packets 0 bytes 0 drop
ip saddr 192.168.0.0/24 counter packets 0 bytes 0 accept
ip daddr 192.168.0.0/24 counter packets 0 bytes 0 accept
ip daddr { 1.0.0.1, 1.1.1.1, 8.8.4.4, 8.8.8.8, 9.9.9.9, 45.90.28.0, 45.90.30.0, 77.88.8.1, 77.88.8.8, 94.140.14.14, 94.140.15.15, 149.112.112.112, 208.67.220.220, 208.67.222.222 } tcp dport { 443, 853 } counter packets 0 bytes 0 drop
ip daddr { 1.0.0.1, 1.1.1.1, 8.8.4.4, 8.8.8.8, 9.9.9.9, 45.90.28.0, 45.90.30.0, 77.88.8.1, 77.88.8.8, 94.140.14.14, 94.140.15.15, 149.112.112.112, 208.67.220.220, 208.67.222.222 } udp dport 443 counter packets 0 bytes 0 drop
ip6 daddr { 2001:4860:4860::8844, 2001:4860:4860::8888, 2606:4700:4700::1001, 2606:4700:4700::1111, 2620:fe::9, 2620:fe::fe, 2620:119:35::35, 2620:119:53::53 } tcp dport { 443, 853 } counter packets 0 bytes 0 drop
ip6 daddr { 2001:4860:4860::8844, 2001:4860:4860::8888, 2606:4700:4700::1001, 2606:4700:4700::1111, 2620:fe::9, 2620:fe::fe, 2620:119:35::35, 2620:119:53::53 } udp dport 443 counter packets 0 bytes 0 drop
}
chain output {
type filter hook output priority filter; policy accept;
ip daddr 127.0.0.1 udp dport 53 counter packets 194 bytes 14562 accept
ip daddr 127.0.0.1 tcp dport 53 counter packets 0 bytes 0 accept
ip daddr { 1.0.0.1, 1.1.1.1, 8.8.4.4, 8.8.8.8, 9.9.9.9, 45.90.28.0, 45.90.30.0, 77.88.8.1, 77.88.8.8, 94.140.14.14, 94.140.15.15, 149.112.112.112, 208.67.220.220, 208.67.222.222 } udp dport 53 counter packets 3 bytes 168 drop
ip daddr { 1.0.0.1, 1.1.1.1, 8.8.4.4, 8.8.8.8, 9.9.9.9, 45.90.28.0, 45.90.30.0, 77.88.8.1, 77.88.8.8, 94.140.14.14, 94.140.15.15, 149.112.112.112, 208.67.220.220, 208.67.222.222 } tcp dport 53 counter packets 0 bytes 0 drop
ip daddr { 1.0.0.1, 1.1.1.1, 8.8.4.4, 8.8.8.8, 9.9.9.9, 45.90.28.0, 45.90.30.0, 77.88.8.1, 77.88.8.8, 94.140.14.14, 94.140.15.15, 149.112.112.112, 208.67.220.220, 208.67.222.222 } tcp dport { 443, 853 } counter packets 0 bytes 0 drop
ip6 daddr { 2001:4860:4860::8844, 2001:4860:4860::8888, 2606:4700:4700::1001, 2606:4700:4700::1111, 2620:fe::9, 2620:fe::fe, 2620:119:35::35, 2620:119:53::53 } tcp dport { 443, 853 } counter packets 0 bytes 0 drop
ip6 daddr { 2001:4860:4860::8844, 2001:4860:4860::8888, 2606:4700:4700::1001, 2606:4700:4700::1111, 2620:fe::9, 2620:fe::fe, 2620:119:35::35, 2620:119:53::53 } udp dport 53 counter packets 0 bytes 0 drop
}
}