Display ads are a huge annoyance that everyone could do without, but blocking them has always been harder to do on mobile devices than on desktops. Pi-hole solves this problem by turning your Raspberry Pi into a DNS server that will block mobile ads on any device you connect to your Wi-Fi network.
Pi-hole also blocks in-app advertising in a lot of cases and can remove the ads from YouTube videos. So if you’re looking for a comprehensive way to block mobile ads on phones and tablets, here’s how I set things up.
What is Pi-hole?
Pi-hole is a custom DNS server for Raspberry Pi devices running the Raspberry Pi OS. It blocks ads from being displayed on the devices on your network, just like the popular browser extensions Adblock Plus and uBlock Origin.
Unlike browser extensions, Pi-hole blocks ads for every device connected to it. There’s usually no need to do any additional configuration on the device itself. For example, you could buy a new tablet and, as soon as it is connected to your wifi, it will immediately stop displaying ads in the web browser and most apps. Pi-hole stops ads before they are downloaded, so your network will perform better.
Most DNS servers work by translating a URL into an IP address. Pi-hole does that and more. It waits until your computer or device requests a URL for an ad, and then returns no address for that ad. That effectively stops ads from being displayed.
Pi-hole also supports advanced privacy settings which work hand-in-hand with a VPN to keep your browsing information secure.
#1) Open up a console window and type:
sudo curl -sSL https://install.pi-hole.net/ | bash
#2) Confirm you have enough disk space;
#3) Setting up Pi-hole’s DNS;
#4) Change it as static ip;
#5) Setting up your network (IPv4 / IPv6);
#6) Following the IP configurations;
#7) Make sure you install the web interface. You’ll need it to manage Pi-hole after it’s installed;
The installation will begin using the settings you chose. You can watch its progress in the console, but if you’re using a stock Raspberry Pi OS build it will complete successfully.
Pi-hole will block mobile ads as soon as it’s installed, but I like to make a few changes on the web console to increase security and reliability.
#1) Start by opening the web interface and logging in. You’ll need to access it using the URL you were shown at the end of the installation. (http://ip-address/admin);
#2) Once the Pi-hole web interface is open, click the Login link;
#3) Enter the administrator password that was given to you at the end of the Pi-hole installation and click the Log in button;
#4) Now you’re able to view the full web interface and make changes. Click the Settings link to get started configuring Pi-hole.
Now it's your time to make a setting!