Extra DHCP Server Options


#1

I use Pi-hole on my rpi3 to serve DHCP for multiple networks. I have these networks:

MGMT - vlan 1 - 192.168.0.0/24
LAN - vlan 10 - 192.168.1.0/24
GUEST - vlan 20 - 192.168.2.0/24
DMZ - vlan 30 - 192.168.3.0/24
DNS - vlan 40 - 192.168.4.0/24 (this is where Pi-hole is)

I have a DHCP relay agent on my router which forwards DHCP requests from VLANs 1, 10, 20, and 30 over to the Pi-hole in VLAN40. This works perfectly. I also have a /etc/dnsmasq.d/dnsmasq.conf file that has the relevant DHCP scopes and static DHCP leases defined. This works fine also.

What doesn’t work is any of the DHCP functionality in the Pi-hole GUI. I’d love to be able to tweak / configure the DHCP scopes and static leases from the GUI but there’s several things preventing me from doing so:

  1. When enabling the DHCP server on Pi-hole (in general) it fails to specify the subnet mask. This causes dnsmasq to default to classful (class a, b, c) subnet masks. This breaks things, badly, because it gives out /16 subnet masks for 192.168.x.x addresses. This isn’t a problem for most small networks where there’s only one subnet, but it completely breaks when multiple vlans are in play. Pi-hole should, at the very least, default to a sane value (/24), and provide an option in the GUI to adjust this.

  2. Pi-hole GUI only supports one DHCP scope. It’d be great to have an option to define multiple scopes, with different gateways.

Thanks!


#2

I do the same thing, and while configuring it in dnsmasq.conf was simple, a tear leaks from my right eye every time I view the dhcp portion of the GUI. It would definitely be nice to allow multiple VLANs on the gui itself.


#3

You can quasi-use the GUI if you’re ok with manually editing the settings.php file. Details:

In “/var/www/html/admin/settings.php”, on line 473, change “if ($DHCP) {” to “if (true) {”. This will enable the leases section of the DHCP GUI. Then, put your static DHCP entries, if you have any, in:

/etc/dnsmasq.d/04-pihole-static-dhcp.conf

Then, store your dhcp.lease file in /etc/pihole/dhcp.leases. I use this line in my dnsmasq.conf file:
dhcp-leasefile=/etc/pihole/dhcp.leases

This will allow you to see any static reservations you have configured, and, it will also display the current leases.


#4

@networknerd Can you post an example of your /etc/dnsmasq.d/dnsmasq.conf file? I am trying to get this going to my network as well.

vlan 10/lan: 10.10.1.0/24
vlan 20/wlan: 10.10.2.0/24
vlan 30/iot: 10.10.3.0/24