Linux Ubuntu Server DHCP

1. Source

2. Install

  1. Update package index and Install

    sudo apt update -y && sudo apt install isc-dhcp-server -y

3. Configure

  1. Assign the network interface that DHCP should run on

    1. Edit file

      sudo vi /etc/default/isc-dhcp-server
    2. Update contents for the INTERFACESv4 item

      Example where the network interface is eno1
      INTERFACESv4="eno1"
  2. Edit config file dhcp.conf

    1. Edit file

      sudo vi /etc/dhcp/dhcpd.conf
    2. Update contents

      Sample contents
      # https://help.ubuntu.com/community/isc-dhcp-server
      #
      default-lease-time 600;
      max-lease-time 7200;
      
      subnet 192.168.1.0 netmask 255.255.255.0 {
          range 192.168.1.3 192.168.1.250;
          option routers 192.168.1.1;
          option domain-name-servers 192.168.1.2,8.8.8.8;
          option domain-name "xackleystudio.local";
      }
      
      host p-ubuntu-norco {
        hardware ethernet 0c:c4:7a:7d:4d:74; # Device eno3
        fixed-address 192.168.1.3; # The desired static IP address
      }
      
      host p-ubuntu-nas {
        hardware ethernet 00:25:22:f8:3e:af; # Replace with the device's MAC address
        fixed-address 192.168.1.10; # The desired static IP address
      }
    3. Check file for errors

      /usr/sbin/dhcpd -t

4. Start & Enable

  1. Start

    sudo systemctl start isc-dhcp-server
  2. Enable

    sudo systemctl enable isc-dhcp-server
  3. Verify

    sudo systemctl status isc-dhcp-server

5. Confirm

  1. Look for leases

    cat /var/lib/dhcp/dhcpd.leases

6. Disable Router’s DHCP

Confirm that the DHCP server is functioning before disabling the DHCP in the Router!
  • The router is currently serving as a DHCP server but this will be disabled to allow the isc-dhcp-server server to take over this role.

    1. Disable the DHCP setting in the router:

      Router DHCP setting