ASUSWRT-Merlin RT-AC68U 384.4-2 Sat Mar 24 17:01:45 UTC 2018
myusername@myrouter:/tmp/home/root# iptables -t nat -L -v -n
Chain PREROUTING (policy ACCEPT 4406 packets, 705K bytes)
pkts bytes target prot opt in out source destination
236 14158 VSERVER all -- * * 0.0.0.0/0 mypubip
1672 118K DNSFILTER udp -- * * 192.168.20.0/24 0.0.0.0/0 udp dpt:53
0 0 DNSFILTER tcp -- * * 192.168.20.0/24 0.0.0.0/0 tcp dpt:53
Chain INPUT (policy ACCEPT 680 packets, 73901 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 2253 packets, 188K bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 2840 packets, 226K bytes)
pkts bytes target prot opt in out source destination
2944 448K PUPNP all -- * eth0 0.0.0.0/0 0.0.0.0/0
2314 407K MASQUERADE all -- * eth0 !mypubip 0.0.0.0/0
7 2414 MASQUERADE all -- * br0 192.168.20.0/24 192.168.20.0/24
Chain DNSFILTER (2 references)
pkts bytes target prot opt in out source destination
1 59 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 MAC nixieclock:96 to:208.67.222.222
0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 MAC mytestdevice to:192.168.30.5
Chain LOCALSRV (0 references)
pkts bytes target prot opt in out source destination
Chain PCREDIRECT (0 references)
pkts bytes target prot opt in out source destination
Chain PUPNP (1 references)
pkts bytes target prot opt in out source destination
Chain VSERVER (1 references)
pkts bytes target prot opt in out source destination
236 14158 VUPNP all -- * * 0.0.0.0/0 0.0.0.0/0
Chain VUPNP (1 references)
pkts bytes target prot opt in out source destination
myusername@mypubip:/tmp/home/root# iptables -t nat -L -v -n
Chain PREROUTING (policy ACCEPT 11982 packets, 2182K bytes)
pkts bytes target prot opt in out source destination
1068 56923 VSERVER all -- * * 0.0.0.0/0 mypubip
3964 258K DNSFILTER udp -- * * 192.168.20.0/24 0.0.0.0/0 udp dpt:53
17 1020 DNSFILTER tcp -- * * 192.168.20.0/24 0.0.0.0/0 tcp dpt:53
Chain INPUT (policy ACCEPT 2120 packets, 224K bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 6804 packets, 578K bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 6782 packets, 568K bytes)
pkts bytes target prot opt in out source destination
9356 1519K PUPNP all -- * eth0 0.0.0.0/0 0.0.0.0/0
7552 1404K MASQUERADE all -- * eth0 !mypubip 0.0.0.0/0
29 10076 MASQUERADE all -- * br0 192.168.20.0/24 192.168.20.0/24
Chain DNSFILTER (2 references)
pkts bytes target prot opt in out source destination
3 177 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 MAC mynixieclock to:208.67.222.222
0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 MAC mytestdevice to:192.168.30.5
Chain LOCALSRV (0 references)
pkts bytes target prot opt in out source destination
Chain PCREDIRECT (0 references)
pkts bytes target prot opt in out source destination
Chain PUPNP (1 references)
pkts bytes target prot opt in out source destination
Chain VSERVER (1 references)
pkts bytes target prot opt in out source destination
1068 56923 VUPNP all -- * * 0.0.0.0/0 0.0.0.0/0
Chain VUPNP (1 references)
pkts bytes target prot opt in out source destination
I could potentially do this but that is a ton of micro managing to do and once I get my home automation all setup its going to have probably about 100 or so clients attached so i dont want to be dealing with that. Global filter should work and has worked in the past. Colin is very helpful so hopefully we can figure that outAdd the device to the DNS Filter list by mac address then set it to no filtering
Thanks for confirming that.Yes I would say you are correct it is working with DNS Filtering on and global option set to "no filtering"
Correct.When I select no filtering, a client automatically bypasses the DNS filtering and then either uses the LAN DNS 1/2 provided by DHCP or if it has a hard coded DNS such as chromecast 8.8.8.8 it uses that. Correct? so with no filtering on, I MAY not be getting all DNS requests to my pi hole if they have a hard coded address?
In addition global filter "router" forces all clients no matter what to use LAN DNS that is specified in DHCP Lan 1/2?
The reason I ask these clarifications is when I select Global filter "Router" with a DHCP LAN DNS say google 8.8.8.8. It works flawlessly it forces EVERY DNS request to 8.8.8.8 like it should. However, when i change it to 192.168.20.241 (pihole) it doesn't work. Im not asking you to troubleshoot pihole as i believe you sufficiently narrow down the problem to pihole.
The part I am confused about. After I change it to what I said above, Global filter "router" DHCP LAN DNS 192.168.20.241. I see a TON of requests going to pihole. actually so many that it makes the interface of pihole super slow (besides the point) but when I check the logs. All the requests are coming from the router 192.168.20.1 NOT the devices. Why is that? See screenshot attached.
In the screenshot below. I went to duckduckgo and youtube from MY laptop router intercepts it and forces it to LAN DNS1 which is pihole however in the log it shows those DNS requests that I made my from laptop are from 192.168.20.1, my laptop is 20.10 (DHCP)
i was refering to only the things you want as exceptions, divces than you dont want filtered.Well I have done what you said. I have changed the LAN DNS server 1 to 37.235.1.174 freeDNS
here is the before
Code:ASUSWRT-Merlin RT-AC68U 384.4-2 Sat Mar 24 17:01:45 UTC 2018 myusername@myrouter:/tmp/home/root# iptables -t nat -L -v -n Chain PREROUTING (policy ACCEPT 4406 packets, 705K bytes) pkts bytes target prot opt in out source destination 236 14158 VSERVER all -- * * 0.0.0.0/0 mypubip 1672 118K DNSFILTER udp -- * * 192.168.20.0/24 0.0.0.0/0 udp dpt:53 0 0 DNSFILTER tcp -- * * 192.168.20.0/24 0.0.0.0/0 tcp dpt:53 Chain INPUT (policy ACCEPT 680 packets, 73901 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 2253 packets, 188K bytes) pkts bytes target prot opt in out source destination Chain POSTROUTING (policy ACCEPT 2840 packets, 226K bytes) pkts bytes target prot opt in out source destination 2944 448K PUPNP all -- * eth0 0.0.0.0/0 0.0.0.0/0 2314 407K MASQUERADE all -- * eth0 !mypubip 0.0.0.0/0 7 2414 MASQUERADE all -- * br0 192.168.20.0/24 192.168.20.0/24 Chain DNSFILTER (2 references) pkts bytes target prot opt in out source destination 1 59 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 MAC nixieclock:96 to:208.67.222.222 0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 MAC mytestdevice to:192.168.30.5 Chain LOCALSRV (0 references) pkts bytes target prot opt in out source destination Chain PCREDIRECT (0 references) pkts bytes target prot opt in out source destination Chain PUPNP (1 references) pkts bytes target prot opt in out source destination Chain VSERVER (1 references) pkts bytes target prot opt in out source destination 236 14158 VUPNP all -- * * 0.0.0.0/0 0.0.0.0/0 Chain VUPNP (1 references) pkts bytes target prot opt in out source destination
here is the after 5 hours later after a reboot Of ALL devices, router , switch and AP.
With this change of LAN DNS one. I have checked a few phones and laptops. my laptop when I do ipconfig /all which proves it has taken effectCode:myusername@mypubip:/tmp/home/root# iptables -t nat -L -v -n Chain PREROUTING (policy ACCEPT 11982 packets, 2182K bytes) pkts bytes target prot opt in out source destination 1068 56923 VSERVER all -- * * 0.0.0.0/0 mypubip 3964 258K DNSFILTER udp -- * * 192.168.20.0/24 0.0.0.0/0 udp dpt:53 17 1020 DNSFILTER tcp -- * * 192.168.20.0/24 0.0.0.0/0 tcp dpt:53 Chain INPUT (policy ACCEPT 2120 packets, 224K bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 6804 packets, 578K bytes) pkts bytes target prot opt in out source destination Chain POSTROUTING (policy ACCEPT 6782 packets, 568K bytes) pkts bytes target prot opt in out source destination 9356 1519K PUPNP all -- * eth0 0.0.0.0/0 0.0.0.0/0 7552 1404K MASQUERADE all -- * eth0 !mypubip 0.0.0.0/0 29 10076 MASQUERADE all -- * br0 192.168.20.0/24 192.168.20.0/24 Chain DNSFILTER (2 references) pkts bytes target prot opt in out source destination 3 177 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 MAC mynixieclock to:208.67.222.222 0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 MAC mytestdevice to:192.168.30.5 Chain LOCALSRV (0 references) pkts bytes target prot opt in out source destination Chain PCREDIRECT (0 references) pkts bytes target prot opt in out source destination Chain PUPNP (1 references) pkts bytes target prot opt in out source destination Chain VSERVER (1 references) pkts bytes target prot opt in out source destination 1068 56923 VUPNP all -- * * 0.0.0.0/0 0.0.0.0/0 Chain VUPNP (1 references) pkts bytes target prot opt in out source destination
" DNS Servers . . . . . . . . . . . : 37.235.1.174"
in addition I checked pi hole (see attached photo) the graph shows that ALL clients have stopped sending DNS requests to pihole 192.168.20.241. which would mean the LAN DNS server 37.* has taken effect
It also shows that my nixie clock HAS actually stopped sending DNS requests to pi hole 20.241. DNS filtering is still on and still set to the settings above on the screen shot
I could potentially do this but that is a ton of micro managing to do and once I get my home automation all setup its going to have probably about 100 or so clients attached so i dont want to be dealing with that. Global filter should work and has worked in the past. Colin is very helpful so hopefully we can figure that out
are you sure about this? Because when I set it to global filter router and reboot all devices it appears to go to DHCP DNS LAN 1/2Thanks for confirming that.
Correct.
No. "Router" forces all DNS requests to go to the router's IP address and is therefore handled by dnsmasq on the router. dnsmasq will then forward the requests upstream to whatever servers are specified in the router's WAN DNS settings.
Chain DNSFILTER (2 references)
pkts bytes target prot opt in out source destination
0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 MAC nixie clock to:208.67.222.222
0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 MAC mytestdevice to:192.168.30.5
498 38281 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 to:192.168.20.241
I think you need to recheck this behaviour in light of my description about how Global filter "Router" works, because whatever is set for LAN DNS1&2 is irrelevant. It's whatever is set as the router's WAN DNS servers that is ultimately used. Or to put it another way, "Global filter Router" means "Send DNS requests to the DNS server running on the router".
You've cracked it! And highlighted an incorrect assumption that I was making about how this works . (Note to self: Read the instructions idiot!)are you sure about this? Because when I set it to global filter router and reboot all devices it appears to go to DHCP DNS LAN 1/2
Here is log from me changing it via the command you gave me (very useful by the way, wish i would have known about this ages ago)
Code:Chain DNSFILTER (2 references) pkts bytes target prot opt in out source destination 0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 MAC nixie clock to:208.67.222.222 0 0 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 MAC mytestdevice to:192.168.30.5 498 38281 DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 to:192.168.20.241
No, you were right and I was wrong. Doh!I guess I didn't understand what "router" actually did... I was going based on the description on that page.
So what I think is happening in your setup above is;
1. A client makes a DNS request.
2. It is intercepted by DNSFilter and redirected to the PiHole. ***
3. The PiHole tries to forward the request to an external upstream DNS server.
4. DNSFilter intercepts the PiHole's request and sends it back to the PiHole.
5. Infinite Loop between 3 and 4.
The PiHole shows the client address as the router (192.168.20.1) because the source address is still being NATed in the NAT/POSTROUTING chain (with -j MASQUERADE).
*** I have a suspicion (that I can't prove) that in some circumstances the very first client DNS request might go straight to the PiHole, because the traffic is switched not routed, and therefore never gets to the router. But that's by the by.
unfortunately no, the router is not able to do that now. However pihole is able to do that, but you have to turn on DHCP for that. I'd rather not turn that on in the pihole. When I get a proper microserver (instead of a raspberry pi), I will turn the DHCP on for pihole and turn DHCP router off.That's great news.
As an aside, now that you're using the PiHole as your local DNS server, does local name resolution work? Say, if you had a Windows PC called "fred" that was a normal DHCP client. Would "nslookup fred" work?
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!