Couple days ago, I set-up a dumb AP running OpenWrt at
192.168.1.10 with DNS & DHCP duties all forwarded to the router at
192.168.1.1. Today I decided to enhance the AP's functionality slightly by turning on
dnsmasq and only use it as a DNS server (DHCP still forwarded to router).
The main goal is to use Steven Black's compiled hosts file to do some adblocking. Through a combination of configuration via SSH & LuCI, I've managed to modify the
dnsmasq section of the
/etc/config/dhcp config file to the following:
config dnsmasq option domainneeded '1' option localise_queries '1' option rebind_protection '1' option rebind_localhost '1' option local '/lan/' option domain 'lan' option expandhosts '1' option authoritative '1' option readethers '1' option leasefile '/tmp/dhcp.leases' option resolvfile '/tmp/resolv.conf.auto' option localservice '1' list addnhosts '/root/hosts/StevenBlack.hosts' list server '192.168.1.1'
And it appears to have been configured correctly on the AP at least, since when I run from the OpenWrt
# nslookup googleads.g.doubleclick.net, I get the following output:
Server: 127.0.0.1 Address: 127.0.0.1#53 Name: googleads.g.doubleclick.net Address 1: 0.0.0.0 googleads.g.doubleclick.net canonical name = pagead46.l.doubleclick.net Address 2: 2607:f8b0:400b:809::2002
Similar story for
# nslookup adclick.g.doubleclick.net. Both of these domains are on the base compiled hosts file, and their IPv4 addresses correctly get resolved to
However when I connect to the WiFi generated by the AP through my phone and my PC, and go to a site that I know a priori to show ads from both ad domains above, those ads are still fully visible and clickable. When I run
$ nslookup googleads.g.doubleclick.net from my PC, the domain gets resolved to the ad's intended IP of
18.104.22.168, which I suppose means that it's not actually using the DNS server set-up on the AP. Also I did not manually set DNS servers on the network connection from my PC client, and simply left it as "automatic".
I wouldn't be surprised if it's something obvious that I've missed, which would lead me to facepalming once revealed. Any help and ideas are appreciated.