Contact Us:
CheapDeveloper » Webmaster » Articles » What is DHCP protocol

What is DHCP protocol

07 December 2021, Tuesday By Victoria Frolova

What is DHCP

The Dynamic Host Configuration Protocol (DHCP) is a network management protocol used on Internet Protocol (IP) networks for automatically assigning IP addresses and other communication parameters to devices connected to the network using a client–server architecture.

The technology eliminates the need for individually configuring network devices manually, and consists of two network components, a centrally installed network DHCP server and client instances of the protocol stack on each computer or device. When connected to the network, and periodically thereafter, a client requests a set of parameters from the DHCP server using the DHCP protocol.

dhcp protocol Discover

DHCP can be implemented on networks ranging in size from residential networks to large campus networks and regional ISP networks. Many routers and residential gateways have DHCP server capability. Most residential network routers receive a unique IP address within the ISP network. Within a local network, a DHCP server assigns a local IP address to each device.


What is DHCP

Methods of issuing IP addresses

DHCP and dynamic IP

Interaction of DHCP server and client

   Other message options

Duration of IP address usage

Methods of distributing IP addresses in DHCP

DHCP and client communication on different subnets

Brief conclusions

Methods of issuing IP addresses

In order for a computer to work on the network, it needs an IP address. It looks like 4 numbers separated by a dot. For example, the IP address of is - It's like a country, a city, a street and a house in a postal address, only on the Internet - these are communication nodes and backbone routers. If a device is not assigned an IP address, it cannot communicate with other devices on the network.

"IP" stands for Internet Protocol. This protocol has two versions: IPv4 and IPv6. 

  • IPv4 is written as in the example above: 
  • IPv6 is 4 times longer and looks something like this - 2001: 0DA8: AB10: 0001: 0010: 0000: 0001: 00FB

The device can obtain an IP address in two ways: static (manual) and dynamic

  • Static - when a person, for example a network administrator, enters the computer settings and manually assigns an IP address for it. This is useful when there are few computers on the network (at home or in a small office).
  • Dynamic - When the computer automatically obtains an IP address after connecting to the network. Such an IP address is called dynamic and is assigned to a computer for a limited period of time. This method helps to reduce labor costs when there are many computers or devices on the network. 

The dynamic method is suitable both for enterprises, where the number of devices is fixed, and for cafes, through whose Wi-Fi many different gadgets pass every day.

DHCP and dynamic IP

For the dynamic allocation of IP addresses, the network protocol DHCP ("Dynamic Host Configuration Protocol") is used, which is translated as the protocol of dynamic host configuration.

A network protocol is a set of rules and sequential actions. Based on them, the devices that are on the network connect and exchange data with each other.

DHCP works on a client-server model. It automatically distributes IP addresses and other configuration parameters to devices so that they can work on the network. 

  • client - a device that needs to obtain an IP address in order to work on the network. It can be a phone, tablet, laptop or computer.
  • server - a device that distributes IP addresses to clients and makes sure that no two clients get the same IP address.

Interaction of DHCP server and client

Server and client exchange messages on a request-response basis. DHCP interaction consists of 4 stages and is abbreviated as "DORA". One letter for each step:

  1. Search - Discover.
  2. Offer - Offer.
  3. Request - Request.
  4. Acknowledgment - Acknowledgment (ACK).

dhcp protocol DORA

Discover: Client → Server

At this stage, the main thing for the client is to find and find out where the server is located.

We turned on a computer that is on the network. DHCP also works on the same network. In this case, our computer is the client and the DHCP is the server. Now our device needs to get an IP address and other necessary information about the network, such as gateway, DNS addresses and subnet mask. Therefore, the client starts looking for a server and sends a "DHCPDISCOVER" message to computers within that network segment. 

Such a message is called a broadcast, which means that the data stream from the client will be received by all devices within its network. Only DHCP servers can respond to such a message.

dhcp protocol Discover

The client's request will be received by all network participants, but only the server will respond.

Offer: Server → Client

The DHCP server receives a message from the client, then selects a free IP address from among the available ones and sends it in a "DHCPOFFER" response message. 

Typically, the IP address is assigned to the client for a specific time, so it can change between sessions. 

If several servers responded to the client, he will choose one and receive an IP address with settings from it.

Request: Client → Server

The client received an IP address and sends a response message to the server: "DHCPREQUEST". In it, he once again writes the received address and thereby confirms that he will use it.

A response message with an IP address is received by all DHCP servers on the network, if there are more than one. This is necessary so that each server knows that this address is busy and does not offer it to other clients. 

Only one server continues to communicate with the client. This is the one suggested by the client's selected IP address.

Acknowledgment (ACK): Server → Client

The server sends a DHCPACK message and thereby assigns the IP address to the client. The message contains the address itself, the period of its use and additional network settings. The client verifies these settings, applies the resulting configuration, and gains access to the network. 

In general, the entire interaction process looks like this:

- (Client) Who is the server here? I need to get an IP address: "DHCPDISCOVER".

- (Server) I am a server, I suggest you use this IP: "DHCPOFFER".

- (Client) Ok, I will use this IP that you sent me: "DHCPREQUEST".

- (Server) So we agreed. Enjoy your work in the network: "DHCPACK".

Other message options

  • "DHCPINFORM" - this is how the client requests the local network settings. In response to this message, the server sends the requested configuration.
  • "DHCPNAK" - this is how the server refuses the client to use the IP address.
  • "DHCPRELEASE" - this is how the client announces that it is disconnected from the network and releases its IP address. After that, the server again adds this address to the list of available ones.

Duration of IP address usage

The time it takes for the client to obtain an IP address from the server is called the lease time. It can be several minutes, hours or even days. When the lease expires, the address is released and the server can give it to another client. 

The client can renew the lease and use the IP address further. To do this, he waits until half of the period that was originally assigned by the server has passed. The client then sends a DHCPREQUEST message to the server indicating its current IP address. In a "DHCPACK" message, the server restarts the lease. The result is a shortened client-server interaction scheme from the last two stages (request → confirmation).

If the server is silent and does not send a DHCPACK, then the client tries to send a second DHCPREQUEST when half of the time left now has passed. And so on until ⅞ of the time of the entire lease has passed. After that, the client will start sending broadcast requests to its network and wait for a response from another server.

The client will automatically send a DHCPRELEASE message to the server before shutting down and disconnecting from the network. This means that the IP address is free and the server can transfer it to another computer.

Methods of distributing IP addresses in DHCP

The DHCP server can assign IP addresses in three ways:

  1. fixed (manual),
  2. automatically,
  3. dynamically.

Fixed - in this case, the DHCP server is configured, during which the administrator manually prescribes the correspondence between each MAC address and IP address. Thus, each device has its own address, which will be issued by the server. 

This is useful on a small network when the MAC addresses of all computers are known.

The MAC address or physical address is the digital address of the device, which is assigned to the network card "from the factory". Thanks to him, the provider knows which computer to send Internet traffic to.

Automatic - with this method, each device automatically receives an IP address that will not change. The DHCP server issues an address on an indefinite lease until the client relinquishes it. 

Dynamic - the DHCP server issues to the client any address from the free range. These addresses are not assigned to specific devices. 

IP-addresses are distributed dynamically when the composition of users and their number in the network is constantly changing, for example, when using Wi-Fi in a cafe. In this case, the cafe buys a certain number of IP addresses and issues it to visitors who connect to the network.

DHCP and client communication on different subnets

Typically, the network is further subdivided into subnets. This helps to improve productivity and maintain safety. Performance is improved by evenly distributing broadcast traffic. 

The DHCP server and client can be on different subnets, separated by one or more routers. Typically, routers do not allow broadcast traffic.

Recall that the first message a client sends to find a server ("DHCPDISCOVER") is a broadcast message. Consequently, the client and server from different subnets will not be able to communicate just like that. 

This problem is solved using relaying or DHCP relay. With this setting, routers can only transmit DHCP broadcast traffic.

Thus, if the router can operate in the DHCP relay mode, then it will be able to transmit the first client request "DHCPDISCOVER" to a server in another subnet. In this case, nothing interferes with the client-server interaction.

Brief conclusions

Dynamic Host Configuration Protocol (DHCP) is a network management protocol used to automate the process of configuring devices on IP networks, thus allowing them to use network services such as DNS, NTP, and any communication protocol based on UDP or TCP.

  1. Your computer requires an IP address to communicate with other devices and operate on a network.
  2. The device can be assigned a static or dynamic IP address.
  3. Dynamic IP addresses are assigned using DHCP.
  4. In order to obtain an IP address, the client device communicates with a DHCP server according to the DORA model.
  5. The server can assign an IP address to the client in three ways: fixed, automatically, or dynamically.
  6. If the server and client are on different subnets, they will be able to communicate using DHCP relay.

Read also:

AWS re:Invent 2021: Keynotes
02 December 2021, Thursday
AWS re:Invent 2021: Keynotes
What is a dashboard
25 November 2021, Thursday
What is a dashboard
What is Jira Software and How To Work With It
24 November 2021, Wednesday
What is Jira Software and How To Work With It
Add a comment
Comments (0)