Blog
    Published Date: 11-Jul-2021
DHCP Server Complete Guide

Dynamic Host Configuration Protocol (DHCP) assigns IP addresses to devices on a network. It centralizes address ownership so that no single device on the network has a permanent address. DHCP is part of the TCP / IP suite of protocols and is considered an application layer protocol in the TCP / IP stack.

The protocol allows network administrators to assign addresses to devices connected to the network. The address format that the system uses is an IP address, which is defined in the Internet Protocol – another part of the TCP / IP protocol suite.

Not all ISP clients are connected to the Internet at the same time, so home users are no longer assigned permanent addresses

IP ADDRESSES, ISP

DHCP is commonly used by ISPs to assign IP addresses to clients. This system allows ISPs to use the address pool more efficiently. Not all ISP clients are connected to the Internet at the same time, so home users are no longer assigned permanent addresses . Instead, each is assigned an address for the duration of the connection. Private Wi-Fi routers implement the same method for the networks in which they operate.

IP addresses must be unique within the network they access. Thus, on a private network, IP addresses do not have to be unique globally, only on that network. IP addresses connected to the Internet cannot be duplicated anywhere on the Internet. DHCP deals with the allocation of IP addresses from a reserved pool. 

What is DHCP?

The protocol establishes procedures for requesting and allocating IP addresses on a network. These definitions include a series of message types that the distribution process must include.

Like all other protocols supported by the IETF, DHCP is not a program. It is simply a set of standards that anyone who wants to create software for the DHCP address allocation function must follow. The importance of publicly available networking standards is that they ensure the compatibility of networked programs no matter where in the world they were written.

A key element of the DHCP method is the procedure that the client initially uses to communicate with other devices on the network. As all computers on a network need a unique address to communicate , the question of how any computer can communicate to obtain an address is a mystery that DHCP solves.

The DHCP methodology is defined in a document that is publicly available and maintained by the Internet Engineering Group. The IETF presents the current protocol status on its website as RFC 3942. This document defines DHCP version 4. The original system definition is contained in two documents: RFC 2131 and RFC 2132 .. There is a collection of additional protocol definitions that complement the standard published in RFC 3942 . . For example, RFC 4242 explains how to adapt the protocol to use IPv6 addresses.

How DHCP works

There are two main elements of a DHCP system. They are DHCP server and DHCP client. A DHCP client is found on each of the devices you have connected to your network. When this device is turned on, the DHCP client starts up as part of the operating system startup procedures.

The device does not have an IP address and therefore cannot send messages with a return address. Instead, the client includes its MAC address in the message. The MAC address is actually the identifier for this device’s network card. The MAC address of every network card in the world is unique.

The DHCP initialization process includes four types of messages:

  • opening
  • Offers
  • Inquiry
  • the confirmation

This is how these four messages, collectively abbreviated as DORA , implement the DHCP process.

DHCP Discovery

DHCP uses connectionless user data protocol for transmission. The request that the client sends is called the discovery message. The protocol calls this message type DHCPDISCOVER. UDP is a connectionless system, so there is no initial session establishment phase.

This is the first Discovery message sent over the network by the client. This means that it has not been sent to a specific address. This is because the DHCP client does not know the DHCP server address at this point.

Although it should be possible for each client to configure the network DHCP server address recorded in the configuration, the assumption of not knowing the address makes it easier to configure and manage DHCP. If you do not need to manually specify the DHCP server address to the client when adding a device to the network, the discovery operation becomes a universal procedure. … Any device can have a DHCP client loaded onto it as part of its firmware, and it is automatically placed on whatever network it is added to.

The lack of a fixed destination address also means that you can move a DHCP server from one computer on the network to another without having to go to every device on the network and without resetting that server’s address.

There is one fixed parameter for communication between clients and DHCP servers: the port number. UDP port # 67 is reserved for DHCP servers and UDP port 68 is reserved for DHCP clients. Thus, the transmission of the Discovery message does not bind the processors of other devices on the network. This is because only the DHCP server procedures will listen on the network for messages addressed to port 67. All other devices on the network simply ignore the message, since it is not sent to port 68 ..

DHCP offer

The response returned by the DHCP server is structured as DHCPOFFER. This message is sent over the network, so every computer on the system will receive it. This is UDP port 68, so the DHCP client on every network device will pick it up .

The intended recipient’s MAC address is contained in the message, so all other devices on the network will simply discard the message as soon as they see that it’s not for them.

The message contains the suggested IP address for the client. It also includes the duration, in seconds, that the device can use this address for. The allocation of IP addresses in DHCP is temporary and is called a “lease”. Duration is the lease time, or how long the client will keep this IP address.

Other information in the Offer message includes the subnet mask to be used for the network, DHCP server address, router address, and DNS server addresses on the network. With these addresses, the DHCP client can configure the network software on the device and fully integrate the hardware into the network.

DHCP request

You might think that allocating an address from a DHCP client by a DHCP server would be the end of the process. However, the situation is a little more complicated because the Protocol takes into account the possibility that multiple DHCP servers may be running on the same network. 

If there is more than one DHCP server on the network, the Discovery message that is sent to all devices on the network will be accepted by all DHCP servers. Each of them will send back an offer, so the client will receive multiple addresses. The client chooses one of these addresses, which is usually the first one it receives, and then sends back a request message confirming the use of that address.

At this point, the client has the IP address of the server that sent the selected offer message. However, the Request message is not addressed directly to this server. This is because all servers that send “Offer” messages need to receive a “Request” message containing the selected IP address.

The server that allocated the selected IP address receives a request message and records that the proposed address is currently in use. Other servers that submitted suggestions also receive this request message , find out that their addresses were not selected and leave those addresses available for the next Discovery message to be broadcast on the network. The protocol refers to the structure of the request message as DHCPREQUEST.

DHCP confirmation

The final step in the DHCP initialization process is a DHCP acknowledgment message sent by the server that provided the selected IP address. This message is defined in the protocol as DHCPACK. None of the other DHCP servers on the network send this message back.

Curiously, even if the client claims to be using the offered IP address, the DHCPACK is not sent directly to that address, but is sent again to all devices on the network.

DHCP client functions

The DHCP client does not get an IP address all the time. The lease time of the allocation depends on the network policy, and different lease terms may be set for different types of equipment. If the lease expires, the DHCP client must apply to renew it.

The update process is exactly the same as the initial discovery process, except this time the client has an address where it can contact the server that allocated that address. So, instead of sending a Discover message, the client can contact the DHCP server directly . The client can request the same IP address, or the network policy can dictate that each update should be performed with a replacement IP address.

Two additional message types in the DHCP definition are intended for use by the client: the DHCPINFORM message and the DHCPRELEASE option.

DHCP Inform

The DHCPOFFER message consists of several option fields in the packet structure. However, the server rarely uses all of this and does not matter to any. A specific client program may need specific information to properly configure its device on the network. If this important information is missing from the DHCP offer message, it may send a Report message asking for details. If this information is available, it will be sent by the server in the form of another offer message with mandatory filling of the parameter fields. … An example of the use of DHCP Inform is that the browser often uses this message as a way to obtain Web proxy settings through automatic Web proxy detection routines.

On Windows Server 2003, DHCP servers use the Inform message type to detect rogue DHCP servers.

DHCP release

The release message is sent by the client to end the lease on the IP address before the specified period expires. This type of message is not essential in protocol operations because regular lease termination ahead of schedule usually occurs when the user turns off the device. There are no procedures to delay the shutdown process to allow the DHCP client to send a release message. In this case, the IP address remains allocated to this client until its lease expires, even if the device is not active during this period.

DHCP is only concerned with the allocation of available IP addresses. It does not support communication with network nodes. The IP address is assumed to be in use for the duration of its lease, and therefore it does not verify that the device to which the IP address is allocated is still active on the network . If the network configuration is changed, the DHCP manager does not make any efforts to redistribute addresses. These restrictions explain why DHCP is typically implemented as part of a suite of network addressing protocols called DDI, which is explained below ..

DHCP server functions

Dynamic Host Configuration Protocol includes three methods for allocating addresses to a server. These:

  • Dynamic allocation
  • Automatic distribution
  • Manual distribution

Here is more detailed information on each of these modes of operation.

Dynamic allocation

This is the standard distribution method used by DHCP and follows the procedures outlined above. The server is configured with a range of IP addresses known as scope in DHCP terminology. This range may not be contiguous, so it is possible to declare exceptions within an address scope. Exceptions can also be defined as a range.

Automatic distribution

In this case, the server maintains a list of previous IP address assignments for the MAC addresses of devices on the network. When a new request comes from one of these addresses, the server will allocate the same address again. With automatic allocation, the address is assigned not only to the device, and therefore there may be cases when the previously used address has already been allocated elsewhere, and the server will send a different address to this device.

Manual distribution

In this option, the DHCP server reserves an IP address so that it can only be assigned to a specific MAC address. This means that each device receives the same address every time it connects to the network. You can mix manual allocation with dynamic or automatic allocation. If the device’s MAC address is not on the reservation list, you must use one of two other methodologies to allocate the address. This system is also known as static allocation, static DHCP, fixed address allocation, address reservation, DHCP reservation, IP address reservation, and MAC / IP address binding.

Other DHCP Hosts

Large networks are often subnetted to prevent delays caused by too many devices trying to access the transmission medium. In these cases, the network can still only work with one DHCP server, but it requires a relay device on each subnet.

The packet structure of all types of DHCP messages includes a field called GIADDR that is populated by the relay. This is the relay’s own address, so when a message received by the relay from the client is forwarded to the DHCP server, the server knows where to send the response and what address range to use to allocate the address on that relay. subnet.

When the relay agent communicates with the DHCP server, both devices use UDP port 67.

DHCP security weaknesses

DHCP uses the User Datagram Protocol. It is a connectionless communication system, so it does not include encryption. Since almost all types of messages in the protocol are designed to be broadcast in every network mode, snoopers can gain a lot of control over network operations and create a devastating violation by simply gaining access to the network and listening to DHCP broadcasts.

This is why DHCP is rarely used in isolation. There are a number of coordination issues to consider when allocating IP addresses. … These addresses must also be referenced by the DNS server. There is a possibility that an attacker could inject a virtual spoofed DNS or DHCP server into the network. Network security and address validity are ensured by the IP address manager. It is a key element in the DDI suite of solutions.

Related Posts
WiFi Solution For Everyone (SME, Hotels, Cafes, Healthcare, Education & Telecom
DDI / IPAM Systems to Solve Your IP Addressing
Smart City & WiFi Around the Globe
WI-FI 6 (802.11AX) SOLUTIONS