Computers & ProgrammingBasic NetworkingComputers & Networking

What is DHCP?

IP Networks use the Dynamic Host Configuration Protocol (DHCP), or Bootstrap Protocol (BOOTP) to dynamically assign an IP address whenever a TCP host connects to the local area network. The DHCP protocol has been around for quite some time.

The implementation of DHCP on the local area network is quite simple. There are generally no more than three components related to DHCP on the network, such as the DHCP server, the DHCP client, and the DHCP relay agent if you have a network with more than one subnet.

DHCP Server

The DHCP server is used to centralize and manage the pool of IP addresses that will be used to configure your network clients. A DHCP server could run on a variety of different types of network servers, such as Windows Server, or Linux. In addition, there are many network appliances such as the typical consumer-based Internet routers you may even have in your home network.

The main purpose of the DHCP server is to service DHCP clients and provide an IP configuration that is appropriate for the network segment that the client is located on. When a DHCP server negotiates an IP lease with the client, it will offer in its lease to the client, not only the IP address but also other IP settings such as a subnet mask, default gateway, DNS settings, etc.

Here are some of the most common lease options that are assigned to DHCP clients.

CodeOption NameDescription
1Subnet MaskSpecifies the subnet mask.
3RouterRouters (Gateways) on the client’s subnet.
6DNS ServersList of DNS servers available for the client.
15Domain NameDNS Domain Suffix the client should use.
44WINS/NBNS ServersList of NetBIOS Name Servers.
46WINS/NBT Node TypeConfigure NetBIOS clients as 1 = b-node, 2 = p-node, 4 = m-node, and 8 = h-node.

For a complete list of DHCP options, please visit IETF.org: RFC 2132.

DHCP Client

Most network devices, especially computers are configured by default as DHCP Clients. When a DHCP client boots up and senses network connectivity, it sends out a DHCP Discover on the network. This special packet is a broadcast packet.

Any DHCP server that receives this Discover packet will respond back with a DHCP Offer packet. The client may receive multiple offers from different DHCP servers. It will respond back to the Offer with a Request and if the DHCP server receives this response from the client, it will send back an Acknowledgement that the client may proceed with the use of the IP in the original offer.

This process is also known as DORA (Discover, Offer, Request, Acknowledgement). Once the DHCP lease is accepted and processed by the client, it holds on to this IP for a fixed amount of time that is set by the lease, usually 8 days (configurable in the DHCP scope). At 50% of the lease time, the client will begin the renegotiation of the lease.

If the client is unable to communicate with its DHCP server, it will attempt to do so again at 87.5% of the lease. It will continue to renegotiate until it is able to or the lease expires. If the lease expires, the process starts again with the client sending out a Discover packet. If the client is unable to acquire a lease, most operating systems, will issue themselves an APIPA address.

APIPA is short for Automatic Private IP Addressing. APIPA addresses are within the 169.254.x.x/16 subnet range. The DHCP client assigns itself the last two octets of an APIPA address automatically. An algorithm is used and factors in the client’s MAC address to ensure that the APIPA address is unique on the network.

This will at least allow all the DHCP clients on a single network to continue to communicate with each other in the event of a DHCP server failure. However, APIPA does not assign a default gateway since there is no router configured on the 169.254.x.x subnet so clients will have no Internet connectivity with an APIPA address.

The DHCP relay Agent

The DHCP relay agent is a Bootstrap Protocol that relays DHCP (DORA) messages between DHCP clients and DHCP servers on different IP Subnets. A relay agent can be a computer or device such as a router that intercepts DHCP broadcast packets and relays them as unicast packets to the configured DHCP server(s).

The DHCP server would then send responses back to the DHCP relay agent, and the relay agent sends the information back to the DHCP client. Since broadcast packets are not passed through routers, the relay agent is needed so that you can avoid having a DHCP server implemented on every subnet where you have DHCP clients.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top