An Introduction to Dynamic Host Configuration Protocol

An Introduction to Dynamic Host Configuration Protocol

Let’s imagine you’re a system administrator at a large company. You are implementing a new network of several hundred computers. All is fine and well until you realize: you have to manually input every single IP address, subnet mask, and gateway settings onto every single computer. You’re paid well, but maybe not that well.

For those of us who don’t think many hours worth of data entry is fun, we turn to DHCP- or Dynamic Host Configuration protocol.

What is DHCP?

Dynamic Host Configuration Protocol was developed to automate the assignment of IP addresses, subnet masks, gateways, and other IP parameters. It allows for much capability- both with the administrator and end-user. It saves the administrator the trouble of modifying IP information every time an implementation or upgrade is conducted. End-users appreciate it since it allows for quick and simple connections to a network- often without any configuration needed.

DHCP was created by the Internet Engineering Task Force (IETF) and became a standard in 1993, where it succeeded the BOOTP protocol. DCHP is actually based on the BOOTP protocol, which can be seen as a simpler and less complex solution to DHCP. The transition was needed since BOOTP was not designed to provide dynamic address assignment. Instead, administrators tediously maintained configuration files for each host on the network. Instead of a multitude of configuration files, a dynamic alternative was created with DHCP.

How Does DHCP Work?

DHCP works within four steps: DHCP discovery, DHCP offers, DCHP requests, and DHCP acknowledgement.

DHCP Discovery

DHCPDISCOVER

When a computer is connected to a DHCP-enabled network, it will send out a broadcast. This broadcast, known as DHCPDISCOVER, will be sent out in hopes of finding the DHCP server. Optionally, the client will request that the last known IP information the client used on the network be used. (Based on the settings of the DHCP server, this request may be fulfilled or denied.)

DHCP Offers

DHCPOFFER

The DHCP will then receive a lease request from the client. This lease determines how long the client can expect to use the IP information it will obtain from the server. A DHCP message referred to as DHCPOFFER is sent back from the server to the client. This message contains the lease duration, IP address, subnet mask, the client’s MAC address, and the IP address of the DHCP server that issued the message.

DCHP Requests

DHCPREQUEST

Upon a successful transaction of information, the client must then tell the DHCP server that the information was indeed received and accepted. A broadcast is initiated with the DHCP server’s IP address. This will tell other possible DHCP servers that they shouldn’t issue IP information to the client, since the client already obtained the necessary information. This will help free up IP addresses for other computers, as only one lease can be obtained per network interface card.

DHCP Acknowledgement

DHCPACK

DHCP acknowledgement is the final phase in the information exchange between server and client. In this phase the server obtains the DHCPREQUEST message from the client, and sends back a DHCPACK message. This packet of information includes the lease duration, as well as any configuration information the client may have requested. At this point the process is complete, and the client will configure its IP information accordingly.

Common DHCP Leases

As you’ll recall, the lease is the length of time the client can expect to hold the information obtained by the DHCP server. To fully grasp the need for leases in DHCP configuration, we need to know the significance of the network it is installed on. Leases are commonly set to anywhere from 15 minutes to several months- so what’s the ideal lease time?


    • 15 Minutes – You may use a lease time of 15 minutes when there are more clients than there are IP addresses. This will ensure that every client on the network will have the capability to access network resources, even though there may not be enough IP addresses present. This may be a good choice for a popular wireless access point, for example. Keep in mind this will lower network performance as a result of an increase in DCHP messages.

 

    • 24 Hours – The default setting on many DHCP servers. This will renew IP information for devices every 12 hours, since we have a 24 hour lease time. (Renew time is 50% of the lease time. If the renewal fails for some reason, it will try again in 6 hours, in our example.) A 24 hour lease time will allow new users to connect to a network on a daily basis- good for both home and work applications.

 

    • 1 Week – This timeframe will allow networks that seldom change to still operate. If a change in network structure does indeed occur, clients will need the changes to propagate throughout the network to function properly. This allows for a certain level of flexibility, but also ensures that the(normally) conservative network isn’t congested with DHCP traffic.

 

    • 4 Months – This lease is more for stable networks that are unlikely to change. In particular they are best suited for educational networks that allow a summer break. Obviously, computers will be unlikely to be used for a period of around 3 months while summer being observed. This will allow networks to keep IP information despite the long inactivity.

 

    • 1 Year – If a user hasn’t used an IP address in 6 months, the user is most likely not coming back. This is good for networks that have a large amount of IP addresses to administer to a wide range of clients. If a user hasn’t come back in 6 months, we can recover the IP information for future use. Obviously, the priority here isn’t for clients- but rather simple housekeeping.

 

    • Infinite – It is highly recommended that lease times not be set as infinite. This will effectively create a set in stone network. If a laptop user happens to request an IP address and never comes back, that IP address is lost for all of infinity. It should be noted that some devices don’t support the infinite lease setting- which may result in server crashes and other related problems.

Closing Comments

DHCP is a very commonly used protocol. If you’ve ever looked at a computer’s IP settings and seen the option “Obtain an IP address automatically,” you can be sure DHCP is hard at work. This is the very same hard work that would’ve been given to the unfortunate system administrator. Clearly, DHCP is one of the “I’m sure glad someone thought of that!” protocols would be hard to imagine life without.

19 Comments

  1. Balakumar March 10, 2008
  2. Nimish Thakkar May 9, 2008
  3. krishnamoorthy May 15, 2008
  4. Razzak Thakur May 30, 2008
  5. Fede June 11, 2008
  6. perry July 3, 2008
  7. Keerthi Prasad M August 29, 2008
  8. Bill Clark October 24, 2008
  9. bhuvan November 3, 2008
  10. Edward Sassoon November 5, 2008
  11. Skyler November 11, 2008
  12. parth upadhyay December 1, 2008
  13. harshad March 2, 2009
  14. Bullton Francis March 6, 2009
  15. sunil March 6, 2009
  16. MMF March 24, 2009
  17. A.Sadanandam May 12, 2009
  18. andualem June 1, 2009
  19. Snehal k June 7, 2009

Leave a Reply