Pi hole hostname vs pi.hole domain

Hi all,

I have a problem to understand how Pi-hole works.

I set Pi-hole install hostname in"hostname" file to "pihole", done restart
My "hosts" file looks:

127.0.0.1 localhost pihole
::1 localhost pihole ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I can go to admin panel using IP of my pi-hole board or pi.hole/admin/ adres, but I can't use hostname: pihole/admin

Is pi.hole/admin hardcoded somewhere?
After run Update list command I found local.list file from pihole folder contains:

192.168.0.3 pihole
192.168.0.3 pi.hole

Why both? Can I use this file (local.list) to enter all ips of my network devices to proper resolve their names ie. "192.168.0.2 printer", so i can use printer instead of ip?

Nslookup from windows looks weird too:

nslookup pi.hole
Server: pihole
Address: 192.168.0.3
Name: pi.hole
Address: 192.168.0.3

nslookup pihole
Server: pihole
Address: 192.168.0.3
Name: pihole
Addresses: ::1
192.168.0.3
127.0.0.1

Last question: Should I use pi-hole as local dns on my router only or as WAN dns too?

Please, someone explain it to me :frowning:

We limit access to the web interface to a few domains (listed here) for security reasons. Since both pi.hole and doubleclick.com resolve to the Pi-hole, we need to be sure that ad domains can't be used to access the web interface. We haven't added support for the local hostname yet.

The reason that the hostname and pi.hole are in local.list is so when the Pi-hole is disabled (through the web interface or CLI) you can still resolve those two domains since they're stored separately from the ad domains.

You should use Pi-hole only for your local DNS, not WAN. WAN is what your router uses for it's own DNS lookups.

You should add your local network hostnames to /etc/hosts so they can be resolved correctly. Using Pi-hole as your DHCP server would also automatically resolve device hostnames.

Thank you very much for clarification! :slight_smile:

Do you mean, I need to write devices to hosts file AND turn on DHCP on Pi-hole? Or use only hosts file OR DHCP on Pi-hole.

Currently I have DHCP server on my asus router and I can ping pi.hole but can't ping pihole :frowning: (nslookup result in first post)

I set ips for all me devices manually on my router

Your nslookup results seem to indicate that it can reach pihole. What's the result of trying to ping it?

You can use any combination of hosts and activating DHCP. The latter would just automatically allow you to reach devices using their hostnames.

ping pihole
Ping request could not find host pihole. Please check the name and try again.

ping pi.hole
Pinging pi.hole [192.168.0.3] with 32 bytes of data:
Reply from 192.168.0.3: bytes=32 time=1ms TTL=64
Reply from 192.168.0.3: bytes=32 time=2ms TTL=64

nslookup pihole
Server: pihole
Address: 192.168.0.3

Name: pihole
Addresses: ::1
192.168.0.3
127.0.0.1

nslookup pi.hole
Server: pihole
Address: 192.168.0.3

Name: pi.hole
Address: 192.168.0.3

Try removing the line in /etc/hosts that has pihole mapped to localhost. That might be making clients think that pihole is localhost.