Free IT training download and specialized forum of Cisco and Microsoft VMware virtualization cloud and Linux

- Advertisement -

How to configure dhcp on ubuntu



Dynamic Host Configuration Protocol (DHCP) is a critical component of network management. It simplifies the process of assigning IP addresses and other network configuration settings to devices on a network. Ubuntu, a popular Linux distribution, provides robust DHCP server software, which makes it easy to configure and manage your network. In this article, we will guide you through the process of setting up and configuring a DHCP server on Ubuntu.


- Advertisement -

Before diving into the configuration, let’s understand why DHCP is crucial:

  1. Automatic IP Assignment: DHCP automates the process of assigning IP addresses to devices, reducing the risk of IP conflicts and human errors.
  2. Efficiency: It simplifies network management by centralizing IP address assignments and configurations.
  3. Scalability: DHCP makes it easy to add or remove devices from a network without manual IP address adjustments.

Now, let’s configure DHCP on Ubuntu.

Step 1: Installation

First, ensure that the DHCP server package is installed on your Ubuntu system. Open a terminal and run the following command:

sudo apt update
sudo apt install isc-dhcp-server

This command updates the package list and installs the ISC DHCP server.

Step 2: Configuration File

The DHCP server configuration file is located at /etc/dhcp/dhcpd.conf. Use a text editor like Nano or Vim to edit it.

sudo nano /etc/dhcp/dhcpd.conf

Here’s a sample configuration for a basic DHCP server.

Sample DHCP Configuration

Define the network and subnet

subnet netmask {
# Specify the range of IP addresses to be assigned
# Set the gateway and DNS servers
option routers;
option domain-name-servers,;

This example configures a subnet with a range of IP addresses from to and sets the gateway and DNS server addresses.

Step 3: Network Interface

- Advertisement -

You need to specify the network interface the DHCP server should listen on. Open the /etc/default/isc-dhcp-server file:

sudo nano /etc/default/isc-dhcp-server

Set the INTERFACESv4 option to your network interface (e.g., eth0):


Step 4: Start the DHCP Server

Now that you have configured the DHCP server, it’s time to start it:

sudo systemctl start isc-dhcp-server

To make sure it starts automatically at boot:

sudo systemctl enable isc-dhcp-server

Step 5: Firewall Configuration

If you’re running a firewall on your Ubuntu system, ensure that it allows DHCP traffic. By default, DHCP uses UDP ports 67 and 68.

sudo ufw allow 67/udp
sudo ufw allow 68/udp

Step 6: Testing

To verify that your DHCP server is working correctly, you can use a client device to request an IP address. If you don’t have another device available, you can use the dhclient tool on your Ubuntu server to simulate a client request.

sudo dhclient <interface>

Replace <interface> with the name of your network interface (e.g., eth0)


Configuring a DHCP server on Ubuntu simplifies network management and enhances efficiency. By following these steps and customizing the configuration to suit your network’s needs, you can ensure that devices on your network automatically receive the required IP addresses and network settings.

Remember to regularly maintain and update your DHCP server configuration to accommodate changes in your network. DHCP is a fundamental tool for seamless IP address management in any network environment.

- Advertisement -

- Advertisement -

Leave A Reply

Your email address will not be published.