MOREnet Blogs

In this two-part series, I’ll walk you through the steps to turn a Raspberry Pi into an ad-blocking DNS server for your network. Many people use ad-blocking browser add-ons to reduce the amount of distracting and unnecessary information displayed on the pages visited, but this method goes further. Unlike a browser-based ad-blocker, this method will prevent ad domains from ever being contacted in the first place, saving you bandwidth and page load time. It will affect all devices that use your network, requiring no installation or configuration on those devices. You will, however, have to reconfigure the DNS settings in your router, so you will need access to it. Familiarity with basic networking concepts is assumed, but no prior knowledge of Linux is necessary.

You will need:

– Raspberry Pi model B board

– Raspberry Pi case (optional)

– Micro USB cable

– 5V 2.4A USB DC power adapter

– 8GB or larger microSD card (standard size SD card if you are using a first-generation Pi)

(all of the above can be purchased as a kit for about $60, but they are also sold individually)

– SD card reader (most laptops have this built in)

– Ethernet cable, cat 5 or cat 6

– Router with spare ethernet port

– Ability to log in to the router and change settings

– HDMI cable, HDMI-capable monitor or TV (for initial setup only)

– USB keyboard and mouse (for initial setup only)


Install the operating system:

If you purchased a kit with an SD card that already has the “NOOBS” OS installer on it, you can skip the following paragraph.

Otherwise, go to this page and download the NOOBS zip file. Format the SD card to FAT32. Copy the extracted contents of the downloaded zip file directly to the SD card. Do not put them in a folder on the card. Detailed instructions for this are included with the files.

Once this is done, set up the pi peripherals, insert the card in the slot on the underside of the board and connect the pi to your router via Ethernet. Plug in the pi. It should boot up and display a list of possible operating systems to install. This tutorial assumes you will use the first option, Raspbian. There is also a “minimal” Raspbian install option farther down the list which may be desirable for more advanced users, but I have not tested it. Select the first option and do something else while the progress bar finishes, unless you really want to stare at it for some reason. Once it’s done, reboot the pi, and it will load into Raspbian, which is a Debian-based distribution adapted for the pi’s ARM CPU architecture.

Now that the OS installation is finished, it would be a very good idea to change the password to something other than the default, particularly since the device will be used as an always-on network-attached device. Go to Raspbian’s “start button” (at the upper left by default) then “Preferences” then “Raspberry Pi Configuration.” Click the “Change Password” button at the upper right of the first tab and enter a new password.

At this point, you should have a functioning pi that could be used for general purposes. In next week’s entry, I will take you through the steps to turn it into an ad-blocker for your network.

Leave a Reply