Local DNS server with built-in ad-block.
Posted: 2016-07-13 08:27am
I had a Raspberry Pi to spare and decided to put it to use as a local, network wide DNS cache/server with build in ad block at DNS level. This stops ads from being displayed on all devices on your network, not only computers with ad block plugins in the browser.
A DNS server is like a phone book (for those of you old enough to remember those) for the internet. When you write "bbs.stardestroyer.net" in your browser, it gives little meaning to the devices on the net, as they require IP addresses, so your device does a quick check with a DNS server. This will then reply with the IP address, here 206.210.100.38 (write it in your browser and see what happens.).
To have a good, reliable and quick responding DNS server is important, as a site easy can do 20 lookups, most of them commercials and trackers, so I've used Steve Gibsons DNS Benchmark to find the servers best for me (it needs a bit of tweaking). Every ISP usually have their own DNS servers and there's plenty more, but still, having my own network wide cache speeds things up a little bit, specially if many people are on my network surfing at the same time.
OK, won't be too technical here, but being able to block lots of commercials at DNS level will not only stop ads from showing, but will also speed up the experience a bit, as ads won't be loaded. They won't even be queried.
As mentioned, I'm using an old Raspberry Pi running Pi-hole on it. This Pi-hole is the ad blocking DNS server running on Raspbian.
During installation, I had to set a static IP-address for the Pi. Make sure your DHCP doesn't use that space for assigned addresses. I've set my DHCP to assign 192.168.0.10-192.168.0.254 and am running Pi-hole on 192.168.0.3 (192.168.0.1 being the gateway and 192.168.0.2 my wifi. I also set the primary DNS server on the gateway to be that of my Pi, secondary something external, and voila, it works. The reason for changing DNS server on the gateway, is that most devices have DNS server assigned automatically to the local gateway, so nothing needs to be done with any devices on your network.
I am in no way a Linux guru, but does know a tiny bit of networking. If everything written above makes perfect sense to you, and you have a Pi to spare, it's a nice thing to play with. There won't be any miracles compared to a computer running ad block, but it's a nerdy thing I kinda like and my phone has way less ads showing now than before. (Some of the ad servers have a TTL of only 60 or less, so having a DNS cache on those wont help much, but getting rid of them is fun.)
A link to an automated install is here, but you need Raspbian first.
(Yeah, I know that ads keeps the net alive and I should be supportive of it and so on, but sometimes, it's simply too much.)
A DNS server is like a phone book (for those of you old enough to remember those) for the internet. When you write "bbs.stardestroyer.net" in your browser, it gives little meaning to the devices on the net, as they require IP addresses, so your device does a quick check with a DNS server. This will then reply with the IP address, here 206.210.100.38 (write it in your browser and see what happens.).
To have a good, reliable and quick responding DNS server is important, as a site easy can do 20 lookups, most of them commercials and trackers, so I've used Steve Gibsons DNS Benchmark to find the servers best for me (it needs a bit of tweaking). Every ISP usually have their own DNS servers and there's plenty more, but still, having my own network wide cache speeds things up a little bit, specially if many people are on my network surfing at the same time.
OK, won't be too technical here, but being able to block lots of commercials at DNS level will not only stop ads from showing, but will also speed up the experience a bit, as ads won't be loaded. They won't even be queried.
As mentioned, I'm using an old Raspberry Pi running Pi-hole on it. This Pi-hole is the ad blocking DNS server running on Raspbian.
During installation, I had to set a static IP-address for the Pi. Make sure your DHCP doesn't use that space for assigned addresses. I've set my DHCP to assign 192.168.0.10-192.168.0.254 and am running Pi-hole on 192.168.0.3 (192.168.0.1 being the gateway and 192.168.0.2 my wifi. I also set the primary DNS server on the gateway to be that of my Pi, secondary something external, and voila, it works. The reason for changing DNS server on the gateway, is that most devices have DNS server assigned automatically to the local gateway, so nothing needs to be done with any devices on your network.
I am in no way a Linux guru, but does know a tiny bit of networking. If everything written above makes perfect sense to you, and you have a Pi to spare, it's a nice thing to play with. There won't be any miracles compared to a computer running ad block, but it's a nerdy thing I kinda like and my phone has way less ads showing now than before. (Some of the ad servers have a TTL of only 60 or less, so having a DNS cache on those wont help much, but getting rid of them is fun.)
A link to an automated install is here, but you need Raspbian first.
(Yeah, I know that ads keeps the net alive and I should be supportive of it and so on, but sometimes, it's simply too much.)