Akshay Mishra

Dynamic Host Configuration Protocol

Automatic distribution and assignment of IP addresses, default gateways, and other network characteristics to client devices are performed by a DHCP server, a type of network server.

For clients to successfully communicate on the network, a DHCP server automatically delivers the necessary network parameters. Without it, the network administrator must manually configure each new client that enters the network, which can be time-consuming, especially in networks with many clients. Each client is often given a distinct dynamic IP address via DHCP servers, which changes after the lease on that IP address has expired.

What is Dynamic Host Configuration Protocol (DHCP)?

Any device or node on a network can receive a dynamic IP address through the Dynamic Host Configuration Protocol (DHCP), a network administration protocol (Internet Protocol). These setups are automated and centrally managed using DHCP. New devices don’t require manual IP address assignment. Therefore, connecting to a DHCP-based network does not require any user configuration.

Both small business networks and extensive enterprise networks can use DHCP. The majority of routers and networking hardware use DHCP by default. DHCP is often referred to as RFC 2131 (Request for comments).

A network DHCP server that is deployed centrally and client instances of the protocol stack on each computer or device make up the technology, which eliminates the necessity for manually configuring each network device individually. A client uses the DHCP protocol to ask the DHCP server for a set of parameters the first time they connect to the network and then regularly after that.

Networks of all sizes, including residential networks, sizable campus networks, and regional ISP networks, can use DHCP. The DHCP server functionality is available on a lot of routers and home gateways. The majority of home network routers get a special IP address inside the ISP network. A DHCP server assigns each device a local IP address within a local network.

Network managers would have to manually distribute IP addresses from the pool if Dynamic Host Configuration Protocol (DHCP) didn’t exist, which would be unacceptably time-consuming, ineffective, and prone to error. Fortunately, DHCP is a real thing.

Why Use DHCP?

Each Internet-connected device on an IP network must be given a distinct IP address. Network administrators can centrally manage and distribute IP addresses with the use of DHCP. When a computer is relocated, it can instantly give it a new IP address. The process of assigning IP addresses is automated via DHCP, which decreases the amount of time needed for device configuration and deployment as well as the likelihood of configuration errors. A DHCP server can also control the configurations of numerous network segments. A network administrator simply needs to alter the necessary configuration on the DHCP server when a network segment’s configuration changes.

Some of the reasons why we use DHCP:

  • Reliable IP address configuration demands precision in the IP address configuration settings. Making mistakes when working with inputs like 192.168.XXX.XXX is simple. Typographical errors are frequently very challenging to fix, however, using a DHCP server reduces their frequency.
  • IP address disputes will be lessened because all connected devices must have one. However, a single IP address can only be utilized at a time. One or both of the devices cannot be linked if there is a disagreement in the IP addresses of the two devices. When IP addresses are assigned manually, this is especially possible when there are several endpoints, such as mobile devices, that connect only occasionally. Each IP address is only used once thanks to the use of DHCP.
  • Automatic IP address management: In any network lacking DHCP, IP addresses must be manually assigned and withdrawn by network administrators. Keeping track of which device has which IP address can be a fruitless endeavor because it is practically difficult to determine when a device needs network access and when it no longer needs it. Network specialists can handle all sites from a single place by automating and centralizing this process using DHCP.
  • Effective change management: When DHCP is used, changing addresses, scopes, or endpoints is a breeze. For instance, a company might desire to switch from one IP address range to another. The updated information is configured on the DHCP server, and it will be transmitted to the new endpoints. Similar to this, no network configuration is needed if a network device is upgraded and replaced.

Components of DHCP

The three components of the DHCP architecture are DHCP servers, DHCP clients, and DHCP relay agents. In a DHCP conversation, the client communicates with servers to get and renew IP address leases and network configuration settings. The DHCP components are described succinctly as follows:

DHCP Server

An object or server in the network known as a DHCP server is responsible for automatically allocating client devices with IP addresses and other network settings. The DHCP servers from other vendors on the network are compatible with DHCP servers running on a Junos OS device.

The client device receives the following configuration settings from the DHCP server:

  • Gives all clients on a specific subnet temporary IP addresses from a pool of available IP addresses (dynamic binding).
  • Based on their media access control (MAC) addresses, assign certain clients permanent IP addresses (static binding).
  • The following configuration settings are assigned:
  1. IP addresses
  2. A subnet mask
  3. The network’s default gateway
  4. Name Server
  • For clients, a DHCP server offers persistent network parameter storage. DHCP servers can process BOOTP queries since DHCP is an extension of BOOTP (Bootstrap Protocol).

The server does not handle dynamic DNS updates, VPN connections, assigning IPv6 addresses, DHCP failover protocol, or user class-specific configuration. The DHCP server is not supported by the Junos-FIPS software.

DHCP Client

Any IP device connected to the network and configured to behave as a host by asking a DHCP server for configuration information such as an IP address is known as a DHCP client.
The TCP/IP settings and IP address for each physical interface in any security zone are obtained by a Juniper Networks device serving as a DHCP client from an external DHCP server. You must set up a logical interface on the device to request an IP address from the network’s DHCP server for it to function as a DHCP client. You control the DHCP server address, lease duration, vendor class ID, retransmission attempts, and retry interval. Releases for DHCP clients can be renewed.
A framework for sending configuration data to hosts on a TCP/IP network is provided by the Dynamic Host Configuration Protocol (DHCP). An Internet host that uses DHCP to get configuration information, such as an IP address, is known as a DHCP client. The fundamental actions that take place when a DHCP client asks a DHCP server for an IP address are depicted in the diagram below. To find a DHCP server, the client, Host A, broadcasts a DHCPDISCOVER message. In a DHCPOFFER unicast message, a DHCP server provides configuration information (such as an IP address, MAC address, domain name, and a lease for the IP address) to the client.

IP Address Pool

An IP pool is a list of IP addresses that are sequentially assigned to different networks. There are various pool setups available. Each pool may be given priority and assigned to a particular group.

Dynamically assigned IP addresses might come from a single pool or a collection of pools. When allocating IP addresses, the Least Recently Used (LRU) approach is used. The addresses are positioned in a queue for each pool. When an address is allocated, it is placed at the front of the queue, and when it is freed, it is moved to the back.

A method is used to calculate a probability for each pool based on the number of accessible addresses when several pools have the same priority. Based on the calculated likelihood, a pool is chosen.

Addresses are distributed equally using this manner throughout the pools.
In the IP pool, IPv4 and IPv6 addresses are supported. Prime Network offers the adaptability of dynamically allocating IP addresses for services running on a network element with the IP Pool function. An appropriate IP pool can be referred to by a service that is operating on a network element, and the service will receive an IP address from the IP pool.

Subnet

An IP address range is all that a subnet is. Without using any routers, all the devices on the same subnet can connect directly. A network interface in IPv4 only has one IP address and is connected to one subnet. We’ll reserve IPv6 subnetting for another essay because things in IPv6 are a little bit more involved. However, because the fundamental ideas are the same, it’s helpful to learn IPv4 first.

Consider that I have the IP address 192.168.101.15 and the subnet mask 255.255.255.0. The IP address has 32 bits, and the mask has the same amount. Those 32 bits are usually expressed as four 8-bit values, or “octets,” in our writing. The fact that we represent each of those 8-bit numbers using decimal notation while the actual workings of subnetting take place in binary can be confounding.
A subnetwork is a divided portion of a larger network. More specifically, subnets divide an IP network logically into numerous, smaller network pieces. Data is sent from one computer to another via the Internet using the Internet Protocol (IP). Every machine, or host, on the internet, is uniquely identified by at least one IP address.

A subnet is a tool used by organizations to partition enormous networks into more manageable subnetworks. To reduce traffic, a subnet divides a large network into a collection of smaller, connected networks. By eliminating these superfluous routing steps, network speeds are increased.

The segmentation of a network address space through subnetting increases the effectiveness of address distribution. It is covered in detail in the official Request for Comments 950 document and is closely related to IP addresses, subnet masks, and Classless Inter-Domain Routing (CIDR) notation.

Lease

An IP address is provisionally assigned to a networked device through a DHCP lease. Each client connected to the network is merely “renting” an IP address when a pool of IP addresses is managed using DHCP. Therefore, IP addresses maintained by a DHCP server are only given out for a short duration.

When the lease duration of the assignment expires, the client must immediately stop using this IP address and all IP network communication. The lease duration is the length of time that the assignment is valid. The biggest danger of breaking this rule is having many devices on the network with the same IP address and conflicts about sending IP frames to the appropriate device.

Clients on the network may need to extend the lease period to continue utilizing the same IP address, depending on the lease duration. The client can communicate with its DHCP server to request a lease renewal at the halfway point of the lease time (T1 timer). If the server has not responded, this renewal procedure may be repeated more than once. The client can try to rebind its lease via a broadcast to any DHCP server on the network if, for any reason, the renewal of the lease hasn’t succeeded by 7/8 of the lease period (T2 timer).

The client can request a lease termination from the server at any time during the DHCP lease period to release the IP address for use by another network client. When a host shuts down, this procedure is often carried out automatically.

DHCP Relay

The DHCP client and DHCP server interact during the DORA( Discover, Offer, Request, Acknowledgement) process to dynamically assign an IP address to the host.

The offer and acknowledgment messages in the DORA process can be broadcast or unicast based on the value of the broadcast flag, which is, for example, The offer and acknowledgment messages are broadcast if the value of the broadcast flag is 1, and they are unicast if it is 0. However, since the router doesn’t send broadcast packets, this is only true while the DHCP server is present on the same network. If the server is part of a different network, what happens? The DHCP relay agent role now enters the picture.

Any TCP/IP host that is used to relay requests and responses between the DHCP server and client when the server is located on a different network is known as a DHCP relay agent. After receiving DHCP messages, relay agents create a fresh message to broadcast over a different INTERFACE. Additionally, if enabled, the Relay agent information option 82 and the giaddr (gateway address of the packet) field are added by the DHCP relay agent. When the server reply is forwarded to the host, the options field is erased.

The 8 DHCP Messages

DHCP Discover Message

This is the initial message produced during the server and client’s communication process. To find out whether a network has any DHCP servers or servers at all, the client host generates this message. To locate the DHCP server, this message is broadcast to all connected devices in the network. The size of this message is 342 or 576 bytes.

DHCP DISCOVER

The client PC’s source MAC address is 08002B2EAF2A, the server’s destination MAC address is FFFFFFFFFFFF, the source IP address is 0.0.0.0 (because the PC has no IP address as of yet), and the destination IP address is 255.255.255.255, as shown in the figure (IP address used for broadcasting). Therefore, a broadcast IP address and MAC address are needed since the discovered message is broadcast to identify the DHCP server or servers in the network.

DHCP Offer Message

The unleased IP address and other TCP configuration details will be supplied by the server in its response to the host in this message. The server is broadcasting this message. The message is 342 bytes in size. The client host will take the first DHCP OFFER message it gets if there are many DHCP servers available in the network. To identify the server, a server ID is also supplied in the packet.
DHCP SCALER

For the offer message, the source IP address is 172.16.32.12 (the IP address of the server in the example), the destination IP address is 255.255.255.255 (the broadcast IP address), and the source and destination MAC addresses are 00AA00123456 and FFFFFFFFFFFF, respectively. Here, the DHCP server is broadcasting the offer message; as a result, the destination IP address is the broadcast IP address, the destination MAC address is FFFFFFFFFFFF, and the source IP address is the server IP address.

Additionally, the server has made available the supplied IP address 192.16.32.51 and a lease duration of 72 hours (after which point the host’s entry will be immediately deleted from the server). Additionally, the PC MAC address (08002B2EAF2A) serves as the client identity for all messages.

DHCP Request Message

A client will broadcast a DHCP request message in response to an offer message it has received. The client will perform a free ARP to see whether any other hosts with the same IP address are already present on the network. If no other host responds, there are no hosts in the network with the identical TCP configuration, and the message is sent to the server to indicate that the IP address has been accepted. This message also includes a Client ID.

REQUEST DHCP

Now that the client PC is broadcasting the request message, the request message’s source IP address is 0.0.0.0 (since the client currently has no IP address) and its destination IP address is 255.255.255.255. The request message’s source MAC address is also 08002B2EAF2A (the PC MAC address), and its destination MAC address is FFFFFFFFFFFF.

This message is sent out following the PC’s ARP request to see if any other hosts are using the provided IP. If there is no response, the client host broadcasts a DHCP request message to the server indicating that the IP address and other TCP/IP configurations have been accepted.

DHCP Acknowledgment Message

As soon as the server receives a request message, it will create an entry with the specified client ID and bind the IP address provided with a lease time. The IP address provided by the server will now be known by the client.

DHCP ACKNOWLEDGEMENT

The client host will now be entered by the server with the provided IP address and lease time. The server will not give this IP address to any other hosts. The source IP address is 172.16.32.12, the source MAC address is 00AA00123456, and the source IP address is 255.255.255.255. The destination MAC address is FFFFFFFFFFFF, the source MAC address is 255.255.255.255, and (server MAC address).

DHCP Negative Acknowledgment Message

A DHCP server will send the client a DHCP Nak message whenever it receives an IP address request that is inappropriate for the scopes that the server is configured with. For instance, when the pool is empty or there isn’t an unused IP address on the server, this message is provided to the client.

DHCP Decline

If a DHCP client determines that the server’s configuration settings are changed or invalid, it sends a DHCP decline message. The client sends a DHCP refuse message to the server indicating that the provided IP address is already in use when a host responds to the client’s gratuitous ARP request.

DHCP Release

To release an IP address and stop any remaining lease period, a DHCP client sends a DHCP release message to the server.

DHCP Inform

The client utilizes DHCP information to receive further local configuration settings, such as the domain name if the client address has manually acquired an IP address. Without issuing a new IP address, the DHCP server creates a DHCP ack message in response to the DHCP notify message with local configuration appropriate for the client. The client receives this DHCP ack message unicast.

Advantages of DHCP

Compared to older techniques for obtaining IP addresses, DHCP servers have several benefits. A DHCP server can provide the features listed below.

  • IP address management is done automatically, and duplicate IP address issues are avoided.
  • Enables support for BOOTP clients, allowing for a simple switch from BOOTP to DHCP on your networks.
  • Allows the administrator to set lease times, even for IP addresses that were manually assigned.
  • Allows for the restriction of the MAC addresses served by dynamic IP addresses.
  • enables the configuration of extra DHCP option types beyond what is achievable with BOOTP.
  • Enables the definition of the IP address pool or pools that can be assigned dynamically. The pool may be forced to be a whole subnet or network by a user’s server. Such a pool shouldn’t be forced to include just contiguous IP addresses by the server.
  • Allows the connection of several dynamic IP address pools to various IP networks (or subnets). The fundamental support for secondary networks is this. As a result, a router can serve as a BOOTP relay for an interface that has several IP networks or subnets.
  • The automatic issuance of IP addresses to requesting clients is made possible through DHCP, which is simple to set up. Thus, the time required to manually configure IP addresses can be decreased.
  • There are no additional expenditures associated with the deployment.
  • The assignment of duplicate or incorrect IP addresses is stopped. Therefore, there is no possibility of IP address conflicts.
  • It makes network administration easier.
  • It supports a variety of scopes, such as super scope and multicast scope.
  • Mobile customers greatly benefit from it because the new network immediately provides them with proper configuration parameters.

Disadvantages of DHCP

If there is just one DHCP server setup in a network, that server could be the single point of failure.

  • Since DHCP packets cannot cross a router, a relay agent is required to process all lease requests on both network segments by the DHCP server. DHCP broadcast packets are received by relay agents, who then forward them as unicast packets to the DHCP server. Here, the relay agent’s configuration has to include the DHCP server’s IP address.
  • Security: Due to the lack of a secure mechanism for client authentication, DHCP servers are vulnerable to illegal access to IP addresses when they are presented with credentials such as client identifiers from other DHCP clients.
  • When a new IP address is assigned, the machine name remains unchanged.
  • In the absence, the client is unable to access the network.
  • It is possible to stop devices from connecting if you allot too few IP addresses.
  • DHCP setups must be supported by devices. The connected device will not function if the network’s DHCP server is down.
  • You can have communication problems if a random DHCP pops up on your network.
  • For devices to connect to the network, a suitable configuration is required.
  • The same machine may have two or more different IP addresses throughout time, making it challenging to track internet activities.
  • Computers using DHCP that lack a static IP cannot be utilized as servers since their IP will change.

Conclusion

  • A 1985 network IP management technique called Bootstrap Protocol is an expansion of DHCP (BOOTP). Since DHCP is more sophisticated, it can handle requests from BOOTP clients if any are present on a network segment.
  • BOOTP introduced the idea of a relay agent that allowed BOOTP packets to be relayed across networks by using one central BOOTP server to serve hosts on numerous IP subnets.
  • BOOTP did not offer a way to reclaim IP addresses that were no longer in use, and therefore needed a manual process to add configuration information for each client.
  • Numerous memory corruption vulnerabilities affect DHCP servers. In these, the Windows DHCP Server service has been the target of attackers.
  • Whether a network is a LAN or WAN, DHCP makes it simpler for network managers to add or transfer devices inside a network. However, DHCP lacks inherent security, making it vulnerable to attack by rogue actors that get access to the DHCP server.
  • In addition to configuring the correct subnet mask, default gateway, and DNS server information on the device, DHCP is used to distribute IP addresses inside a network.
  • The network administrator has a way to configure the network from a centralized location thanks to the DHCP protocol. Reusing IP addresses and handling new users with ease are made possible by DHCP.
  • When assisted by DHCP relay agents located on the connected routers, the DHCP server may be able to service the complete network. These agents act as a message relay between DHCP clients and DHCP servers that are situated on several subnets.

Author