Adding a DHCP server

Next step in this master plan is to add a DHCP server to the PI that is running my DNS server and NTP server.   Doing this step means that the DNS server on my PI will become the goto DNS server for my entire network.  At the moment, the default is (my router) for my lan computers and (by DHCP/DNS/NTP server) for my VPN.  This is inconsistent and means that I cannot use my DNS names for computers on my LAN – which could be confusing.  By switching my DHCP over to my PI, I can get full control of the DNS part and have that routed first to my PI, then on to the internet.

Before I break anything, first things first.  Backup my PI!  Only need to do the DNS Server this time as all the configuration will be done on that and on my Router (Turning off DHCP once everything is working properly)

For this project I’m going to be using this post as a reference guide.

aptget -y install iscdhcpserver


There is a section in the post about editing resolv.conf this lets you add more name servers to try when looking things up.

nano /etc/resolv.conf

My resolve file looks like this

# Generated by resolvconf


I’m adding these two entries to the file.




This should ensure that the host list is set properly.  Not sure if it is really needed though.


I’m going to see if I can do this upgrade without modifying this file.  If I have too modify it I’ll add something like this…

nameserver //Router which handles DNS
nameserver //Google DNS server
As I say, I might be able to skip that part.  We’ll see.
nano /etc/default/iscdhcpserver

Find this section, it should be at the bottom of the file.

Change the INTERFACES=”” to the interface you want the DHCP service to send requests, the Raspberry Pi only has one interface so this is Eth0.



Now we need to edit the actual DHCP configuration file. Edit the following:

nano /etc/dhcp/dhcpd.conf


Most of the file is commented out and contains helpful examples, find the following:

# option definitions common to all supported networks…
option domain-name “”;
option domain-name-servers,;


and change it too

 # option definitions common to all supported networks…
option domain-name “”;
option domain-name-servers;

This Raspberry pi will be acting as the DHCP server in my home LAN. I therefore needed to un-comment the authoritative line.

This section will configure the addresses handed out, the gateway to give to the clients and the DNS servers to give to clients etc.

subnet netmask {
        option routers        ;
        option subnet-mask    ;
        option broadcast-address;
        option domain-name-servers;
        option ntp-servers    ;
#        option netbios-name-servers;
#        option netbios-node-type 2;
        default-lease-time 600;
        max-lease-time 7200;
This will let the DHCP server assign ip addresses in the range of, it will also instruct everything to use the DNS server in the PI, as well as the NTP server in the PI as well.

Configure Fixed IP’s for clients

Further down the configuration file should be a section for adding fixed IP Addresses. Find something similar to this example:

If any of the machines listed above with those MAC addresses then they will get the given fixed IP Address. These are addresses are excluded from the range of addresses handed out by the DHCP server (See above configuration).

Let’s enable the DHCP server with

systemctl enable isc-dhcp-server


and let’s start it with

systemctl start isc-dhcp-server


I’ve come across a problem that my Bind9 and isc-dhcp-server servers struggle to start when I boot my PI.  This is going to be a problem for the device that is supposed to be looking after my network.   For now, I’ve fixed it as follows.


Choose option 4 – Wait for Network as Boot

Then choose

Slow Wait for network connection before completing boot


Doing this seems to fix the problem, however, it would like to come up with a solution that will work with a fast boot – this will be a job for later.

Leave a Reply

Your email address will not be published. Required fields are marked *