Conditional Forwarding stopped working after Flush Network table and restart

So, I'm on newest version, I noticed the Pihole is showing wrong hostname (show my phone was active when I was away - different IP suddenly got the same hostname), so I tried to Flush network table once, then saw it was still wrong, then I do it one more time, also Restart DNS resolver and restart the pi. After that, hostname stop showing up no matter what I do afterward. :frowning:

Tried everything from flush, check/uncheck the Conditional Forwarding option again, even reset the pi with pihole -r , but nothing seems to work, it still showing IP without hostname for some reason.

REV_SERVER variables all are enable in the conf file, tried ping my-phone.local from pihole works fine. I notice I was having the flag CONDITIONAL_FORWARDING=false before reset though. Another thing that I notice is that most of the local PTR request forward correctly to the router ip but return N/A, not sure if is expected (after some more google search then it seems that it should be returning DOMAIN reply instead...probably something wrong here).

Here is dig if it can help debugging:

dig -x 192.168.0.101 @192.168.0.1

; <<>> DiG 9.11.5-P4-5.1+deb10u3-Raspbian <<>> -x 192.168.0.101 @192.168.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 17789
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;101.0.168.192.in-addr.arpa.	IN	PTR

;; Query time: 27 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Fri Mar 12 14:28:05 +07 2021
;; MSG SIZE  rcvd: 55
dig -x 192.168.0.101 @127.0.0.1

; <<>> DiG 9.11.5-P4-5.1+deb10u3-Raspbian <<>> -x 192.168.0.101 @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 6563
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;101.0.168.192.in-addr.arpa.	IN	PTR

;; Query time: 27 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Mar 12 14:26:31 +07 2021
;; MSG SIZE  rcvd: 55

*Edit: Fing app seems to works fine and can resolve hostname, but tried with nslookup and dig both can't seems to able to do the same...

Debug Token:

9msi0uesdn

Many thanks!

NXDOMAIN answers as received by your dig commands mean that both 192.168.0.1 (presumably your router?) as well as your localhost (presumably Pi-hole?) do not know a hostname for 192.168.0.101.

That may indicate that your router's DHCP server isn't registering any DNS records for its client's hostnames with its own DNS. If your router would return NXDOMAIN for other IP addresses as well, there would be no point in enabling Conditional Forwarding in Pi-hole in your case.

You'd have to define local hostnames in Pi-hole then, e.g. by adding respective Local DNS Records.

In addition, your debug log shows your router to be using "www.tendawifi.com" as local domain name, but you are forwarding requests for "local". In general, your CF domain should always match your router's.

In your case, your router's domain seems wrong somehow (as it's a public domain name).
You should change that in your router.

Don't pick local either, though - that domain is used by the mDNS protocol and shouldn't be used for DNS.

Thank you so much for your help, I'm not really expert in networking so not really understand the second paragraph, but I guess what you meant is that the router doesn't really reply correctly in my case, and it does reply the same NXDOMAIN for all the other ips. I'll have to resort to use pihole as DHCP server then I suppose.

I guess the pihole got the hostname before I move the DHCP from the modem to the router, then keeping it from there until now so that explain the wrong hostname too.

The www.tendawifi.com is the search domain assigned automatically by the router, and is unable to change. I can use that to access the router instead of 192.168.0.1. I'll try to use the search domain above instead of local to try if It can resolve, but I doubt it's possible.

When a client requests a DHCP lease from a DHCP server, it may provide a hostname for itself. A DHCP server may then register appropriate DNS records for that hostname with its own DNS server.
While that's common with most, not every DHCP server does that.

If your router would use such a non-registering variant, it may still show the names in its UI, to facilitate device management, but it wouldn't be able to answer DNS requests as expected - just as your dig has demonstrated.

Now, you can't be sure that your router's DHCP falls in that category from just one dig result (hence my remark "If your router would return NXDOMAIN for other IP addresses as well...").
You'd have to consult your router's support for this (as I don't think its documentation will advertise a lack of features), or you verify it yourself by dig-ing a bit further. :wink:

Ah, that additional information could explain your issue.
It should have been in your initial description

If you've two DHCP servers on your network, your client may request DHCP leases through either of them.
So at one time, a client may end up with an IP and no hostname when registering with your router's, and with a different IP and maybe a name when doing so with your modem's DHCP server at another.

And if different IP addresses are handed out, that would surely confuse Pi-hole trying to determine a hostname for an IP address in the way you have described.

Ideally, only one DHCP server should be active, on your device of choice, and disabled on all others.
If you cannot disable it, try to decrease the size of its DHCP pool to accomodate just the necessary IP for Pi-hole.

Then reconnect or restart all your devices to ensure each of them acquires a new DHCP lease through the correct DHCP server.

Thanks!

I tried dig with other devices but still having same result, my router can show the name in it's UI just fine, just like you said. Still, I'm unsure if using pihole as DHCP server can cause any performance issue.

I don't have 2 DHCP in my network but before I was using the main modem as DHCP (with pihole it works fine!) then I bought the Tenda router and move all cable to it and use it as DHCP in different subnet then issue start to happen.

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