Bering-uClibc 5.x - User Guide - Advanced Topics - Setting Up Ad blocking with dnsmasq
|Setting Up Ad blocking with dnsmasq|
|Prev||Bering-uClibc 5.x - User Guide||Next|
There is a lot of info on the net about setting
dnsmasq to block advertisements, trackings, etc.. LEAF Bering-uClibc5.x comes with
dnsmasq already installed, so here is a quick guide that shows a simple setup that will filter out advertisements sites from web pages on your networked devices, how lucky can we get !
(treading carefully :-))
Enter the command:
wget -O - http://pgl.yoyo.org/as/serverlist.php?hostformat=dnsmasq-server | grep server= > /root/tmpfile.list
Check the file
/root/tmpfile.list, you should have a list of servers with the following format:
server=/101com.com/ server=/101order.com/ server=/123found.com/ ... server=/zeusclicks.com/ server=/zintext.com/ server=/zmedia.com/ server=/zv1.november-lax.com/
cp /root/tmpfile.list /etc/dnsmasq.d/addblock.list
/etc/dnsmasq.conf and enter near the end:
That's it, all the nasty ads should be gone ! (well a bunch of them !)
Hum yeah ! don't forget to save your configuration, a simple:
lrcfg and s) Save configuration
... In dnsmasq "address" and "server" do different things. address=/example.org/127.0.0.1 would return 127.0.0.1 for any DNS queries for example.org and any subdomains. server=/example.org/127.0.0.1 tells dnsmasq to forward any DNS queries for example.org or subdomains to a DNS server located at the 127.0.0.1 IP. So "address" should be used if you're going to supply an IP that the domain resolves to. Using server=/example.org/ (without any IP) makes the dnsmasq server authoritative for that domain. It will then look in its own /etc/hosts (and DHCP leases) file to see if the domain has an IP listed. If not then it'll respond with an NX Domain. I personally think this is a more elegant solution than responding with an IP, as there's no chance of this potentially causing delays as the browser attempts to pull ads from the resolved IP, but some people prefer the IP method so they can run a webserver serving transparent gifs. ...
The usual "Enjoy" takes a whole new lot of sense now !