Configuring DHCP services (revision 2)

Introduction

This page describes how Alexis Huxley installed and configured his DHCP server.

Procedure

  1. Install the packages required for the DNS server by running:
    apt-get install isc-dhcp-server
  2. Edit /etc/default/isc-dhcp-server and set:
    INTERFACESv4="eth0"

    (Without this dhcpd will start but the IPv4 server and the IPv6 server.)

  3. Edit /etc/dhcp/dhcpd.conf to contain something like:
    ddns-update-style none;
    authoritative;
    log-facility local7;
    
    subnet 192.168.1.0 netmask 255.255.255.0 {
        option domain-name "pasta.net";
        option domain-name-servers 192.168.1.21;
        option ntp-servers time.pasta.net;
        option routers 192.168.1.1;
    
        #  I reserve 192.168.1.101-120 for *known* hosts booting from DHCP. which I list below.
        pool {
            range 192.168.1.151 192.168.1.160;
            allow unknown-clients;
            deny known-clients;
        }
    }
    
    #  Host declarations 
    #host examplehost          { hardware ethernet aa:bb:cc:dd:ee:ff; fixed-address examplehost.pasta.net;  }
    
    
  4. The dhcp server might have a problem with leaving locks and failing to detect if they are stale or not (this was my experience with version 4.4.1). Therefore run:
    pkill dhcpd
    rm -f /var/run/dhcpd.pid
  5. Start dhcpd with:
    systemctl start isc-dhcp-server
  6. Test!

See also