Raspberry Pi Pi-Hole: A Network Wide Ad-blocker

In this Raspberry Pi Pi-hole tutorial, we will be setting up a network-wide ad blocker. A network-wide ad blocker works by acting as your DNS server.

Raspberry Pi Pi-hole

What the network-wide ad blocker does is act as your DNS server. Your computers and routers will connect to it for DNS requests.

These DNS requests will then be filtered by the Raspberry Pi. Any DNS requests that match any that match a known ad host will be rejected meaning the connection will never meet your computer. Therefore the ad will never be loaded by the devices.

Network-wide ad blocking is a useful tool for stopping ads from appearing on devices that don’t have any easy to use adblock tool. It’s also a handy way to improve your network performance and bandwidth usage as the number of files downloaded during normal web browsing will be reduced.

It also has the added side effect of potentially improving the security and the privacy of your network, as some sites use relatively dodgy ad providers.

You can install the Pi-hole on other operating systems other than Raspbian. They have support for Ubuntu, Debian, Fedora, and CentOS 7 (Non-ARM).

If you decide to use the network-wide adblocker, please consider purchasing our Ultimate Books of Pi to help support the site and allow us to continually grow.

Equipment List

Below are all the pieces of equipment that I made use of for this Raspberry Pi Pi-hole tutorial.


Raspberry Pi 2 or 3

Micro SD Card

Power Supply

Ethernet Cord (Recommended) or Wifi dongle (Pi 3 has Wifi inbuilt)


Raspberry Pi Case

Installing the Network-Wide Ad Blocking Software

1. To set up our network-wide adblocker, we are going to utilize a piece of software called Pi-hole. Pi-hole is a software package that handles everything. It sets up the DNS server, handles all the DNS requests and filters them.

It also provides a fancy web frontend to the whole system, allowing you to see the statistics in real time and make changes to the Pi-hole configuration, including whitelisting or blacklisting specific URLs. The Pi-hole web server is automatically installed so you don’t need to do any extra installation.

Another advantage to utilizing Pi-hole is that it has an easy to use installer. Meaning we don’t have to mess around with trying to install and configure several different packages.

We can run this single command to download and run the install script.

While we know Pi-hole is safe, if you want to check the script that we will be running yourself, go to the Pi hole install website in your favorite web browser.

curl -sSL https://install.pi-hole.net | bash

2. Once you have run the command, it will download and run the script that begins the process of setting up your device for Pi-hole.

A few of the tasks it does is verify the amount of available free disk space, update the package list, and several other things.

Pi-hole install command

3. Once you have run this command, it will begin the setup of Pi-hole, after a few initial setup steps you will be greeted with the following install screen.

Just select ok to the next few screens to proceed.

Pi-hole Install Screen

4. The next important screen to pay attention to is the one below. This screen is warning you that Pi-hole will need a static IP address to function correctly.

Pi-hole Static IP Warning

5. Now we need to select the interface we want Pi-hole to operate over.

In our case, we are going to select wlan0 if you are going to choose a different option, use the arrow keys to move to that option and press Space to select it.

If you are happy with your selection press Enter to proceed.

Pi-hole choose network interface

6. Now we have to select the Upstream DNS provider we want to use. We are going to just stick to using Google as it is one of the most reliable DNS providers.

Press Enter when you are happy with your choice.

PiHole Choose DNS

7. Now we have to select the protocols we want to utilize. It’s usually best just to leave both options enabled.

Press Enter to continue.

Pi-hole static IP address select

8. You will now be asked if you want to use your current networks settings as a static address.

If you are happy with the information displayed then select to the next two screens continue.

Pi-hole Select Protocol

9. Here you can disable the logging abilities of Pi-hole.

However, we recommend keeping it on as it allows you to keep track of everything that Pi-hole is doing and gives you some neat statistics.

Press Enter to continue.

Pi-hole log queries

10. That is the end of everything that needs configuring, after the installation screen you will be presented with this final screen.

Make sure you write down the password displayed on the screen (1.)

Once done press Enter to continue (2.)

Pi-hole Installation Complete

Connecting your Network to the Raspberry Pi Pi-hole

There are two different methods for setting up the network-wide ad-blocker on your network.

The first of these two options is the easiest and will extend the coverage of the network-wide ad-blocker to all your devices. This option is to change your router’s DNS settings to point towards the Raspberry Pi. We recommend this for setting up the network-wide ad blocker.

The second is to set the DNS setting for each of your devices, this is more difficult to setup and something you must do every time you add a new device to your network, but can be useful if you only want specific devices running through the adblocker.

Setting Routers DNS Settings

Changing the DNS settings is different for every router, but we will go through the steps we used for our router. First, we need to go to the router’s admin page, most routers reside on the local IP address.

If you are asked for a username and password but are unsure of what it is, then try using admin for the username and admin for the password.

Once you are logged in, look for anything mentioning DNS server, or DHCP server. For my TD-W8960N router, these resided under “Advanced Setup” then under “DNS” then “DNS Server“.

Within this screen, set the primary DNS server to the IP address of your Raspberry Pi, for instance, mine is

Make sure it is the only DNS server that is set, as it handles all upstream DNS services itself, and adding alternatives could break the functionality of the ad blocker.

PiHole DNS Configuration

Setting Individual Devices DNS Settings

Below we go into detail all the steps to setting up the DNS settings on different devices and operating systems. These methods are perfect if you want to set it per device rather than setting it on your router.

Windows DNS Settings

DNS settings are specified in the TCP/IP Properties window for the selected network connection.

1. Go to the Control Panel

2. Click Network and Internet > Network and Sharing Center > Change adapter settings

3. Select the connection for which you want to configure

4. Right-click Local Area Connection > Properties

5. Select the Networking tab

6. Select Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol Version 6 (TCP/IPv6)

7. Click Properties

8. Click Advanced

9. Select the DNS tab

10. Click OK

11. Select Use the following DNS server addresses

12. Replace those addresses with the IP addresses of your Pi

13. Restart the connection you selected in Step 3

14. Repeat the procedure for additional network connections you want to change.

Linux DNS Settings

In most modern Linux distributions, DNS settings are configured through Network Manager.

1. Click System > Preferences > Network Connections

2. Select the connection for which you want to configure

3. Click Edit

4. Select the IPv4 Settings or IPv6 Settings tab

5. If the selected method is Automatic (DHCP), open the drop-down and select Automatic (DHCP) addresses only instead. If the method is set to something else, do not change it.

6. In the DNS servers field, enter your Pi’s IP address

7. Click Apply to save the change

8. Repeat the procedure for additional network connections you want to change.

9. If your distribution doesn’t use Network Manager, your DNS settings are specified in /etc/resolv.conf.

Mac OS X DNS Settings

1. Click Apple > System Preferences > Network

2. Highlight the connection for which you want to configure DNS

3. Click Advanced

4. Select the DNS tab

5. Click + to replace any listed addresses with, or add, your Pi’s IP addresses at the top of the list:

6. Click Apply > OK

iPhone DNS Settings

1. From the iPhone’s home screen, tap Settings.

2. Tap Wi-Fi. The available wireless networks in range of your iPhone should appear.

3. Find your wireless network in the list, and then tap the arrow.

4. Tap the DNS field.

5. Delete the current DNS servers, and enter your Raspberry Pi’s IP Address.

PS3 DNS Settings

1. Go to Settings

2. Go to Network Settings

3. In here then select Internet Connection Settings

4. Now we need to choose Custom

5. Set all your options until you get to the screen displaying your IP address and DNS settings.

6. Set DNS Settings to manual.

7. Now set your primary DNS to the IP address of your Raspberry Pi Pi-Hole.

PS4 DNS Settings

1. Go to Settings

2. Go to Network

3. Go to Set up Internet connection

4. Select WiFi/LAN depending on what you use to connect.

5. Select Custom

6. Set DNS Settings to Manual

7. Set the Primary DNS to the IP address of your Raspberry Pi, and make sure the secondary DNS is empty.

Wii U DNS Settings

1. From the Wii U Menu, select “System Settings.”

2. Select the Internet Icon

3. Tap Connections in the top right corner.

4. Select the connection you wish to configure.

5. Tap “Change Settings.”

6. Select Primary DNS Server

7. Tap the arrow on the right and select “DNS.”

8. Tap “Don’t Auto-Obtain” and enter the DNS info as follows:

9. Tap “Confirm” to return to the manual settings screen.

10. To save these settings, select “Save” or press the B Button, and then select “Save

Xbox 360 DNS Settings

1. In the Settings tab select System

2. Now select Network Settings

3. Choose the network you are currently using.

4. Select Configure Network

5. Highlight and select DNS Settings

6. Select Primary DNS Server

7. Select Manual.

8. Now enter the IP address of your Raspberry Pi, and then select done.

9. Repeat the procedure for additional network connections you want to change.

Xbox One DNS Settings

1. Go to the Dashboard.

2. Press the options button on the controller.

3. Go to Network.

4. Go to Advanced Settings.

5. Select Manual.

6. Enter the Primary DNS Server as the IP address of your Raspberry Pi.

7. Press B to save the new settings

8. Restart the Xbox One.

9. Repeat the procedure for additional network connections you want to change.

A Quick Look into the Pi-hole Web Interface

1. To get to The Raspberry Pi Pi-hole web interface, all we need to do is go to the following web address in your favorite web browser.

Make sure you swap out with the IP address that was displayed in the last step of the previous section.

2. You will be greeted with the following screen, at the moment this will not show any real stats as we haven’t hooked it up to anything.

For now, let’s just go straight to the Login page, you can find this by clicking “Login” in the sidebar.

Pi-hole dashboard

3. On here you need to enter the password that you got at the end of the installation of Pi-hole to log in.

Pi-hole login

4. You will now be presented with the admin dashboard. This dashboard is just like the normal one with a couple more graphs. Below we will go through all the available options.

Pi-hole admin dashboard

  • Query Log – The query log shows all the most recent queries that have been made to the DNS server. It is an easy way to find a recent address that may have been loaded and blacklist them.
  • Whitelist – This screen allows you to add certain domain names to Pi-hole’s whitelist. This whitelist means those websites will no longer be blocked by the DNS server. However, if that domain is blocked by a wildcard, then it will continue to be blocked.
  • Blacklist – This screen allows you to add certain domain names into Pi-hole’s blacklist, this means those websites will be blocked by the DNS server.
  • Disable – These options allow you to temporarily or permanently disable the blocking functionality of Pi-hole, it will continue to function as a normal DNS server while disabled but will no longer block DNS requests.


  • Update Lists -This tool allows you to trigger an update of the ad blocking lists, it is useful for ensuring you are running the latest versions of the ad block lists.
  • Query Adlists – This tool allows you to find out if a certain URL is being included in the ad blocking lists, it is useful for checking why a certain URL might be getting blocked.
  • Tail pihole.log – This tool shows the last lines of the pihole.log file and continually updates live, this is useful for checking to see what Pi-hole is doing to requests.
  • Settings – This section contains some configurable settings, this allows you to change the way your DNS works, what upstream DNS providers you want to use among several other options. You can even enable DNSSEC in the options.

For the average user, you will not need to change these options unless you made a mistake in the initial installation.

If you love your privacy, then other Pi projects might take your fancy. Something like the VPN access point is great if you want to add an option for people to hook into a VPN by simply joining a WiFi access point.

I hope this Raspberry Pi Pi-hole tutorial has helped you be successful in your set up on your Pi. If you have any thoughts, feedback or anything else then be sure to head over to the forums.

Leave a Reply

Your email address will not be published. Required fields are marked *