How to set up a DHCP server on Ubuntu?

by georgiana.senger , in category: Networking & Wireless , a year ago

How to set up a DHCP server on Ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer


by samara , a year ago


To set up a DHCP server on Ubuntu, you can follow these steps:

  1. Open a terminal window on your Ubuntu machine.
  2. Install the DHCP server software by running the following command:
sudo apt-get update
sudo apt-get install isc-dhcp-server

  1. Configure the DHCP server by editing the /etc/dhcp/dhcpd.conf file. You can use any text editor you prefer to open the file, but we will use nano in this example:
sudo nano /etc/dhcp/dhcpd.conf

  1. In the dhcpd.conf file, you need to specify the network parameters that you want to assign to clients. Here's an example configuration:
subnet netmask {
   option routers;
   option domain-name-servers,;
   option broadcast-address;

This configuration specifies that the DHCP server will assign IP addresses in the range to clients, and the default gateway (router) will be The DNS servers are set to and, and the broadcast address is set to

  1. Save the dhcpd.conf file and exit the text editor.
  2. Configure the DHCP server to listen on a specific network interface. To do this, edit the /etc/default/isc-dhcp-server file:
sudo nano /etc/default/isc-dhcp-server

  1. Uncomment the line that specifies the network interface, and change it to the appropriate interface name for your system. For example:

  1. Save the isc-dhcp-server file and exit the text editor.
  2. Start the DHCP server by running the following command:
sudo systemctl start isc-dhcp-server

  1. Enable the DHCP server to start automatically at boot time:
sudo systemctl enable isc-dhcp-server

That's it! You now have a DHCP server set up on your Ubuntu machine. You can test it by connecting a client computer to the network and verifying that it receives an IP address from the server.