What is DHCP server

The Dynamic Host Configuration Protocol, also known as DHCP, is a client server application that automates the assignment of IP components to client machines. In that sense, client machines will go into the network without parameters and will request those parameters from a DHCP server.

The parameter information contained on the DHCP server ranges from the required IP address and default gateway and subnet mask to DNS servers, NetBIOS name servers, and other specialized parameters like TFTP servers and SIP servers, and the client belongs to the IP telephony world.

The specification on the RFC even includes VLAN IDs and quality of service parameters. The protocol can be based on a lease model in which machines rent their parameters and they can be reused by other machines if the original device is no longer in the network. Parameters are leased based on a certain time, which can be defined and can be different per IP address scope or per group of machines. You could also define manual allocations and fix parameters for a particular machine. Let us describe the DHCP process in more details.



How DHCP server work

In this figure, we have a client requesting IP addresses from a server. It looks like three clients and two servers just to illustrate the different stages of the process, but we are talking about the same client and the same server at this point. The first thing to say here is that each one of these calls is a local broadcast in terms of IP information. This is because the clients do not know the subnet that they belong to when they start because they obviously don’t have an IP address and the servers don’t know where to reply to, because the clients don’t have an IP address yet. So all of these calls will use a local broadcast and a destination IP address on the packet.

Clients will broadcast a request message, a discover message to servers, more than one server could see that message, and so that’s why you need the four stages here. UDP port number 67 is the destination port of a server, and UDP port number 68 is used by the client. The

servers will reply with an offer message, again this is still a local process because the client does not have a local address. It is a local broadcast at layer 3 but during the discover message, the server knows the MAC address of the client, and that’s why even though at layer 3 it is a broadcast in the destination, it will be unicast later too at layer 2 because the server will send information straight to the MAC address of the client. So overall, that’s how the process works.

After the discover message and the offer message, then more than one server could reply with an offer message, so the client has to make a decision as to which address or which information to take. So it will reply with a request message, deciding which server will provide the information. All along, offer messages include IP addresses but also other options like default gateways, leased time, expiration time, etc. Finally, the selected server will say, “Okay. I acknowledge your request with unicast message. Here is the information. Now we start a lease time, and you are the owner of the address temporarily.” And so that’s a DHCP acknowledgment message. The client will see it and will start operating.

The important thing about these is that if you place a router in the middle of the conversation, then routers will not forward local broadcasts. So you will have to configure that router as a dhcp relay client.


DHCP Address Allocation

Providing an IP address to a client is the most important task performed by a host configuration protocol. Together with that we are getting information for the network segment, default gateway, DNS servers, domain name, TFTP servers (important in the IP telephony) and so on. To provide flexibility for configuring addresses on different types of clients, the DHCP standard includes three different address allocation mechanisms:

  • Manual Allocation: Also known as reservation. A particular IP address is pre-allocated to a single device by an administrator. DHCP only communicates the IP address to the device. The IP address is mapped to the MAC address of the requesting device.
  • Automatic Allocation: DHCP automatically assigns an IP address permanently to a device, selecting it from the predefined pool of available addresses.
  • Dynamic Allocation: DHCP assigns an IP address from a pool of addresses for a limited period of time chosen by the server, or until the client tells the DHCP server that it no longer needs the address (like executing the command “ipconfig /release” under Windows OS).



What is DHCP Relay

DHCP relays are an important feature for large networks as they allow communication between DHCP servers and clients located on different subnets.

In small networks with only one IP subnet, DHCP clients can communicate directly with DHCP servers. Clients located on a different subnet than the DHCP server cannot communicate with that server without obtaining an IP address with appropriate routing information.

By installing a DHCP relay agent on different subnets in a large network, broadcast DHCP packets can be forwarded from a DHCP client to locate a DHCP server on a remote subnet. The relay agent’s IP address is stored in the gateway IP address (GIADDR) field of the DHCP packet, The DHCP server uses the GIADDR field to find the subnet where the relay agent received the broadcast, and then assigns IP addresses to that subnet. The DHCP server replies to the client with a unicast message to the GIADDR address and the relay agent will forward the response to the local network.


dhcp relay

Pin It on Pinterest