PiHoleHQ
Isometric gray enclosure holding a green Raspberry Pi-style board with Ethernet ports on a dotted purple pad, a Pi-hole DHCP server setup.
configuration

Pi-hole DHCP Server Setup Guide (v6, Step by Step)

Set up the Pi-hole v6 DHCP server, switch off router DHCP, add reservations, and verify leases and DNS, with a note on the Fios G3100 and E3200.

By PiHoleHQ Editorial · ·Updated · 7 min read

Give the Pi-hole host a static IP, disable DHCP on your router, then enable the DHCP server in Pi-hole v6. Set the address pool and keep the router’s LAN address as the gateway. Renew a client lease and check that Pi-hole supplied both the lease and DNS. Pi-hole post-install guide · FTL configuration reference

Should Pi-hole run DHCP on your network?

If your router can advertise Pi-hole as the DNS server for LAN clients, you can keep DHCP on the router. That setting is called DHCP option 6. Switch to Pi-hole DHCP if the router cannot advertise your chosen DNS server or you want to manage named reservations in Pi-hole. Pi-hole post-install guide · RFC 2132, section 3.8 · Pi-hole DHCP FAQ

If you use pfSense, see Pi-hole vs pfSense pfBlockerNG.

Plan the addresses

This example keeps the gateway, Pi-hole host and reserved addresses outside the dynamic pool. Use addresses from your own LAN. dnsmasq manual

SettingExample
LAN subnet192.168.1.0/24
Netmask255.255.255.0
Gateway (router)192.168.1.1
Static IP on the Pi-hole host192.168.1.53
ReservationsNAS at 192.168.1.20, printer at 192.168.1.21
Dynamic pool192.168.1.100–192.168.1.199
Lease time24h

Clients normally first try to renew with the server that issued the lease. If that server stays silent, the client later broadcasts a request that another server can answer. For an immediate check after cutover, follow the Windows release and renew steps below. Use ipconfig /all to view the adapter’s full TCP/IP configuration. RFC 2131, section 4.4.5 · Microsoft ipconfig reference

Set a static IP on the Pi-hole host

Set the IP in the host’s network configuration before switching off the router’s DHCP server. If you installed Pi-hole using the Raspberry Pi setup guide, check whether its existing address comes from a router reservation. That reservation depends on the router’s DHCP service. Pi-hole prerequisites · Pi-hole post-install guide

On a Linux host with NetworkManager, work from a local console because applying a profile can interrupt a remote session. Replace Wired connection 1 with your active profile name and DNS_IP with the address of a working DNS resolver. Use your own LAN values if they differ from the example.

List the active profiles, set manual IPv4 addressing and DNS, then open the profile editor. NetworkManager nmcli reference

nmcli connection show --active
nmcli connection modify "Wired connection 1" ipv4.method manual ipv4.addresses "192.168.1.53/24" ipv4.dns "DNS_IP"
nmcli connection edit "Wired connection 1"

At the nmcli> prompt, set the IPv4 gateway, save the profile, then exit the editor. NetworkManager nmcli editor example

Substitute your router’s LAN address for 192.168.1.1.

set ipv4.gateway 192.168.1.1
save
quit

Apply the updated profile with nmcli connection up "Wired connection 1". NetworkManager nmcli reference

If the host uses Pi-hole for DNS and Pi-hole fails, the host loses DNS resolution. Pi-hole post-install guide

Pi-hole’s DHCPv4 server uses UDP port 67. Pi-hole prerequisites

Turn off DHCP on the router

Disable the router’s LAN DHCPv4 server and leave the router itself online as the gateway. Pi-hole sets dnsmasq to authoritative DHCP mode, which assumes it is the only DHCP server on that network. Pi-hole post-install guide · FTL configuration generator · dnsmasq manual

Enable Pi-hole’s DHCP server

In Pi-hole’s web interface, open the DHCP settings page. Toggle Basic at the top right to enter Expert mode and reveal Advanced DHCP Settings. Select DHCP server enabled, enter the range, router, netmask and lease time from the table, then click Save & Apply. Pi-hole Expert mode instructions · Pi-hole DHCP screen source

The CLI equivalent sets the same values and enables the server last. FTL configuration reference

sudo pihole-FTL --config dhcp.start "192.168.1.100"
sudo pihole-FTL --config dhcp.end "192.168.1.199"
sudo pihole-FTL --config dhcp.router "192.168.1.1"
sudo pihole-FTL --config dhcp.netmask "255.255.255.0"
sudo pihole-FTL --config dhcp.leaseTime "24h"
sudo pihole-FTL --config dhcp.active true
  • dhcp.router is the default gateway clients receive. Use your router’s LAN IP.
  • dhcp.netmask can be left blank on a directly connected LAN so Pi-hole can infer the mask from its interface. For a network using a DHCP relay, set the mask explicitly.
  • dhcp.leaseTime defaults to one hour for IPv4 and one day for IPv6 when left blank.
  • dhcp.multiDNS advertises Pi-hole’s DNS address multiple times. Some clients add their own proprietary DNS servers, which can cause issues with Pi-hole. Repeating Pi-hole’s address is intended to prevent those additions.

These settings are defined in the FTL configuration reference. Leave dhcp.rapidCommit off for this setup. With it enabled, the server can complete the exchange in two messages when a client requests Rapid Commit in its DHCPDISCOVER. Networks with multiple DHCP servers have additional requirements. RFC 4039

Add reservations

In Expert mode, open Static DHCP configuration on the DHCP page. Enter each device’s MAC address and reserved IP on a separate row. Hostname and lease time are optional. Click Save & Apply. Keep each reserved address in the LAN subnet. Pi-hole DHCP screen source

The CLI command below sets the entire dhcp.hosts list. Include any existing entries you want to keep, and substitute the MAC addresses of your own devices. FTL configuration reference

sudo pihole-FTL --config dhcp.hosts '["00:20:e0:3b:13:af,192.168.1.20,nas,24h","00:20:e0:ab:cd:ef,192.168.1.21,printer,24h"]'

dhcp.ignoreUnknownClients makes Pi-hole serve only clients listed in dhcp.hosts. Devices can still assign themselves an address, so this setting provides no access control. FTL configuration reference

Renew client leases and verify

  • Windows. In a local Command Prompt, use ipconfig to find the adapter name. For an adapter configured to obtain an IP address automatically, run ipconfig /release "Ethernet", then ipconfig /renew "Ethernet", substituting your adapter name. Run ipconfig /all to inspect the full TCP/IP configuration. Microsoft ipconfig reference

    Pi-hole lists the IP address, MAC address and Expiration of each lease under Currently active DHCP leases. Pi-hole DHCP screen source Leases are given for the configured lease time. FTL configuration reference

    Find the row with the renewed adapter’s IPv4 address and MAC address. With the 24h lease time in this example, a lease granted at this renewal should expire about 24 hours after you renewed. A missing row, or one that expires well before then, does not confirm that Pi-hole granted this renewal.

  • macOS. Go to System Settings > Network, select the network service and click Details. Open TCP/IP, click Renew DHCP Lease, then click OK. Apple’s DHCP lease renewal guide

  • Linux with NetworkManager. At a local console, find the client profile using nmcli connection show --active. Run nmcli connection down "Wired connection 1", then nmcli connection up "Wired connection 1", replacing the profile name in both commands. Run nmcli device show to inspect the active device’s IPv4 details. NetworkManager nmcli reference

For this example, the client should receive a pool address or its reservation, use 192.168.1.1 as the IPv4 gateway and use 192.168.1.53 for DHCP and IPv4 DNS. Confirm the device is listed under Currently active DHCP leases. For more detail, turn on dhcp.logging. With the default log path, view the log with pihole tail. Pi-hole DHCP screen source · FTL configuration reference · Pi-hole command reference

After the NAS has leased its reserved address, check forward and reverse DNS directly against Pi-hole. This example uses lan, the default local suffix in dns.domain.name. The first lookup checks for 192.168.1.20. The second looks up the name for that address. FTL configuration reference · dnsmasq manual · BIND dig manual

dig @192.168.1.53 nas.lan +short
dig @192.168.1.53 -x 192.168.1.20 +short

If blocking still looks partial, see why Pi-hole is not blocking ads.

Pi-hole DHCP with a Verizon Fios G3100 and E3200

A G3100/E3200 owner reported repeated DHCP requests and intermittent connectivity on the extender after moving DHCP to Pi-hole. G3100/E3200 owner report on Pi-hole Userspace

What changes with IPv6 and VLANs?

The start and end addresses above define an IPv4 pool. Pi-hole’s separate Enable additional IPv6 support (SLAAC + RA) setting uses stateless DHCPv6 with router advertisements. The setting is only useful if the Pi-hole host has an IPv6 address. Clients can configure their own IPv6 addresses using SLAAC and obtain DNS details via DHCPv6. Pi-hole DHCP screen source · FTL configuration generator · dnsmasq manual

For a VLAN where Pi-hole has no interface, use a DHCP relay to forward DHCP requests to Pi-hole. Set the VLAN’s netmask in the DHCP range and its gateway in the DHCP router option. This example gives VLAN 30 its own range and tags those leases so they receive the VLAN’s gateway. RFC 2131 · dnsmasq manual

# /etc/dnsmasq.d/10-vlan30.conf
dhcp-range=set:iot,192.168.30.100,192.168.30.199,255.255.255.0,24h
dhcp-option=tag:iot,option:router,192.168.30.1

Enable misc.etc_dnsmasq_d to load the file. A malformed file can stop DNS resolution. On a systemd host, restart FTL with sudo systemctl restart pihole-FTL.service. The default LOCAL listening mode accepts DNS only from subnets where Pi-hole has an interface. FTL configuration reference · Pi-hole service restart example

How do I switch back to the router’s DHCP server?

Run sudo pihole-FTL --config dhcp.active false, then re-enable the router’s DHCP server. Renew a client lease and check that the router now supplies it. FTL configuration reference · Pi-hole post-install guide

Does Pi-hole DHCP work in Docker?

Yes. Use host networking, a macvlan network that gives the container its own LAN IP, or a bridge network with a DHCP relay. The official Compose example calls for the NET_ADMIN capability for DHCP. With bridge networking and a relay, publish UDP port 67 using the example’s 67:67/udp mapping. Pi-hole Docker DHCP guide · Official Pi-hole Compose example

Evidence note. The setup is based on the Pi-hole v6 FTL reference and web interface source. No hands-on testing was performed for this guide. FTL configuration reference · Pi-hole DHCP screen source

Sources

  1. Pi-hole post-install guide
  2. FTL configuration reference
  3. RFC 2132, section 3.8
  4. Pi-hole DHCP FAQ
  5. dnsmasq manual
  6. RFC 2131, section 4.4.5
  7. Pi-hole prerequisites
  8. NetworkManager nmcli reference
  9. NetworkManager nmcli editor example
  10. FTL configuration generator
  11. Pi-hole Expert mode instructions
  12. Pi-hole DHCP screen source
  13. RFC 4039
  14. Microsoft ipconfig reference
  15. Apple's DHCP lease renewal guide
  16. Pi-hole command reference
  17. BIND dig manual
  18. G3100/E3200 owner report on Pi-hole Userspace
  19. Pi-hole service restart example
  20. Pi-hole Docker DHCP guide
  21. Official Pi-hole Compose example

Related