How to Install and Configure DHCP on Linux


Any device or community administrator operating in huge, busy computing environments will ceaselessly in finding it demanding to arrange new shoppers and assign them IP addresses and an array of alternative configuration parameters. This is the place DHCP or Dynamic Host Configuration Protocol turns out to be useful.

DHCP or Dynamic Host Configuration Protocol is a client-server protocol that robotically and dynamically assigns IP addresses and different configuration parameters to gadgets inside your community.

This educational explains learn how to configure a DHCP server and set it up on your community. This information may also illustrate learn how to configure the DHCP Jstomer device. Note that this information is particular to Ubuntu 20:04 and now not on every other running methods.

Introduction to DHCP and DHCP Allocation Methods

While our earlier article presented DHCP and elaborately mentioned the way it works, it’s nonetheless important to introduce it right here and give an explanation for the more than a few allocation choices you’ll use.

The operational mechanism of DHCP is beautiful easy. Many computer systems wouldn’t have IP addresses once they boot up—except they have got a devoted static IP cope with.

After booting, a device will use the automated DHCP Discover part to ship a printed. The DHCP server will reply to the request or broadcast and speak to the customer the use of the DHCP Offer unicast visitors. The DHCP Offer visitors carries the designated IP Address assigned to the customer. It additionally comprises the server’s DNS IP cope with and the Default IP Address for the Gateway.

The Jstomer will because of this ship a DHCP Request to the server acknowledging receipt and acceptance of the configuration parameters. The servers will stay data of all assigned addresses to stop IP cope with collisions or double assignments. For native networks, there will have to simplest be a unmarried server.

The following are the important allocation strategies.

  • Manual Allocation– you’ll base your distribution of IP addresses on MAC (Media Access Control) Addresses. This allocation device provides each and every device a hard and fast IP cope with and the DHCP server will persistently ship the tool a hard and fast configuration in response to its MAC Address.
  • Automatic Allocation– The server will use a primary come, first serve way to assign IP addresses robotically and dynamically. The addresses assigned can both have Fixed Lease Time or Infinite Lease Time. IP addresses with mounted rent time will expire after a while. On the opposite hand, IP addresses with endless rent time will keep completely for the customer.

Step-By-Step Guide on How to Configure DHCP Server on Ubuntu

You wish to observe those steps to configure a DHCP server for your Linux device:

Step 1: Ensure that Your Systems Meet All the Specifications

First off, be sure that your device meets all of the vital necessities. They come with:

  • You have two pc methods, each operating Ubuntu 20:04
  • Privilege to get admission to your community as a root person having the ability to use the sudo command

Step 2: Install DHCP Server

On your designated DHCP server device, set up the DHCP server. Notably, the DHCP server bundle comes within the Ubuntu default depository. You will use the next command to enforce the set up:

Step 3: Start Your DHCP Service

Start your DHCP provider to permit it to start out at device reboot. You can accomplish this the use of the next instructions:

Step 4: Configure the DHCP Service

The DHCP configuration report is to be had at /and so on/default/isc-dhcp-server. You can edit the report with the right kind main points to specify your community interface. The beneath command will permit you to do so:

You can specify your community the use of this command:

Proceed to save lots of and shut the report as soon as completed. The subsequent step is to edit the configuration (/and so on/dhcp/dhcpd.conf) report to outline your DHCP rent. The beneath command will have to be used:

Uncomment the beneath line:

The ultimate step when configuring your server is to switch the strains beneath correctly:

Save and shut this report if you end enhancing the whole thing.

Step 5: Configure the DHCP Server for Static IP Address Assignment to Clients

The DHCP server has a default configuration to assign dynamic IP addresses to shoppers inside the community. However, you want to configure your server to offer static IP addresses to DHCP shoppers in response to each and every Jstomer’s MAC cope with.

For example, we will assign to a shopper with the 4c:bb:58:9c:f5:55 MAC cope with. Edit your /and so on/dhcp/dhcpd.conf report the use of the nano command as proven beneath to succeed in this.

You will have to upload the next strains to the report:

Save the adjustments and shut the report.

It is time to restart your DHCP provider to enforce the adjustments. You can use the beneath command to restart the provider:

Proceed to ensure the standing of your DHCP provider with the command beneath:

Step 6: Configure Your DHCP Client Instance to Obtain a Static IP Address

Once you place up your server, you’ll additionally wish to arrange your Jstomer example. The first setup process is to be sure that your Jstomer can download a static IP cope with from the server.

To do so, open your Jstomer device. We think your Jstomer device has the 4c:bb:58:9c:f5:55 MAC cope with. Once on the tool, edit its community interface the use of the command beneath:

You can edit the interface via putting off the next default strains:

Save the adjustments and shut the report. Now, to be sure that you practice the related adjustments n the brand new report, you’ll restart your Network Manager provider the use of the command beneath:

The subsequent step is to run the command beneath at the Jstomer device:

The output will have to be as follows:

Sometimes, you could fail to get the IP cope with out of your DHCP server. If that’s the case, you’ll download it via operating the command beneath:

You can examine the IP cope with via operating the command beneath:

Step 7: Configure Your DHCP Client Instance to Obtain a Dynamic IP Address

You too can configure your different Jstomer device to procure a dynamic IP cope with out of your DHCP server. You can start this procedure via first enhancing your community interface report the use of the command beneath:

Add the beneath strains to the report:

You can save and shut the report. Now, to be sure that you enforce the adjustments at the interface, continue to restart your Network Manager the use of the beneath command:

Verify the dynamic IP cope with assigned for your DHCP Jstomer via operating the next command:

The output will have to be very similar to what’s within the representation beneath:


The article discusses all the procedure starting with putting in and configuring the DHCP server on Ubuntu. We additionally mentioned configuring the customer example to procure each dynamic and static IP addresses.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More