DNS Hostname not Resolving

2021-06-05T23:00:00Z

Expected Behaviour:

When viewing the dashboard of my PiHole, specifically but not only, the Top Clients section displays every client's IP address. I want to see their hostname on the network so they are more identifiable.

Details:

  • macOS 11.4
  • Safari version 14.1.1 (16611.2.7.1.4)
  • Pi-hole v5.3.1
  • Web Interface v5.5
  • FTL v5.8.1
  • TP-Link AX3000 double band WiFi 6 Router

Actual Behaviour:

Steps I have taken:

My PiHole is only handing DNS queries, not DHCP. My router's primary and secondary DNS server is my PiHole's IP address. I am seeing results for number of queries and number of devices and such correctly. Only the names are not resolved in these tables.

One thing I did change was in file /etc/dhcpcd.conf:

interface wlan0
        static ip_address=192.168.0.2/23 # PiHole's address
        static routers=192.168.0.1 # Router's IP address
        static domain_name_servers=1.1.1.1 1.0.0.1 # Backup Cloudflare DNS

I have enabled Conditional Forwarding on my PiHole, unchecked Never forward non-FQDNs and Never forward reverse lookups for private IP ranges. For the three fields in Conditional Forwarding, I put in my CIDR block as /24 even though mine in /23. The IP address of my router and left the local domain name blank as I can not determine mine. I have added a single IPv4 Upstream DNS Server (top of the Settings > DNS page) that points to my router.

Debug Token:

https://tricorder.pi-hole.net/3wnopji164

There are several discrepancies where your expected or claimed configuration does not match your debug log information.

Your debug log shows that 192.168.0.2 is your RPi's IPv4 address:

*** [ DIAGNOSING ]: Networking
[✓] IPv4 address(es) bound to the wlan0 interface:
   192.168.0.2/23 does not match the IP found in /etc/pihole/setupVars.conf

But Pi-hole is configured for 192.168.0.137 instead:

*** [ DIAGNOSING ]: Setup variables
    PIHOLE_INTERFACE=wlan0
    IPV4_ADDRESS=192.168.0.137/24
(...)
    PIHOLE_DNS_1=9.9.9.9
    PIHOLE_DNS_2=149.112.112.112
    PIHOLE_DNS_3=1.1.1.1
    PIHOLE_DNS_4=1.0.0.1
    PIHOLE_DNS_5=192.168.0.1

This also seems to be the IPv4 that your router would hand out to your RPi:

*** [ DIAGNOSING ]: Discovering active DHCP servers (takes 10 seconds)
   Scanning all your interfaces for DHCP servers
   
   * Received 300 bytes from wlan0:192.168.0.1
     Offered IP address: 192.168.0.137
     Server IP address: 192.168.0.1
     DHCP options:
      Message type: DHCPOFFER (2)
      server-identifier: 192.168.0.1
      netmask: 255.255.255.0
      dns-server: 192.168.0.2
      dns-server: 1.1.1.1
      router: 192.168.0.1
      --- end of options ---

You'd have to align Pi-hole's configuration with its IP address, either by changing or removing your wlan0 configuration lines from your RPi's dhcpcd.conf or by running pihole -r with Reconfigure.

In addition, your router distributes an alternate DNS server in addition to Pi-hole.
This contradicts:

This will allow clients to bypass Pi-hole via 1.1.1.1.
Pi-hole has to be your network's only DNS server to avoid that.

Your router is also distributing a netmask of 255.255.255.0, which is a /24 in CIDR notation.
This contradicts:

And you have configured five upstream DNS servers for Pi-hole.
This contradicts:

If you indeed were using your router as Pi-hole's only upstream DNS, there would be no reason to enable Conditional Forwarding, as your router would already see all DNS requests anyway.

This may be the better approach in your case, as you do not seem to know your router's search domain, which may leave certain DNS requests for local names unresolved if using CF.

But neither using your router as Pi-hole's sole upstream nor enabling CF won't help with your issue if your router wouldn't be able to answer DNS requests for local hostnames at all.

Let's see if your router falls into that category.
The following statement should return the hostnames for 192.168.0.217 as known by your router at 192.168.0.1:

nslookup 192.168.0.217 192.168.0.1

You may also try that for other client IPv4 addresses in your network.

If none returns any names, you could define them using Pi-hole's Local DNS Records.

HI @Bucking_Horn,

Thank so much for your help and guidance in this. I have had a colleague of mine help who works in networking as I'm just in software, so bit of a self learning newbie.

So I edited the /etc/pihole/setupVars.conf file to now have the correct static IP of the PiHole (192.168.0.2). So to confirm I will remove the wlan0 bits I added in my /etc/dhcpcd.conf file?

As for NSLookup, none of them return anything. What they return is this:

As for my 5 DNS servers: I configured my PiHole to use the Quad9 as per the config I did when I first setup PiHole, and I just unchecked the 2 for Cloudflare. Are you saying that I should uncheck all the boxes here to get that back down to one as it seems you suggest, it should be?

I will have to find a guide as for using DNS records. I have dynamically assigned IPs and don't want to statically or reserve IPs.

New Debug Log:
https://tricorder.pi-hole.net/v8qndcvbpz

New Debug log:
https://tricorder.pi-hole.net/v8qndcvbpz

Why did you do that?
You should not edit setupVars.conf manually.

My advice was:


No.
If your router is your DHCP server, DNS requests for local hostnames have to be passed on to your router, either by enabling CF or by using your router as Pi-hole's only upstream.

But as your nslookup results suggest that your router does not provide DNS resolution for its DHCP clients anyway, there is no use in passing DNS requests for local names to it.
Use whatever public DNS servers you prefer as Pi-hole's upstreams.

As for local hostnames:

Ran configure on it and got this :slight_smile:
https://tricorder.pi-hole.net/qnvsyomy2m

Your IPv4 address seems correct now:

*** [ DIAGNOSING ]: Networking
[✓] IPv4 address(es) bound to the wlan0 interface:
   192.168.0.2/23 matches the IP found in /etc/pihole/setupVars.conf
*** [ DIAGNOSING ]: Name resolution (IPv4) using a random blocked domain and a known ad-serving domain
[✓] lock.omkarfatale.in is 0.0.0.0 via localhost (127.0.0.1)
[✓] lock.omkarfatale.in is 0.0.0.0 via Pi-hole (192.168.0.2)
[✓] doubleclick.com is 74.125.193.100 via a remote, public DNS server (8.8.8.8)

Also, your router is now correctly distributing only Pi-hole as local DNS server:

*** [ DIAGNOSING ]: Discovering active DHCP servers (takes 10 seconds)
   Scanning all your interfaces for DHCP servers
   
   * Received 300 bytes from wlan0:192.168.0.1
     DHCP options:
      Message type: DHCPOFFER (2)
      dns-server: 192.168.0.2
      dns-server: 192.168.0.2

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.