How to Configure a DHCP Server on Ubuntu Linux

DHCP Server Ubuntu

A DHCP server assigns network settings to clients, but it must serve the correct subnet on the correct interface. This Ubuntu walkthrough configures isc-dhcp-server, validates the file before restart, and marks the boundary for new deployments.

Ubuntu still documents isc-dhcp-server, while its current server guide warns that the package is deprecated. Use this path to maintain an ISC-based setup. For a new deployment that needs active upstream development, DHCPv6, or a JSON configuration model, evaluate Kea DHCP instead.

Choose the server before you change the network

Use isc-dhcp-server for an existing configuration that depends on its dhcpd.conf format, not for a fresh DHCP architecture.

Do not place this server on a network that already has another authoritative DHCP server unless you have designed the split deliberately.

SettingWhat it controlsExample
DHCP server addressThe server needs a stable address outside its lease pool192.168.50.10
Lease poolAddresses handed to clients192.168.50.100 to 192.168.50.200
Gateway and DNSOptions clients receive with a lease192.168.50.1 and your DNS servers

Define the subnet, gateway, DNS servers, and unused pool before installation. The Linux IP and DNS configuration guide helps you verify those values rather than copying the example addresses below.

Install isc-dhcp-server

Refresh the package index, then install the DHCP server package. If you need a refresher on what apt changes on the system, see package management on Linux.

sudo apt update
sudo apt install isc-dhcp-server
Ubuntu terminal showing the isc-dhcp-server installation command
Ubuntu terminal showing the isc-dhcp-server installation command

Configure one IPv4 scope

The server reads its IPv4 scope from /etc/dhcp/dhcpd.conf. Replace every address in this example with values from your own LAN. The server address must not fall inside the range it offers to clients.

sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak
sudo nano /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
authoritative;
ddns-update-style none;

subnet 192.168.50.0 netmask 255.255.255.0 {
  range 192.168.50.100 192.168.50.200;
  option routers 192.168.50.1;
  option subnet-mask 255.255.255.0;
  option domain-name-servers 1.1.1.1, 9.9.9.9;
}

The subnet declaration tells dhcpd which broadcast domain it may serve. The range is the dynamic pool. Router and DNS options become part of each lease, so incorrect values can give a client an address while leaving it unable to reach the network.

Example DHCP configuration in the Ubuntu editor
Example DHCP configuration in the Ubuntu editor

Validate before you restart

A syntax check catches a malformed declaration before the service tries to bind a socket. Run this after every edit and correct the reported line before starting the daemon.

sudo dhcpd -t -cf /etc/dhcp/dhcpd.conf

The current isc-dhcp-server configuration used for this refresh passed the same dhcpd validation with the subnet, range, router, mask, and DNS options shown above. A passing syntax check does not prove that the selected interface reaches the intended LAN, so verify that separately.

Select the listening interface and start the service

Find the interface connected to the client network, then set it in the service defaults. Do not use an interface name from an example. Names such as enp0s3 and ens33 vary by hardware and virtual machine configuration.

ip -br link
sudo nano /etc/default/isc-dhcp-server
Linux terminal output used to identify a network interface and MAC address
Linux terminal output used to identify a network interface and MAC address
INTERFACESv4="enp0s3"

sudo systemctl restart isc-dhcp-server
sudo systemctl enable isc-dhcp-server
sudo systemctl status isc-dhcp-server --no-pager
Ubuntu DHCP service interface setting
Ubuntu DHCP service interface setting

An active service is only the first check. Confirm that it is bound to UDP port 67 with ss, then inspect the service log if it fails. The ss command guide explains the socket view, and the Linux logging guide covers the journal queries you will use next.

sudo ss -ulpn | grep ":67"
sudo journalctl -u isc-dhcp-server -b --no-pager
Ubuntu service status showing the DHCP server check
Ubuntu service status showing the DHCP server check

Reserve an address for one client

A reservation maps a device MAC address to a fixed address. Pick an address outside the dynamic range so the lease pool cannot offer it to a different client.

host lab-printer {
  hardware ethernet 00:11:22:33:44:55;
  fixed-address 192.168.50.20;
}

Use ip link on a Linux client to obtain its interface address, then add the reservation to dhcpd.conf and run the syntax check again. The retained client-MAC screenshot above shows the value you need to identify.

Open the network path, not every port

DHCP uses UDP ports 67 and 68, but broadcast traffic and firewall policy must also match the local network design. Review Linux firewalls and access control before changing a host firewall. A routed or segmented network normally needs a DHCP relay rather than an extra DHCP server on each subnet.

Troubleshoot from the daemon outward

  • Run dhcpd -t -cf /etc/dhcp/dhcpd.conf after every configuration change.
  • Check that the configured subnet matches an address on the selected interface.
  • Read journalctl -u isc-dhcp-server -b –no-pager for the daemon error, not only the systemctl summary.
  • Use ss -ulpn to confirm that dhcpd has UDP port 67 open.
  • Test one client on the same Layer 2 network before diagnosing a relay or VLAN path.

Use Kea for a new DHCP design

ISC DHCP remains useful when you must maintain its configuration, but Ubuntu labels the package deprecated. Kea supports DHCPv4 and DHCPv6 and uses a different configuration model, so do not copy this dhcpd.conf into a Kea host.

Your next move is simple. Put your subnet plan into dhcpd.conf, run dhcpd -t, then restart the service only after the check passes. If you are designing a fresh service rather than maintaining ISC DHCP, begin with the Kea documentation.