notes/docs/home-network/services/pi-hole-dns-server.md

2.1 KiB

Pi-hole DNS server

DNS server that supports DNS-based domain blocking.

Host: 192.168.1.105 (raspberrypi)

Port: 53

Upstream DNS server: 192.168.0.1 (i.e. ISP DNS)

Admin interface

URL using IP address: http://192.168.0.105:8080/admin/

URL using domain: http://pi.hole/admin/ (Request is routed through reverse proxy running on raspberrypi.)

Local DNS

Local network domains use .home instead of .local because .local collides with device's built-in systems for resolving .local domains automagically.

A records

.home A records map machine domain names to their IP address.

Domain IP Address Comment
raspberrypi.home 192.168.0.105 raspberrypi
homeoffice.home 192.168.0.108 homeoffice

CNAME records

.home CNAME records map service domain names to their machine's domain name.

Domain Target
jellyfin.home raspberrypi.local
notes.home raspberrypi.local

Groups

Default

Emma

  • Emma's phone.
  • No adlist?
  • Whitelisted Google ad services anyway.

Debugging DNS (from homeoffice)

Server health check

Check Pi-hole's status:

ssh raspberrypi
pihole status

Client health check

Confirm that the network interface controller is using the expected DNS server:

# List interfaces to find ethernet or wi-fi controller.
nmcli | grep ": connected to"

# Show the DNS servers used by the controller.
nmcli device show <interface> | grep DNS

Restart the name resolution service:

sudo systemctl restart systemd-resolved

How Linux machines choose a DNS server

When using DHCP

DNS servers are determined by /etc/dhcpcd.conf:

# Get the DNS servers list from the DHCP server, which is usually on the router.
option domain_name_servers

# Or, set a list of DNS servers explicitly.
# e.g.
# - 1.1.1.1      Cloudflare
# - 192.168.0.1  LAN Router
static domain_name_servers=1.1.1.1,192.168.0.1