DHCP
The protocol that hands every device its IP address, its gateway and, crucially for Pi-hole, which DNS server to use.
#What it is
When a phone joins your Wi-Fi, it has no address. It shouts a broadcast to the whole network (Discover), the DHCP server answers (Offer), the phone asks for it (Request), and the server confirms (Acknowledge). Along with an IP address, the phone is told the gateway (your router), the subnet, and which DNS server to use. The address is a lease, renewed periodically.
On most home networks, the router is the DHCP server.
#Why it matters for Pi-hole
That last item, the DNS server, is how Pi-hole gets to cover every device without touching any of them. Change the DNS server the router hands out to the Pi's address, and as leases renew, every device starts using Pi-hole.
#Things that matter in practice
- Keep the Pi out of the pool. A static IP inside the router's DHCP range will eventually be handed to another device. Shrink the pool, or add a reservation for the Pi's MAC address.
- Don't confuse it with static routes. Those are for reaching other subnets, and a home Pi-hole doesn't need one.
- Renewing is safe; releasing remotely isn't.
ipconfig /releaseover a remote session cuts you off. - IPv6 has its own channel. Routers can advertise a DNS server over IPv6 router advertisements (RDNSS) or DHCPv6, independently of IPv4 DHCP. If
ipconfig /allshows an extra IPv6 DNS server, devices may prefer it and skip Pi-hole entirely.
#When the router won't let you change DNS
The textbook fix is to switch the router's DHCP off and let Pi-hole's built-in DHCP server take over. Prove broadcasts reach the Pi first. My old ISP router's Wi-Fi side never passed DHCP broadcasts through to the wired Pi, and the whole house dropped off as leases expired. With the router still in charge, run this and reconnect a Wi-Fi device:
sudo tcpdump -ni eth0 'port 67 or port 68'If you see its DHCP Discover, you're safe to cut over. If you see nothing, don't. See tcpdump.