Host Aliasing on Pi-Hole

Eric Thomas
Sep 6, 2018 · 2 min read

Pi-Hole has been an absolute blessing for me. The amount of insights it gives you on how much extra traffic is going over the wire is insane.

One thing that can be confusing is understanding who is connected to the network.

In this list, which device in my house is 192.168.0.155?

Typically, your router will dish out an IP address and keep it static based off the MAC address. The behavior can’t be guaranteed but I would expect most routers to not cycle it until they ran out of IP addresses. You can configure your router to enforce this too.

For example, I have my router configured so my pi-hole has 192.168.0.180 reserved.

So assuming that IP addresses of each of your devices won’t change. Back to the original image of the Pi-Hole interface and not understanding what device 192.168.0.155?

On your own device, run ifconfig -L | grep 192:

My output on my laptop is: inet 192.168.0.155 netmask.... Cool, now I know what this IP address is.

To change the Pi-Hole interface to reflect this, ssh into the Pi-Hole, add an entry to the /etc/hosts file (you will need to sudo for this to work), with something like this:

192.168.0.155 eric-macbook. Then restart pi-hole DNS: pihole restartdns.

Then go back to the Pi-Hole interface and observe your beautiful alias:

Huzzah!

Network Aliasing

One thing I’ve also been curious about is whether not I can alias hostnames at the network level. For example, my router is running on 192.168.0.1. I don’t want to have to remember that every time I need to log in to it. I could set an entry into my Macbook’s /etc/hosts to alias this, but what if I want to work on all my devices? Can’t the Pi-Hole do this? You betcha!

On your Pi-Hole, edit the file: /etc/pihole/local.list and add an entry for the router: 192.168.0.1 router.

Yes! No more remembering IP addresses.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade