unifi-utilities / unifios-utilities

A collection of enhancements for UnifiOS based devices
GNU General Public License v3.0
3.9k stars 419 forks source link

Pi-hole not showing 'hardware address' and 'Hostname' [UDM Pro 3.x, nspawn-container] #548

Closed shaft8472 closed 1 year ago

shaft8472 commented 1 year ago

Describe the bug I am running Pi-hole in a nspawn-container on my UDM Pro running 3.0.20. In Pi-hole's network overview I cannot see the hardware addresses or the hostnames and therefore the dashboard will only show IP addresses and not hostnames.

To Reproduce Steps to reproduce the behavior:

  1. Install an nspawn-container using an isolated MacVLAN network (Followed this guide: https://github.com/unifi-utilities/unifios-utilities/tree/main/nspawn-container#step-2a-configure-the-container-to-use-an-isolated-macvlan-network)
  2. Install Pi-hole (followed this guide: https://github.com/unifi-utilities/unifios-utilities/blob/main/nspawn-container/examples/pihole/README.md)
  3. DNS settings page of Pi-hole contains data needed, will explain below and see screenshots further down:

My internal networks are: 192.168.199.0/28 192.168.200.0/24 192.168.201.0/24 192.168.202.0/24 192.168.203.0/24 192.168.205.100/24 (Pi-hole's)

UDM Pro is running on 192.168.200.100

Therefore I have set the following conditional forward settings: 192.168.0.0/16 to cover all the above IP ranges under 'Local network in CIDR notation' 192.168.200.100 under IP address of your DHCP server (router) (I've also tried 192.168.205.100 but it does not make a difference.)

Expected behavior I want to see the hostnames in the dashboard overview.

Screenshots: pi-hole-network pi-hole-DNS1 pi-hole-DNS2

UDM Information

Additional context Before I was running firmware 1.x and had Pi-hole running in a podman container, also with a MacVLAN. That configuration was largely the same so I copied most of the data I had from my original configuration files. In that setup my Pi-hole was able to see hardware addresses and hostnames.

chriscpritchard commented 1 year ago

add

# Make DNSMasq listen to the container network for split horizon or conditional forwarding
if ! grep -qxF "interface=br${VLAN}.mac" /run/dnsmasq.conf.d/custom.conf; then
  echo "interface=br${VLAN}.mac" >>/run/dnsmasq.conf.d/custom.conf
  kill -9 "$(cat /run/dnsmasq.pid)"
fi

to the bottom of your on-boot.d script that sets up networking and reboot (or run the lines as a shell script seperately). By default the udm dns doesn't listen for DNS requests on the container network.

shaft8472 commented 1 year ago

Thankyou for this!

Worked like a charm. :-)