Turning On a Pi-holes's DHCP Server Without the Web Admin Interface

Pi-hole Sep 21, 2019

Straight to the point: From the terminal of the Pi-hole device or connected to it via SSH you just have to type:

pihole -a enabledhcp "Start IP" "End IP" "Gateway IP" "Lease time (in hours)" "Domain"

The start IP and end IP is the IP lease pool the DHCP server gives clients that connect. The gateway IP is the IP of your router. Lease time is self explanatory and the domain is a name you can give to clients that connect (I just call mine 'pihole' seeing as that's what the DHCP server runs on). For example;

pihole -a enabledhcp "" "" "" "24" "pihole"

That's all there is to it. Finding this bit of code out was not as easy as it should have been though (for me at least); the Pi-hole's documentation is pretty shit in this department. The information is there, all be it buried in source code and largely undocumented, so you either have to find out about it on a completely different website (hello) or look at the source code yourself. It's really unhelpful when the main page that tells you how to enable the DHCP server via the web admin need only have two extra lines of text to tell you how to do it manually, but it doesn't.