What is DHCP server and how to configure IT | newserverlife.com

What is DHCP server and how to configure IT

What is DHCP server and how to configure IT 22 October 2022

DHCP is a Dynamic Host Configuration Protocol that auto-registers the network parameters of each new device in the IT infrastructure.

The using DHCP simplifies the work of system administrators significantly in cases of a network expansion.

The DHCP server is a background process that uses UDP port 67 as a transport and waits for the requests from the clients which want to connect to the network. The using of DHCP server technology makes it possible to determine with each client:

  • IP address
  • network or subnet mask - network or host addressing within the IP address;
  • gateway - a component that creates a connection between two systems;
  • an address of a DNS server that responds to Internet name resolution queries;
  • time (NTP) - a service for synchronizing the computer's internal time.

There are three modes of DHCP server operation:

  • manual assignment, where IPs specified in the host configuration assigned a fixed MAC ID. In this case, an hardware address of an individual network adapter will be unique for each device. IP in this case assigned with an ongoing basis, but additional clients can no longer be connected to the network;
  • dynamic assignment, where a server determines in its records how long an IP address can be granted to a client. The time set by the administrator called the "lease time". When the lease expires, the DHCP server returns the address to the pool where it can be reallocated as needed;
  • automatic assignment, where the Dynamic Host Configuration Protocol assigns a specific range of IP addresses. When the addresses are "tied" to each other, they remain linked indefinitely. The disadvantage of this method is that new clients won’t receive an IP if the realm is fully assigned.

DHCP is available for both IPv4 (DHCPv4) and IPv6 (DHCPv6).

The work mechanism of the DHCP server

The assignment of an IP address is carried out via a DHCP server in the several stages:

  • Discover (server’s search). When a client boots up (or wants to join a network), it starts a process with a broadcast DHCPDISCOVER message with its own MAC address to discover available DHCPv4 servers. Because the client has no subnet he belongs to, the DHCPDISCOVER message has an IPv4 destination address of Since the client doesn’t have an IPv4 address configured yet, the source IPv4 address will be The DHCPDISCOVER message discovers DHCPv4 servers in the network. Because the client has no IPv4 information during the booting up, he uses layer 2 and layer 3 broadcast addresses to communicate with a server.
  • Offer (server’s offer). When a DHCPv4 server receives a DHCPDISCOVER message, it reserves an available IPv4 address for lease or permanent assignment to the client. The server also creates an ARP entry consisting of the client's MAC address and the provided IPv4 address. The DHCP server sends an associated DHCPOFFER message to the requesting client as a unicast, using the server's MAC address as the source address and the client's MAC address as the delivery address.
  • Request. When a client receives a DHCPOFFER from a server, he sends back a DHCPREQUEST message. This message uses both to obtain an IP address and to renew its lease. When DHCPREQUEST used to obtain a lease, it serves as a notification of acceptance the options selected and offered by a particular server, and as a notification of offers’ rejection from other servers. Many corporate networks use multiple DHCP servers, and a DHCPREQUEST message sends as a broadcast to inform all the servers of the accepted offer.
  • Acknowledge (confirmation). When a DHCPREQUEST message received, a server checks lease information with an ICMP request to the address to ensure that it is no longer in use. Then it creates a new ARP entry for the client's lease and responds with a unicast DHCPACK message. This message is a duplicate of DHCPOFFER except for the change in the message type field. When the client receives a DHCPACK message, he logs the information and performs an ARP lookup for the assigned address. If there is no response to ARP, the client knows that the IPv4 address is valid and starts using it as its own.

What you need to know to install the required server

To install the DHCP Servers service on Windows computers should be run:

  • enter the "Add or Remove Programs", which is located in the "Control Panel";
  • select the tab "Add and remove components", which is located on the left panel. After that, the "Component Wizard" will start running (it is necessary to click on the "Next" button);
  • select the "Network Services" section and click on the "Composition" button;
  • Highlight the "Dynamic Host Configuration" entry and click the "OK" button.

After that, you need to click on the "Finish" button, and then on the "Close" link.

How to set up a DHCP server?

After installing a DHCP server, it’s necessary to configure it. Setting up a server means creating of the area - a range of valid IP addresses available for lease on the client’s computers in the network. Moreover, it is recommended that each DHCP server has at least one scope that doesn’t overlap with any other DHCP server in the defined IT infrastructure.

The creation of a new area takes place step by step and includes:

  • click the “Start” button, specify the programs and administrative tools, and then click the DHCP button;
  • in the console tree – a right-click on the DHCP server which you want to create a new DHCP scope, and then click the "New Scope" button;
  • in the Master of the new regions click the "Next" button and then enter a name and description for a region. The name can be different but descriptive enough to fully define the purpose of the area in the network. Press the "Next" button;
  • enter the range of addresses that can be rented within this area. For example, it can be used a range of IP addresses from the start IP address to the end IP address Because these addresses given to clients, they should to be all valid for its network and isn’t in current using. If it is necessary, it is possible to enter a new subnet mask. Press the "Next" button;
  • enter any IP addresses that you want to exclude from the entered range. These addresses are within the range of the specified addresses in the previous step and can be already statically assigned to various computers in your organization. Usually, the domain controllers, the web servers, the DHCP servers, the Domain Name System (DNS) servers and other servers have statically assigned IP addresses. Press the "Next" button;
  • enter a number of the days, the hours and the minutes before a lease of the IP addresses from this area expires. This time range determines how long a client can keep a leased address without renewing it. Click the "Next" button and then click the "Yes, I want to configure these settings now" button. This is necessary to expand the enable master’s options for the most common DHCP options. Press the "Next" button;
  • enter the IP address of the default gateway. This gateway should be used by clients that obtain an IP address from the created scope. Click "Add" to add the default gateway address in the list and then click the "Next" button;
  • The using a DNS server in the network should be with entering the organization's domain name in the “Parent Domain” field. After entering the name of the DNS server, it should be pressed the "Allow" button that the DHCP server could be in the contact with DNS server and determine its address. Click "Add" to include this server in the list of the DNS servers that assigned to DHCP clients. Click the "Next" button and perform the same steps. The using a Windows Service (WINS) server should be with adding these name and IP address and then click the "Next" button;
  • click the "Yes, I want to activate this area now" button to activate the area and allow the customers to rent it. Then click the "Next" and "Finish" buttons.

After making the settings in the console tree it is necessary to select a server name and click the "Authorizing" button in the "Actions" menu.

What to choose - Linux or Windows

Setting up a DHCP server on Linux includes the following steps:

  • installing the dhcp3-server using the $ sudo apt install isc-dhcp-server command;
  • after the installation - editing the /etc/default/isc-dhcp-server file to define the interfaces that DHCPD that will use the DHCP requests with the INTERFACES option;
  • setting a static IP address for the created interface;
  • entering the information which sends to clients in the main DHCP configuration file - /etc/dhcp/dhcpd.conf. Two types of the data are distinguished in this file: parameters that specify how to perform the task (for example, how long to allocate an address), whether to perform it at all (for example, whether to allocate addresses to the unknown clients), or what network configuration parameters to send to the DHCP client, and declarations that define the network topology, describe the clients and the addresses provided to them, or apply a group of the parameters to a group of the declarations;
  • defining the DHCP server settings by opening and editing the configuration file: $ sudo vi /etc/dhcp/dhcpd.conf. To do this it’s necessary to set the global parameters at the beginning of the file which will be valid for all declarations (and which can be changed in accordance with the specific tasks). They are: domain-name domain name, domain-name-servers DNS server names, default-lease-time in the seconds (if the client didn't request it itself), max-lease-time in the seconds, and a parameter authoritative, meaning the "authority" of a server in the network segment. This parameter is necessary if the client requests an incorrect IP address - in this case, a server will refuse it and offer to get the new address;
  • specifying the subnet of the local network where DHCP server will be used. The following parameters will be used here: routers - default router IP address; subnet-mask - subnet mask; domain-search - domain name; domain-name-servers - names of DNS servers; range - the range of the IP addresses allocated to the clients.

At the same time, it should be noted that using Linux as an alternative or a full-fledged replacement for Windows may become unprofitable, because of the Linux doesn’t have the serious advantages in choice of the programs (including free ones), in the connecting devices, in a security, in a reliability and in a speed.

Types of the errors in the period of installing a DHCP server

The typical errors that occur in the period of installing a DHCP server which cause to fail include:

  • incorrectly assigned changes of the basic server settings;
  • entering the incorrect address; incorrect subnet mask specified by the user;
  • incorrect entry of the router address; Mismatch of the router address with the range characteristic of the subnet; incorrect domain entry;
  • incorrect indication of a DNS server; inaccurate input of the address of the time server;
  • errors during the introduction or correction of the ranges;
  • inaccurate generation of the IP addresses and of the last addresses;
  • problems with the adding a required range or entering a range that matches with the settings of an already existing range in a DHCP server.

Advantages and disadvantages of using DHCP

The using of the DHCP servers allows to automatically create a configuration for the new users and embed almost any device connected to the network - computers, switches, smartphones - into the IT infrastructure. At the same time, dynamic IP address assignment reduces the likelihood that two devices will have the same IP address (which happens quite often during the using manually assigned static IP addresses).

Since each of these devices receives an IP address automatically, the devices could move freely from one network to another one (if they configured with DHCP), which is very convenient for the mobile devices.

However, in addition to the advantages, there are certain disadvantages to use the DHCP servers. For example, the dynamic IP addresses shouldn’t be used for the stationary devices (the printers and the file servers) that require a constant access. These devices should be assigned the static IP addresses.

Additional information about DHCP

The DHCP server allows to define a scope or range (pool) of the IP addresses to serve the devices that are assigned these addresses. At the same time, even a small pool is enough for many devices to connect to the network over a certain period of time.

In addition, the static IP addresses can be used simultaneously with the devices that have the dynamic IP addresses delivered via DHCP in the network.

What equipment is suitable for a DHCP server

Assigning the IP addresses isn’t a laborious task. That’s why the simplest and the most reliable equipment can be used for this type of server. Models such as a HPE Proliant DL20 gen10 and Dell R430 are suitable for this role. In companies with more than 100 employees we recommend to deploy the several DHCP servers which will provide high fault tolerance.

NewServerLife staff will help you to find the right equipment and to save money by choosing the used servers.