I am running a server locally which orchestrates a bunch of things with docker and I wanted to add pi-hole to it recently. I've set it up in host_mode
for simplicity however I do also run nginx and have port forwards on my router setup to 80 -> 8000
and 443 -> 4433
respectively. Pihole is not behind nginx.
My docker compose for pihole looks like this.
pihole:
image: pihole/pihole:latest
restart: unless-stopped
network_mode: 'host'
volumes:
- ./pihole/etc/pihole:/etc/pihole
- ./pihole/etc/dnsmasq.d:/etc/dnsmasq.d
cap_add:
- NET_ADMIN
environment:
TZ: 'My/Locale'
As I am wanting to use Pi-hole for both DHCP and DNS (hence the host_mode
) I have also set my router to Enable DHCP Server Relay as this seems to be the only way to disable DHCP on my router while also having my DNS work as well. Additionally I have set up UFW rules as described here.
From a usability perspective pi-hole is running, I can see my devices connected, it's blocking ads and everything there is great. My nginx hosted services are also running as expected. An nslookup
returns the correct server pi.hole
with the relevant static IP. However I am unable to resolve http://pi.hole/admin nor am I able to hit hosts with static IP's via hostname.
For the latter I have been adding a static DHCP lease on the mac address of the server, it's static ip and setting a hostname. But ping myserver
or ssh root@myserver
doesn't seem to work (while the ip address does).
I'm assuming I have some configuration issue here that I need to address but I'm not sure where to look. My DNS is set to Allow only local requests and I have Never forward reverse lookups for private IP ranges set, but changing these seems to make no salient difference. Could this be something on server where it's basically routing my requests to http://pi.hole/admin through port 80 and back to my nginx which refuses the connection? (Though no idea why this might have an effect on host name lookup).