So, how about all those annoying ads on the internet? You know, the ones that you click on and almost instantly your antivirus has a seizure. This sometimes followed by some profanity and rapid closing of windows. What if you could remove some of those ads? You can, simply install a network ad blocker. Two of the most popular blockers available are Pi-hole and AdGuard. In a nutshell these services do exactly as described: block ads. As a side benefit, blocking ads also speeds up page loading and can improve web security by reducing your exposure to malware that can be silently embedded in ads.
In this post, we’ll go through the install of both Pi-hole and Adguard. The two services accomplish the same end goal, but as you’ll see one service offers a little more “oomph” for the work. In both cases, installation will be done on a Raspberry Pi. See this article for initial setup of the Pi. If you are only installing the network ad blocker you can safely ignore the remote desktop setup. You only need to install one service.
Install a network ad blocker: Pi-hole
Pi-hole has been around a little while longer than AdGuard (since 2015). Originally installed, as it says, on a Raspberry Pi, Pi-hole was one of the first network-wide ad blockers. The install is about as easy as it gets. In either the terminal or a SSH session, run the following:
curl -sSL https://install.pi-hole.net | bash
Once the command has been run the installer will progress through several steps. You will be prompted for several inputs. Go through the prompts. Stick with the recommended settings unless you have a specific case to use other settings. Of note, make sure that you jot down the web interface password. You will need this password to log in to the web browser interface. Changing it is doable, but somewhat annoying if you lose it.
Importantly, make sure your Pi has a static IP address. You will be using it as the DNS server for your network and a static IP is a requirement. Essentially, instead of querying Google or your ISP server to find a website, your network devices will go through Pi-hole first to determine web addresses.
Once the installation is complete visit the web interface by going to your.pi.ip:admin (i.e. 192:168.1.8:admin). Log in with the password and you can start playing around with the interface.
Install a network ad blocker: AdGuard Home
AdGuard Home is the new kid on the block with regards to network ad blockers. However, it does have some extra added features that Pi-hole does not have. This install is still very simple, but has a few extra steps. The official installation can be found here. To start, run the following command to pull the package:
Next, extract the package:
tar xvf AdGuardHome_linux_armv6.tar.gz
Once extracted, move to the new directory and install:
cd AdGuardHome sudo ./AdGuardHome -s install
Once complete, go to your.pi.IP:3000 to begin setup.
Once in the web interface you will need to complete several steps. The first is to define the port that the admin interface will be accessed through and the DNS server port. If you happen to be running a web server on the same network, choose something other than port 80 for the web interface. Importantly, make note of both ports (if changed from default). You’ll need them later.
You’ll next create a user name and password, followed by a reminder to set up the router to use AdGuard as the DNS server (more on that in a minute). Once complete, go to the dashboard and log in. After setup, you will access the dashboard via your.pi.ip:admin port (i.e. 192.168.1.8:80).
Set the ad blocker as your preferred DNS server
Once you install a network ad blocker, you need to actually use it. Most of the time your router will default to the ISP DNS server. You are going to change that and tell it to use your ad blocker as the DNS server. This allows the ad blocker to filter your network traffic, stripping out ads but still providing content.
To use the ad blocker you need to log in to your router admin settings. Generally, DNS settings can be found in the advanced WAN settings. Refer to your router’s specific documentation if unsure. Once you find it, change the DNS server settings from the default provider to the IP address of your Pi.
Which one should I use?
Both AdGuard Home and Pi-hole are extremely capable ad blockers. However, there are some differences between the two. I used Pi-hole for several months before I switched to AdGuard. Pi-hole worked, but AdGuard seems to work on my network a little better.
- AdGuard is available both as a network-wide blocker that can be installed on a Pi (or any always-on device) and as a standalone app. The app can be installed on mobile devices as well as any Windows PCs and can be used . Pi-hole is only available on your home network (unless you use a VPN while away).
- The web interface for AdGuard is a little more streamlined and easy to follow (in my own opinion). You can also easily turn on/off blocking for specific services: Facebook, TikTok, Instagram, etc.
- Both blockers can serve as the primary DHCP server for the network. Pi-hole, being a little older, gives more DHCP options than AdGuard. The DHCP server in AdGuard is currently beta. That being said…if you have a entry-level consumer router I’d use the DHCP server in the blocker for more network control. For a prosumer router (i.e. Ubiquiti), the router has more control and should be the DHCP server.
- Pi-hole allows for custom DNS entries. I.e., if I want to access my NAS by typing nas.themays.me in my browser bar rather than the IP address, I can make that a custom DNS entry in Pi-hole. Currently (or I’ve missed it), AdGuard Home does not have a custom DNS option.
- Additional block lists for Pi-hole are a little easier to find and load IMO. I’m still hunting for extra block lists for AdGuard. That being said, the default lists do the job.
- In general, Pi-hole has a more robust feature set under the hood, it just takes a little getting used to the interface. AdGuard is getting there, but as I said before its interface is a little more intuitive to use. For example, Pi-hole seems to be better at identifying specific clients even when not the DHCP server. AdGuard only recognizes clients when manually set up as the DNS server on the client.
- AdGuard has additional Safe Search, Parental Controls, and malware protection built in. Pi-hole only blocks ads. Without a little work you also don’t have the robust parental control features that AdGuard has. I’ve got kids, so that is a win for AdGuard.
Streaming Services and Ad Blockers
As I found out, an unintended consequence of ad blockers can be streaming services. When you install a network ad blocker, you may unintentionally break some of the streaming services. These platforms are sometimes highly dependent on ads, and as a result they don’t work very well if you try to block those ads. For example, Paramount+ (previously CBS All Access), simply won’t play video if Pi-hole is installed with the default settings. Other ad-intensive platforms (i.e. YouTube) can also have unexpected behavior.
AdGuard Home (so far) works out of the box with all the streaming channels. Pi-hole requires a extra step to make work. In a nutshell, you will need to create a new client group and assign clients (IP addresses) to that group. This group will bypass the ad blocking of Pi-hole and allow your streaming services to work correctly. I simply put all my smart TVs and streaming players in this group. Several searches will show that to fix streaming services you should whitelist certain web links that expose the network to those ads. Just create a client group. It works.