To fully understand the working of DHCP, we must look at the components of the DHCP Network:
DHCP server: This is the central device that holds, assigns, and manages IP addresses. It can be a server, router, or SD-WAN appliance.
DHCP client: This is the endpoint that requests for IP addresses and can be installed on any type of peripheral device, although most are part of the default settings.
Subnets: These are parts of a more extensive network.
DHCP relay: This refers to devices like routers that acts as a middleman between clients and server, amplifying the messages to reach their destination goal.
The overall process and detailed mechanisms explain the working principle of Dynamic Host Configuration Protocol (DHCP). A DHCP system consists of two essential elements: the client and the server.
The clients are peripheral devices, while the DHCP server allocates IP addresses. The physical server often comes with a backup. Other devices function similarly to servers, such as SD-WAN appliances or the more common wireless access points.
It is natural to wonder how the end device initially connects to the server without an IP address, which is explained by an intricate system of exchanging messages and acknowledgments. To start, all modern devices have a DHCP client system installed during manufacturing, which is enabled by default.
The DHCP client is present in peripheral devices and computers and starts functioning as soon as the computer is turned on, and the operating system is running. Therefore, most devices can already find and connect to a DHCP network.
The entire process, although a bit complex, occurs automatically within seconds. The initialization process involves four message types which are:
1. DHCP discovery
The discovery message is the first message transmitted across the network to which clients are linked. The message type DHCPDISCOVER is sent widely across the network and not to a specific address, as the client is unaware of the server’s address.
The discovery message is a packet with a detailed destination (usually 255.255.255.255), showing that the client is part of that network. The packet may also contain a specific subnet broadcast address if configured. The discovery operation is a universal procedure that can fit into any DHCP server, provided the client is in that network.
Although there are no fixed destination addresses for individual servers and clients, the port number is a fixed parameter used in all DHCP communication between servers and clients. DHCP servers have a User Datagram Protocol (UDP) port number of 67, so listen for messages addressed to this port number. On the other hand, DHCP clients have the UDP port number 68 and only respond to messages sent to number 68.
2. DHCP offer
The DHCP is the reply sent by the server after receiving the discovery message. The message type is DHCPOFFER, which is broadcasted widely across the network using the UDP port number 68 so that any DHCP client connected to that network can pick it up. However, the message is targeted to just one client, and the server does this by attaching the MAC address of a specific client. Other clients ignore the message when they come across a non-self MAC address.
Included in the DHCP offer is an IP address that a client might accept using. The message also tells clients about the lease period for the DNS server addresses, the IP address, the IP address of the server, the default gateway, and the subnet mask. All this information ensures that the device is fully integrated into the network.
3. DHCP request
The DHCPREQUEST is a protocol that safeguards and guides the client in a network with multiple servers. Some networks, typically large ones, can have multiple servers, all capable of receiving the discovery message and sending out an offer to the client with an IP address. Because this is a possibility, the DHCP client is structured to send out a request message after receiving an offer which may be the first of many offers.
The DHCP request message confirms the choice of the client and usage of the IP address in the offer it received. The request message is transmitted with the server’s IP address embedded in the chosen offer message. The server that sent out the offer message chosen then receives the request message and certifies that the client’s IP address is unavailable for other devices. If other servers send out offer messages, they will return the offered IP addresses to their pool of addresses while waiting for another device that may need it.
4. DHCP acknowledgment
DHCP acknowledgment is the final step in the initialization process. It is a message sent by the server that supplied the IP address. The message is defined as “DHCPACK”, acknowledging that the IP address in question has been successfully leased to the client. The configuration is complete at this stage, and the client has a new, functional IP setting.
5. Control of lease time
DHCP is a dynamic protocol because it does not assign permanent IP addresses to the clients. While this may be perfect for some devices, DHCP attaches a specific lease time to each IP address. Once this period is up, the client can no longer use the address and is removed from the network. The concept of lease time serves to eliminate inactive clients.
For clients operating in the network, the lease is renewed halfway through the time, so the user does not experience any downtime. On the other hand, an inactive user cannot renew the lease and is removed from the network. Devices that are shut down also have their lease terminated immediately to increase the pool of available addresses.
#networkswitch #topology #ethernet #firewall #fiberoptics
#networkdiagram #network #gigabit #bandwidth #networkanalysis
#protocols #routing #scheduling #servers #networkmarketing