How to install & configure DHCP server in Ubuntu & Debian.

DHCP stands Dynamic host configuration protocol used to assign an automatic IP (Internet Protocol) to systems and network devices in the network. It is also used to assign a sub net mask, gateway, domain name server information to the network devices.

Benefits of DHCP Server

  • Assign unique IP address to all devices with in a network.
  • No chance of conflicting IP address.
  • No need to put manual IP address in all devices.
  • Centralized management system
  • Bind IP address
  • Easily update all information.
  • Support multiple scope.

How to install DHCP server in Ubuntu and other Debian base distribution.

To install DHCP server in Ubuntu first of all we have to update a server, open a terminal and run following commands.

Update command

Sudo apt-get update

DHCP installation command

Sudo apt-get install isc-dhcp-server

After this DHCP server has been installed and now we are going to configure it according to our need.Assign network interface (means which network card is used to serve DHCP request).Edit the file /etc/default/isc-dhcp-server,  here we have use nano editor for edit. Run following command.

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

Put your interface name as shown in below image. (here my interface is “enp0s3”). May be your interface card have different name, check your interface name by run command ifconfig.

dhcp interface assign

Save and close the file.

Main conf file of DHCP is /etc/dhcp/dhcpd.conf, we have edit it for all network related information.For edit it run a following command.

Sudo nano /etc/dhcp/dhcpd.conf

Enter the domain name and domain-name-servers .

# option definitions common to all supported networks...
  option domain-name "";
  option domain-name-servers,;

Than, find and uncomment the following line to make this server as official DHCP server.



Here, = domain name of our server   = our server IP           = Google DNS IP

Note :- Replace the domain name with your own values.

Define a sub net, IP range and other information scroll down a little bit and change the values according to your need.

# A slightly different configuration for an internal subnet.
 subnet netmask {
 option domain-name-servers,;
 option domain-name "";
 option subnet-mask;
 option routers;
 option broadcast-address;
 default-lease-time 600;
 max-lease-time 7200;

Save and close the file.

Finally, we have successfully configured a DHCP server, Start DHCP service to active it.

Sudo service isc-dhcp-server start
Sudo service isc-dhcp-server stop  (this command stop service)
Sudo service isc-dhcp-server status  (this command shows status)

Set your client system on DHCP mode, it will definitely take IP address from server.

About SJ

He is a Linux Administrator and founder of SJ Technics, fan of open source and Linux based system software. S.J. believes sharing IT knowledge with others

View all posts by SJ →

Leave a Reply

Your email address will not be published. Required fields are marked *