Setup Pi-hole on Raspberry Pi connected to D-Link DIR-850L router

kyw
5 min readApr 11, 2019

--

This post will address hiccups I encountered when making Pi-hole to work with my DIR-850L router

Shameful plug: Iā€™m building a Markdown editor. Check it out.

First image of black hole (credit)

Pi-hole blocks unwanted content(e.g. advertisements) for all devices that are connected to your home network without further intervention such as installing any client-side ad-blocking software šŸ—½.

I decided to put things aside and get this up and running because I figured this will pay dividends the moment you did ā€” for yourself, the non tech-savvy family members and other people.

Before we start, note that you would probably still want to keep your ad-blocker on your browser for good measure.

OK letā€™s do it! šŸš€

One very popular way to install Pi-hole is with a Raspberry-Pi.

Itā€™s recommended to just buy a whole package that gives you all the essential parts to get you started. This is the one I got:

Once you got that, itā€™s time to get real šŸ˜ 

Step 1: Get the Raspbian Lite image onto your microSD card and enable SSH access

This step can be easily accomplished by following the ā€˜Step-1ā€™ of the guide below(we will refer to this guide often). Once you completed the Step-1 there, we will continue with Step-2 back in here.

Step 2 : Hook it up

Plug the following items to their corresponding ports on your RPi board:

  1. HDMI cable(comes with the package)
  2. USB keyboard
  3. RPiā€™s micro-USB power cable

Then plug the other end of the HDMI cable to your monitor or TV.

Select the right HDMI channel on your screen.

Then power everything on.

Now you will see your RPi booting up on the screen.

Once itā€™s booted, we are going to enable its WiFi so we will be able to install Pi-hole from the internet later.

Step 3: Enable WiFi on your RPi

The quickest way to do that is sudo raspi-config :

Type ā€˜sudo raspi-config' and enter

Then you will see this:

For the uninitiated, navigate the menu with arrow keys, tabs, and Enter.

And do the following:

Under ā€œLocalisation Options,ā€ select ā€œChange Wi-fi Country.ā€

Then, under ā€œNetwork Options,ā€ select ā€œWi-fiā€ to enter the SSID/password for your wireless network.

(source)

And you are done! šŸ§

The following are optional, but strongly recommended:

Change User Password (because everybody knows the default). Or just type passwd in the command prompt.

Under ā€œLocalisation Options,ā€ select ā€œChange Locale,ā€ ā€œChange Timezoneā€ to suit your location.

Network Optionsā†’Change Hostname. I named mine ā€œpiologyā€ to distinguish it from other Raspberry Pi systems on the network.

Interfacing Optionsā†’Enable SSH. This allows remote login from another system on the network, for performing administration tasks without a display attached.

(source)

Step 4: Install Pi-hole on your RPi

Staying on your command prompt with your RPi still hooked up to the screen, now you can run the Pi-hole install command:

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

Like this^

Then follow the ā€˜Step 4: Run the Pi-hole installerā€™ from the guide below(skip to Point-2):

Step 5: Connect your RPi to your router with an Ethernet cable

Pi-hole installation on your RPi is now completed. So letā€™s unplug everything.

Now take an Ethernet cable and plug it into the RJ45 port on your RPi, and connect the other end to one of your routerā€™s LAN ports.

Now if you login to your router, you will see that a client is connected with a static IP address that was set for your RPi during the last installation step!

Step 6: Network-wide Ad blocking and making it work with DIR 850L

We will finish off by continuing with the ā€˜Step 5ā€™ of our companion guide.

However, if your router was D-link DIR 850L and you took the ā€˜blue pillā€™, chances are your RPi wouldnā€™t have internet access! šŸ˜‘

This issue with this particular router model was well documented in this threadā€™s comment which thankfully illuminated a solution that resembles the ā€˜red pillā€™!

So go ahead and take the ā€˜red pillā€™. šŸ‘¤

Or you can refer to the steps laid out in my comment here. āœŠ

Customizing your Pi-hole

The world is your oyster now that you have got a proper Pi-hole installed on your RPi with internet access! šŸŒˆ

Here is a good place to start.

Protect your SD card

Pi-holeā€™s query logging can shorten your SD cardā€™s lifespan. Here are some suggestions to mitigate that:

  1. Get a SD card with much bigger capacity than necessary(e.g. 32GB) so that its memory blocks are written much sparingly.
  2. Consider ā€˜Disable query loggingā€™ in pi.holeā€™s Settings -> System.
  3. Increase privacy level in Settings -> Privacy.
  4. Constraint how Pi-hole writes to the ā€˜long-term databaseā€™:
In your RPi's terminal, run: sudo nano /etc/pihole/pihole-FTL.confThen, add these two lines in the file:
DBINTERVAL=60
MAXDBDAYS=7
(Note: Set MAXDBDAYS=0 to completely disable it)Then ctrl+o to save, and ctrl+x to exit the nano editor.Finally, run sudo service pihole-FTL restart (source)

OK thatā€™s all I got. šŸ‘‹

ā€œUntitledā€ by Kheoh Yee Wei

--

--