Assign alias to IP numbers for easier identification


#1

It would be great to be able to assign an alias, like “Bobs Laptop” or “Fire TV” to the IP numbers that show up in the logs under /admin for easier identification and also to make it easier to see whether DNS requests make sense or not.


#2

This is already possible if you specify a recognizable host name for your devices. Even if they don’t support changing the host name, you can do it locally on your Pi-hole using /etc/hosts.


#3

This is more a feature to make the user interface more usable. It would be nice to be able to do this nice and easy within the pi-hole admin interface by clicking on an IP and having an input field that allows me to enter an alias.

I currently have host names assigned to all devices on my router. An alternative would be to allow pi-hole to pull this data from the router and let the user choose to either see the IP number, the host name or both.


#4

You can play with specifying your router’s DHCP server address as one of the DNS servers.


#5

#6

Could the uploading of the hosts file be done within the GUI?
(I’ve edited and uploaded my hosts file manually, but a GUI upload would be a nice added feature!)


#7

Such a feature would pose many security issues, which is one of the reasons we haven’t added it. We’d have to give the web interface access to change the root-owned /etc/hosts file, which might be overcome by adding the hosts instead via dnsmasq’s config files. Even then we can’t prevent a user from misconfiguring their system on accident, which would happen more often if there was an easy GUI than if they had to more fully understand what they were doing when manually making the changes. We may still add this feature in the future, but for now we have decided to work on other things.


#8

I fully agree with the decision Mcat12. It is not that hard to change the hosts file entries. Everyone can learn it very quickly…

It is like:

  1. Log on to your PI using ssh. You arrive on the command line.
  2. type ‘sudo nano /etc/hosts’ followed by enter
  3. make the required additions to the hosts file and save the file

#9

That’s a great solution for users with a single PiHole. What about users like me, with 60 PiHoles at 60 facilities across several states? Being able to establish an alias through the UI instead of SSHing in would save me about a days worth of work.

-Wutnaut


#10

Are you able to write a script to add to the hosts file? That would be even more efficient than manually going through the web interface.


#11

I think I could manage that with the reports generated by our network equipment. The problem is, I don’t want an alias for every assigned IP. I only want to alias our static IPs, “frequent fliers”, and “problem children”. I would likely need/want to remove the alias on a problem child after their behavior is remedied, and I don’t want to SSH into my PiHoles every day. I work in healthcare and the turnover is extremely high, so aliases will stale quickly.


#12

There are many ways to automate what you want without including a UI for it (and it would be more efficient without the UI anyways).

  1. Make a list of all the aliases to add/remove each day, then run a script to add/remove those entries at the end of the day and reset the list.
  2. Make a script run every time you are notified you have to add/remove an alias to add/remove that alias.

These scripts would just have to either edit /etc/hosts or use the pihole -a hostrecord command to modify the aliases. If it would save you a day’s work, then it shouldn’t be a problem to spend a few hours to make something that would save you that time.


#13

I don’t believe editing the hosts file will serve me well, I still want to know the user’s IP in addition to their alias.


#14

If you hover over the entry in Top Clients it will show the IP address. You can also easily find the IP address of the hostname by looking at the hosts file or doing a DNS request.


#15

With all do respect, aren’t we here to request that the PiHole does those kinds of things for us? Is there a technical reason that you cannot add this?


#16

It’s currently received 1 vote, we handle Feature Requests in the order of popularity. Not to repeat the often repeated, but we are 5 volunteer developers that do this on the side from our day jobs. We handle what we can, when we can, and there are other more pressing issues that we need to address. When things are stable with the code then we look at adding in features.

So it may technically be feasible, but we have a ton of other things we need to implement first, and other users that have put in requests that have been waiting for their requests to be handled first.


#17

Besides the concerns I expressed over the whole concept, we have many other things with a higher priority that we need to work on first.