- Hide menu

Showing hostnames in Pihole with IPv6 enabled

One of the features of Pihole is its ability to show a query log of which device made a query to a particular domain. This works fine on an IPv4 network. But when IPv6 is enabled, and the Pihole is used for DNS resolution the query logs have entries with unhelpful hostnames. This arises because Pihole doesn’t issue the IPv6 address for the device and the name it shows is the reverse DNS entry for the address. There are ugly workarounds. This article proposes a few, and there’s a script here, but none are really turnkey solutions. The problem is shown in the screenshot below.

 

My solution is to block all DNS requests on the IPv6 network from my clients to the Pihole. This forces the clients to use IPv4 which is logged by the Pihole and the request is shown against the IPv4 hostname. This requires the Pihole to be the DHCP server for the IPv4 addresses.

This is what the Pihole’s DHCP screen looks like.

 

One anomaly I encountered in my setup is I could not block DNS requests if the Pihole was on the same VLAN as my client devices. As you can see from the screenshot, the clients are on the 10.0.0.0 network The firewall on the Unifi Dream Machine does seem to be able to do this. So my workaround is to move the Pihole on to another VLAN, eg 192.168.11.0, which the firewall is able to block. So the Ethernet port of the Pi is set on the 192 VLAN and the Wireless LAN is on the same 10.0.0.0 VLAN as my clients, handing out DHCP addresses. Voila. Hostnames are back on a fully functioning IPv6 network.