DHCP App On Raspberry Pi

I have been using my router for DHCP, but have to add the DNS data manually. I have decided to install a Linux DHCP server with DNS services probably on a Raspberry Pi. (I have run Windows DHCP-DNS in the past.) Why a Pi? Well it means that it can be left running all the time with little power requirement. I can also set my router to relay if I want. (It is also a good idea to have a secondary DHCP.) Now trawling the Internet there appears to be several different DHCP apps for even the same flavour of Linux, but nobody actually does a comparison. I searched Jay’s videos but cannot find anything so maybe this would be a good video for Jay to release. In my case I will be looking for ones that can work with VLANs.

Quick question so I understand better, is it the case that your router doesn’t have an option to enable the creation of DNS entries for DHCP addresses? I’ve seen it disabled by default for some reason, but it may be possible right in your router. You’ve probably already tried looking for it. Personally, I like the DHCP/DNS server to be in the same device as the firewall, but an argument can be made to segregate it as you’ve described.

I haven’t yet done content on higher-level custom DNS and DHCP, because the majority seem to use devices for that and I was nervous that such a video would have a very limited audience. It’s definitely worth doing a video on, but I have to weigh the pro’s and the con’s.

We were using the DNS and DHCP servers on our main Synology NAS, but decided it was easier for our case (non-public domain) to have PiHole do it now. It’s real easy to set up and then it integrates nice with PiHole itself plus using ‘unbound’. IDK about V-LANs though; we don’t use them.

Docs: Post-Install - Pi-hole documentation

My router is an Zyxel VGM8924-B10A. There is DNS in it but you have to add manually for every device. Well I have never found a way to do it automatically and I looked. Even checked out the manual which is really extensive and online. In DHCP the IP address is reserved automatically against the MAC address. To me it should not be hard and when you are troubleshooting a quick look in the DNS often is the quickest way to determine the devise and it’s IP address. With DNS you can also find the device on the network by its name assuming that you know it. One of the other things is that over time the router’s dhcp accummalates loads of IP addresses some of which are off-line devices and others maybe once in a lifetime and really need to pruned but I have no idea what is what from the DHCP.

My router will not pass host names to my Pi-hole for some reason…at least not that I can figure out. I set Pi-hole to do DNS and DHCP just to make things easier to manage i.e. seeing what the kids are doing, blocking the television from phoning home etc. without having to look up ip addresses. I am running it on a Pi Zero W connected via Ethernet dongle and it seems to work ok. The server load is well within a respectable range, but I still get a webpage I have to refresh to load on occasion. I may try setting up the Pi-hole on my Raspberry Pi 3 to see if it is more performant and use the Pi Zero as backup at some point.

1 Like

You could try also running Unbound (instructions are on the Pi-Hole website), which is a caching DNS server that Pi-Hole can couple with. It works pretty nice. The other thing is if your Pi-Hole is forwarding DNS requests to your router, which forwards to your ISP, you could have performance issues there sometimes.

1 Like

I don’t know what router you have but some you can set up as a relay of another DHCP whilst others you can disable DHCP completely. There should only be one authoritative DHCP on a network, I am ignoring subnets, etc for the time being. However you can have relays and secondary to speed up access and the latter can also be set to take over the authoritative function if the original goes off-line for any reason. It is highly likely that it is not built into the router if a domestic type to pass data on. (When it comes to DNS only a few Domestic ones can handle that.)

When it comes to Pi-Hole Buffy knows more about that than I do, but putting on my old Windows commercial network cap I would have just the DHCP and DNS set up on a separate server and take away that function from the router. Then reserve the IP and MAC address of the router in the DHCP/DNS server and of course the gateway, etc to the outside world. The one downside to this from a home lab perspective is that you need to have that DHCP/DNS server running all the time however I do not see that as too big a problem and if running on something like a Pi would only be small with relevance to power consumption. (You will need to set it to automatically come back on-line after something like a power cut. Even if on a UPS there is a limit. I used to set our UPSes to power down the relevant server 10 minutes after a power cut and then they would automatically power up when the power came back. Data centres need to be on-line even during a long outage so handle it differently but that is costly.) ) You will probably need to set up DNS lookups to initially go to your local DNS and if not there to go to an external DNS server whether that be your ISP, Google, Cloudfare, etc. From what I have read of Pi-Hole can do that but Buffy can tell you more I am sure.

That is how my Pi-hole is set up. If it does not find the DNS in the blacklist (or presumably a cache) it forwards it on to Google.

DHCPd yeah isnt that a broadcast or udp and then its kicked back. I dont really remember but sure why not use a pi for that instead of using your DDwrt or linksys standard allows mac address mapping to add static private addressing on your network. I really dont understand the question. Id use apt to do a search for the standard dhcpd daemon and then do a find etc for a dhcp as per the conf filing.