Can you explain exactly what you mean by this (perhaps with an example) as it doesn't seem to make much sense.I'd like to block 127.0.0.1 from querying google.com ...
Apr 4 07:40:17 dnsmasq[11279]: 1 127.0.0.1/54960 query[AAAA] google.com from 127.0.0.1
Apr 4 07:40:17 dnsmasq[11279]: 1 127.0.0.1/54960 forwarded google.com to 127.0.1.1
Apr 4 07:40:17 dnsmasq[11279]: 2 127.0.0.1/41931 query[A] google.com from 127.0.0.1
Apr 4 07:40:17 dnsmasq[11279]: 2 127.0.0.1/41931 forwarded google.com to 127.0.1.1
Apr 4 07:40:17 dnsmasq[11279]: 2 127.0.0.1/41931 reply google.com is 172.253.117.102
Apr 4 07:40:17 dnsmasq[11279]: 2 127.0.0.1/41931 reply google.com is 172.253.117.113
Apr 4 07:40:17 dnsmasq[11279]: 2 127.0.0.1/41931 reply google.com is 172.253.117.138
Apr 4 07:40:17 dnsmasq[11279]: 2 127.0.0.1/41931 reply google.com is 172.253.117.139
Apr 4 07:40:17 dnsmasq[11279]: 2 127.0.0.1/41931 reply google.com is 172.253.117.101
Apr 4 07:40:17 dnsmasq[11279]: 2 127.0.0.1/41931 reply google.com is 172.253.117.100
log-queries
log-queries=extra
cat /tmp/etc/dnsmasq.conf
Yep, you nailed it.Have you set "google.com" anywhere in the router's config? Perhaps under (Administration - System) NTP Server or Network Monitoring.
Yes, it is part of skynet, apparently its a ping or a dns query to detect internet connectivity.Seems more that it's embedded in the system as a connectivity check situation.
Already enabledTried with LAN/DNS-Filter set Enable DNS-based Filtering ON and Global Filter Mode= router?
I copied all the routers files to my computer, and searched inside them for "google.com" with notepad++, it is in the file "/scripts/firewall" (skynet).127.0.0.1 is a loop back address used to pass packets between programs within the system. You need to look for what is sending pings to www.google.com. Maybe a network monitor or keep alive system?
Whatever it is you do not want to block the loop back address!
}
Check_Connection() {
livecheck="0"
while [ "$livecheck" != "4" ]; do
if ping -q -w3 -c1 google.com >/dev/null 2>&1; then
break
else
if ping -q -w3 -c1 github.com >/dev/null 2>&1; then
break
else
if ping -q -w3 -c1 snbforums.com >/dev/null 2>&1; then
break
else
livecheck="$((livecheck + 1))"
if [ "$livecheck" != "4" ]; then
echo "[*] Internet Connectivity Error"
sleep 10
else
return "1"
fi
fi
fi
fi
done
}
log-queries=extra is enabled.It's perfectly normal for DNSMasq to issues queries since it's acting as a DNS proxy on behalf of the rest of the network (at least by default). What's unusual is that (apparently) you have DNSMasq configured in debug mode, which verbosely dumps information about those queries to the syslog. That probably means YOU or some other addon has enabled one of the following DNSMasq directives.
Code:log-queries
OR
Code:log-queries=extra
A dump of the DNSMasq config file will confirm.
Code:cat /tmp/etc/dnsmasq.conf
Have a look at the rules that the router's URL filter creates. Those rules filter DNS traffic from the LAN though and would be much better done in dnsmasq (like Diversion does). The trouble with trying to block requests specifically (and only) from the router itself is that the traffic isn't routed at the source so it never hits iptables (EDIT: see posts 14 and 15). You can't block on the output side because you can't distinguish router traffic from LAN traffic.I would still like to know the iptables command to block specific domain requests from 127.0.0.1. If anyone can provide that, I'd appreciate that. Thank you for all your help.
You mean the routers Lan-DNS filter? I'm not sure what too look for exactly. What are the commands to view those filters in particular? Interesting. Well, AdGuardHome does allow for blocking requests from the localhost, so does this mean it has its own inbuilt firewall of sorts, operating independently of iptables?Have a look at the rules that the router's URL filter creates. Those rules filter DNS traffic from the LAN though and would be much better done in dnsmasq (like Diversion does). The trouble with trying to block requests specifically (and only) from the router itself is that the traffic isn't routed at the source so it never hits iptables. You can't block on the output side because you can't distinguish router traffic from LAN traffic.
No, I was referring to Firewall - URL Filter.You mean the routers Lan-DNS filter?
I'm not sure what too look for exactly. What are the commands to view those filters in particular?
iptables-save
-A INPUT -d 192.168.1.1/32 -i br0 -p udp -m udp --dport 53 -m string --hex-string "|047465737403636f6d|" --algo bm --to 65535 --icase -j DROP
I am not familiar with how AdGuardHome works.Interesting. Well, AdGuardHome does allow for blocking requests from the localhost, so does this mean it has its own inbuilt firewall of sorts, operating independently of iptables?
Good idea, I hadn't considered that. That would probably work. (This is all assuming that theCouldn't you do something like this?
It would just need to be inserted before the ACCEPT for lo.Bash:iptables -I INPUT -i lo -p udp -m udp --dport 53 -m string --hex-string "|047465737403636f6d|" --algo bm --to 65535 --icase -j DROP
Wan: Use local caching DNS server as system resolver
option has been changed to Yes
.) It sounds like it would be a lot easier if AdGuardHome has some sort of filter engine though.Thanks for the tip. I will archive that for future reference.Couldn't you do something like this?
It would just need to be inserted before the ACCEPT for lo.Bash:iptables -I INPUT -i lo -p udp -m udp --dport 53 -m string --hex-string "|06676f6f676c6503636f6d|" --algo bm --to 65535 --icase -j DROP
Apr 7 00:39:10 dnsmasq[3499]: 9169 127.0.0.1/44719 query[A] google.com from 127.0.0.1
Apr 7 00:39:10 dnsmasq[3499]: 9169 127.0.0.1/44719 cached google.com is 74.125.195.139
Apr 7 00:39:10 dnsmasq[3499]: 9169 127.0.0.1/44719 cached google.com is 74.125.195.100
Apr 7 00:39:10 dnsmasq[3499]: 9169 127.0.0.1/44719 cached google.com is 74.125.195.102
Apr 7 00:39:10 dnsmasq[3499]: 9169 127.0.0.1/44719 cached google.com is 74.125.195.138
Apr 7 00:39:10 dnsmasq[3499]: 9169 127.0.0.1/44719 cached google.com is 74.125.195.101
Apr 7 00:39:10 dnsmasq[3499]: 9169 127.0.0.1/44719 cached google.com is 74.125.195.113
Apr 7 00:39:10 dnsmasq[3499]: 9170 127.0.0.1/51747 query[PTR] 139.195.125.74.in-addr.arpa from 127.0.0.1
Apr 7 00:39:10 dnsmasq[3499]: 9170 127.0.0.1/51747 config 139.195.125.74.in-addr.arpa is NXDOMAIN
Apr 7 00:39:10 dnsmasq[3499]: 9171 127.0.0.1/34139 query[PTR] 100.195.125.74.in-addr.arpa from 127.0.0.1
Apr 7 00:39:10 dnsmasq[3499]: 9171 127.0.0.1/34139 config 100.195.125.74.in-addr.arpa is NXDOMAIN
Apr 7 00:39:10 dnsmasq[3499]: 9172 127.0.0.1/50104 query[PTR] 102.195.125.74.in-addr.arpa from 127.0.0.1
Apr 7 00:39:10 dnsmasq[3499]: 9172 127.0.0.1/50104 config 102.195.125.74.in-addr.arpa is NXDOMAIN
Apr 7 00:39:10 dnsmasq[3499]: 9173 127.0.0.1/44371 query[PTR] 138.195.125.74.in-addr.arpa from 127.0.0.1
Apr 7 00:39:10 dnsmasq[3499]: 9173 127.0.0.1/44371 config 138.195.125.74.in-addr.arpa is NXDOMAIN
Apr 7 00:39:10 dnsmasq[3499]: 9174 127.0.0.1/37469 query[PTR] 101.195.125.74.in-addr.arpa from 127.0.0.1
Apr 7 00:39:10 dnsmasq[3499]: 9174 127.0.0.1/37469 config 101.195.125.74.in-addr.arpa is NXDOMAIN
Apr 7 00:39:10 dnsmasq[3499]: 9175 127.0.0.1/34412 query[PTR] 113.195.125.74.in-addr.arpa from 127.0.0.1
Apr 7 00:39:10 dnsmasq[3499]: 9175 127.0.0.1/34412 config 113.195.125.74.in-addr.arpa is NXDOMAIN
PS how did you generate the hex exactly? I used an online hex to text converter and it theCouldn't you do something like this?
It would just need to be inserted before the ACCEPT for lo.Bash:iptables -I INPUT -i lo -p udp -m udp --dport 53 -m string --hex-string "|06676f6f676c6503636f6d|" --algo bm --to 65535 --icase -j DROP
.
I get "google.com"PS how did you generate the hex exactly? I used an online hex to text converter and it thecomes back with some wild characters, is it still accurate?Code:.
The rule can be inserted as follows in a more human friendly format...PS how did you generate the hex exactly? I used an online hex to text converter and it thecomes back with some wild characters, is it still accurate?Code:.
iptables -I INPUT -i lo -p udp -m udp --dport 53 -m string --hex-string "|06|google|03|com|" --algo bm --to 65535 --icase -j DROP
iptables -I INPUT -i lo -p udp -m udp --dport 53 -m string --hex-string "|06|google|03|com|" --algo bm --to 65535 --icase -j DROP -m comment --comment google.com
"|03|ibm|03|com|"
"|03|bbc|02|co|02|uk|"
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!