Pi-Hole Adblocker with EdgeRouter X

Remove advertisements on websites with this simple Pi-Hole on Ubuiqiti EdgeRouter X Guide. In a few simple steps get rid of adverts and make websites load fast!

Ad's, adverts, commercials.... I understand some sites need them to make money, but most of the time they are a big pain in the..... well you get the picture.

Yes, I also use affiliate links, but they are just links. You can click them or not, but they do not make it difficult to read my articles. Or change the compete look and feel of my site.

Most sites that use adverts blow the site up because they load a lot of extra scripts or you cannot read any article on your smartphone in a normal matter as popups, side-ups, slide-ins and all that stuff blocks the part you want to read.

But.. for your home there is a solution! It is called Pi-Hole!

What is Pi-Hole?

Network-wide Ad Blocking!

Pi-Hole is a Linux ad and internet tracker blocking application that constructs as a DNS sinkhole, intended for use on a private network.

The nature of Pi-hole allows it to also block website domains in general by manually adding the domain name to a blacklist. Likewise, domains can be manually added to a whitelist should a website's function be impaired by domains being blocked.

In four short phrases, Pi-Hole gives you:

Network-wide protection
Instead of browser plugins or other software on each computer, install Pi-hole in one place and your entire network is protected.

Block in-app advertisements
Network-level blocking allows you to block ads in non-traditional places such as mobile apps and smart TVs, regardless of hardware or OS.

Improve network performance
Since advertisements are blocked before they are downloaded, network performance is improved and will feel faster.

Monitor statistics
Our Web interface offers control of your Pi-hole and a central place to view statistics. We also include an API for extending these stats.

Pi-Hole on a raspberry Pi

As you know I love Raspberry Pi's. I have quite a few at home and use them for all kinds of automation within my house.

One of the best uses of a Raspberry Pi in your local network is setting up Pi-hole: a server that filters the ads from your network, simultaneously blocking websites and keeping trackers that can invade your privacy out. We explain step by step how installing Pi-hole works.

Pi-hole is essentially nothing more than a dns server combined with a block list. DNS is the Domain Name System that links domain names to IP addresses. For example, if you type msn.com on your laptop in the address bar in Firefox, the DNS server will supply the corresponding IP address to your browser, which then knows the way to the website.

Pi-hole does exactly the same, but as an extra DNS server between your equipment and the DNS server of your provider. If you set your Raspberry Pi with Pi-hole on it as a DNS server on your computer, telephone, or Macbook, Pi-hole will request the corresponding IP address from your provider's DNS server after a website request from your browser. If this includes an IP address or domain name of an advertising network or a privacy-sensitive tracker, then that request is not even passed on to the DNS server on the internet. Pi-hole knows that because it checks your website request against its block list first.

With the Rasperry Pi you redirect all your network traffic through your Rasp and Pi-Hole filters out the adverts.

I'm not using a Raspberry Pi as I have an Ubiquiti EdgeRouter X as router and I do not want to use two devices for my network traffic.

I have a lot of devices from Ubiquiti, switches, wifi access points e.g.

Pi-Hole on a Ubiquiti EdgeRouter X

The ultra-compact Ubiquiti EdgeRouter X is a cost-effective router with excellent uptime quality. It features five independent Gigabit RJ45 ports, including 1 PoE-IN port and 1 PoE-OUT port. The Edgerouter can be powered via the PoE-IN port using passive PoE at 24V.

And yes! The ad-blocking part from Pi-Hole can be easily installed on an EdgeRouter X!

The EdgeRouter X is a very cheap but very good Router! You can buy it for less then 60 dollar (when available)

Install Pi-Hole on a EdgeRouter X

The following information can also be found on this Ubiquiti forum page.

The following guide is purely for a Edgerouter X.

Open a Terminal and ssh to your EdgeRouter X.

ssh ubnt@[your routers ip address]

When connected and logged in into your EdgeRouter X do

configure set system package repository blacklist components main set system package repository blacklist description 'Britannic blacklist debian stretch repository' set system package repository blacklist distribution stretch set system package repository blacklist url 'raw.githubusercontent.com/britannic/debian-.. commit;save;exit

Just copy paste all from above and paste it in one time into your EdgeRouter X connected terminal.

Give some "ENTERS" and all is processed.

When ready copy paste the next line into your EdgeRouter X connected terminal:

sudo curl -L raw.githubusercontent.com/britannic/debian-.. | sudo apt-key add -

This is for adding the GPG signing key


Ready? Copy paste the next line into your terminal:

sudo apt-get update && sudo apt-get install -f edgeos-dnsmasq-blacklist

For updating the system repositorities and install edgeos-dnsmasq-blacklist.

If you see some reports of unmet dependencies, run this command to fix that:

sudo apt --fix-broken install

If you did not see any errors, you do not have to run this line!!

Almost ready! Time to clean up!

sudo apt-get clean cache delete system image


If you cannot see any changes restart the device or renew the IP lease. Trust me, it will work!

If you want to update to the latest Pi-Hole blacklist version do a simple

sudo apt-get update && sudo apt-get install --only-upgrade edgeos-dnsmasq-blacklist

on your EdgeRouter X. You can always run this line, even when you are not sure if there is an update. If there is no update it will just end saying there is no update.

If you want, for what reason, to uninstall the Pi-Hole blacklist on your Edgerouter X do a simple:

sudo apt-get remove --purge edgeos-dnsmasq-blacklist

That's it!!!

Have fun with clean, fast loading websites without Advertisements!!

Did you find this article valuable?

Support Theo van der Sluijs by becoming a sponsor. Any amount is appreciated!