Understanding the DHCP Protocol (Part 1)

by Don Parker [Published on 10 Jan. 2006 / Last Updated on 10 Jan. 2006]

DHCP is a little thought of protocol by many everyday computer users. Little do they know, though, that it plays a key role in the setup of their computer and how it is able to communicate. We shall explore its features and functionality within the confines of this two part article series.

If you would like to read the second part of this series please read Understanding the DHCP Protocol (Part 2).

DHCP and you

For many of the normal computer users out there today very little attention is paid to exactly how their computer goes about its business. This does not only include how your computer builds packets to convey information, but also how it initially gets the required information to set itself up to communicate. To whit, information such as its IP address, the DNS servers it will use, the DNS servers to use, amongst other critical details that your computer needs for it to access the Internet.

Well what exactly is DHCP or as it is commonly known as; Dynamic Host Configuration Protocol. Well simply put this is the protocol that delivers to your computer its IP address, DNS servers, gateway IP address (ie: the IP address of your router), and subnet mask. For many of us who use computers at our work this information is often done by the system administrator for us. Typically the system administrator will simply have DHCP enabled on the router so as to save them time. Though in some networks where security is of some concern, DCHP is disabled for a variety of reasons. I will touch on some of them briefly a little later on in this article. We should also realize at this point that the BOOTP protocol enjoys a symbiotic role with DHCP. We will also see this later on in the article.

If the network admin has DHCP disabled then she or he has a much more manual task to perform, as they will need to manually configure each computer with the required information. That can take a fair amount of time, which is largely why DHCP is indeed enabled on the router to simplify the network administrator’s life. With that said, DHCP is no exception to the almost de-facto client/server model. This protocol follows it just like almost other every protocol ie: Internet Explorer (the client) to IIS Web Server (the server). There are normally well known ports associated with such services as DHCP. In this case it falls over two separate ports. Specifically you have port 67 UDP for the DHCP server, and port 68 UDP for the host ie: the DHCP host will send its messages from port 68 to the DHCP server on its port 68, both using a transport protocol of UDP. Lastly, when it comes to protocols, I always mention where in the OSI Reference model it falls into. DHCP as such is considered an application layer protocol.

There are various ways that DHCP can go about its business of providing essential configuration details to its clients. It breaks down into three ways;

  1. It can automatically allocate a client a permanent IP address
  2. It can dynamically allocate an IP address for a finite amount of time, or until such time as the DHCP client releases the IP address
  3. Manual allocation, this is where the network system administrator actually manually configures the client (the actual workstation)

What is typically used though in a real network? Generally the second option provided above is the one used. This is done for a variety of reasons. Typically, on most corporate networks seen today, there is a small and overworked IT staff. Having the option of enabling the router to act as a DHCP server to handle IP address allocation is a rather attractive one. Going to each and every new computer for manual configuration is generally too time intensive to be considered as a practical option. Ideally though, DHCP is not enabled due to the security implications of it.

The last thing you want is to have a contractor show up on your network and plug in their laptop, thereby gaining immediate access to an otherwise well protected network. The same goes for employee’s plugging in their own laptops and doing things they should not be doing, such as sniffing traffic and other potential mayhem. Having the ability to restrict IP address access is, or should be, a primary concern to the system administrator. That is simply a good practice to observe as it is practical security. You may have noticed so far that we have only talked about DHCP in terms of clients (ie: actual workstations). DHCP itself is not used to supply the same information to routers, it is strictly intended for use with the aforementioned client/workstations. This is an important point to remember.

With the above said though, are there any general statements that we can come away with as it regards DHCP itself and its application on your network? Certainly there is, and hopefully remembering those will prompt your memory to the more fine grain details of the protocol itself. The overall goal of DHCP is to provide configuration details to DHCP clients. It is also meant to make sure that all IP addresses being used are unique, and that you don’t have two of the same IP addresses on your network. That would cause rather obvious problems on your network if it were the case. When reboots of the client/workstation occur they should retain the same configuration parameters ie: the IP address, DNS server info, subnet mask and the such. Also it should be able to work with statically assigned IP addresses. You could call these design goals of DHCP, as they are the functionality provided by it.

Every protocol and specifically application layer protocols typically have various ways of communicating data. DHCP is no exception to this general rule. We shall cover below various message types that DHCP will use in the execution of its duties.

DHCP Message Types

  1. DHCPDISCOVER
    This DHCP message type is used by the DHCP client to discover DHCP servers.
  2. DHCPOFFER
    This DHCP message type is used by the DHCP server to respond to a received DHCPDISCOVER message and also offers configuration details at that time.
  3. DHCPREQUEST
    This message comes from a client and to the DHCP server to convey three various messages. The first is to request configuration details from one specific DHCP server and specifically rejecting offers from any other potential DHCP servers. Secondly it can be used for verification of previously used IP address after a system has undergone a reboot. Lastly, it can be used to extend the lease of a specific IP address.

There are other message types to be seen, but you can read those separately if you so choose. The biggest thing to realize here is that there is a variety of DHCP message types that can be sent. Each of these affords the client or server various functionality. It is important to note that learning about network protocols, while sometimes dry, is key to a deeper understanding of how computers communicate. If you can grasp the fundamentals of computer to computer communications then you will have vastly increased your knowledge of a key area that is required of today’s IT professional. In the final part of our DHCP article series we will go over and discuss two actual DHCP packets. After all, seeing is believing as they say, and it always helps to have a practical example to help cement our lessons learnt. Till then!

If you would like to read the second part of this series please read Understanding the DHCP Protocol (Part 2).

See Also

Advertisement

Featured Links