What is DHCP (Dynamic Host Configuration Protocol)?

The DHCP service leases IP address configurations to client devices, ensuring accurate settings with as little administrative effort as possible.

What is DHCP (Dynamic Host Configuration Protocol)Network devices rely on various identities. For example, network interface cards (NICs) are hard coded with unique Media Access Control (MAC) addresses, and individual computers have hostnames assigned during the operating system installation.

But what about Internet Protocol (IP) address identifiers and their corresponding network settings? Network devices require such configurations, but it would be challenging for administrators to manage these settings manually. That's where DHCP comes into play.

How Does DHCP Work?

The Dynamic Host Configuration Protocol (DHCP) service maintains a pool of available IP addresses and dynamically leases these configurations to client computers. Network client devices on IP networks, such as computers, smartphones, tablets, etc., include a client-side service to request an IP address configuration from a DHCP server. The server responds by allocating an address and the related settings. On most networks, this process occurs in just a few seconds. The DHCP service usually resides on a server or router.

The Lease Generation Process

Client systems use a process called a lease to request an IP address configuration from a DHCP server. The lease generation process consists of four steps:

  1. Discover: The client broadcasts a query to find a DHCP server
  2. Offer: The DHCP server offers an IP address to the client
  3. Request: The client requests the use of the offered IP address
  4. Acknowledge: The DHCP server acknowledges the request and marks the IP address as leased in its database

DHCP clients must check in with the DHCP server periodically to ensure the IP address settings they leased are still valid. The lease renewal process is steps three and four of the process above (Request and Acknowledge). For example, a Windows Server-based DHCP service requires clients to renew the IP address settings every eight days by default.

The Importance of DHCP in Computer Networking

DHCP is an essential network service on TCP/IP networks because it offers several benefits:

  • Minimizes configuration mistakes
  • Allows automatic configuration of endpoints without administrator effort
  • Easily implement changes
  • Recycles IP addresses in transient environments
  • Logs leases for troubleshooting and auditing

However, you should note that administrators use DHCP in tandem with static or manual configurations. Static IP addressing is necessary for some network devices.

Comparison of DHCP vs. Static IP Address Configuration

Most networks rely on a combination of dynamic and static IP address configurations. Some services, such as DHCP itself, require a fixed or unchanging network identity. In fact, most servers and network devices (smart switches, routers, NAS storage, etc.) need a consistent address.

The following devices typically require a static IP address configuration:

  • Servers
  • Routers
  • Switches
  • Firewalls and proxies
  • Printers
staticIP

Figure 1: Static IP address configuration in Windows

These devices usually receive a dynamic IP address configuration via DHCP:

  • Desktop systems
  • Laptops
  • Tablets
  • Smartphones
dynamicIP

Figure 2: Dynamic IP address configuration in Windows

Consider tracking static IP address assignments to avoid duplicates. You can use spreadsheets on small networks, and on larger networks, services like IPAM track these allocations for you.

Screen Shot 2021-02-04 at 5.11.29 PM

Figure 3: Example spreadsheet to track static IP address configurations

Components of DHCP

DHCP uses various terms, and it's useful to ensure you have a basic understanding of these concepts:

  • DHCP server: Network device with the DHP service installed and configured with a scope or pool of available IP addresses
  • DHCP client: Network device configured to lease an IP address from the DHCP server
  • IP address and subnet mask: The primary logical identifier for the network device when the IP address contains two parts: A network ID and a host ID
  • Default gateway: IP address of the router that provides connectivity to other network segments
  • DNS server: A Domain Name System (DNS) name resolution server hosting a database that relates easy-to-remember names with difficult-to-remember IP addresses – DNS is a critical network service
  • Segment/Subnet: A division of a network identified by a network ID, when administrators create segments for performance or security reasons
  • Lease duration: Length of time an IP address lease from a DHCP server to a DHCP client is valid, usually measured in hours or days
  • Scope: Pool of available IP addresses and related options, such as default gateway and DNS servers – a DHCP server may host multiple scopes

Watch for the use of these terms in the following three examples.

dhcp-scope

Figure 4: A DHCP scope in Windows Server showing the first and last available IP addresses in the range

3 Examples of Using DHCP

Consider the use of DHCP in the following three common scenarios. The examples begin with a small network and progress to larger environments.

1. SOHO Environment

The small office/home office (SOHO) internet routers we all use at home almost always include a DHCP service. DHCP is usually preconfigured to provide addresses to standard home devices, including computers, phones, tablets, gaming consoles, TV and Internet of Things (IoT) appliances.

The benefit is that home users can easily add devices to their network from various manufacturers without having the technical knowledge to manage settings such as subnet masks and gateways.

Some SOHO routers even offer two networks—a standard home segment and a second guest segment—each with its own scope. DHCP IP address lease time durations are relatively long for home networks since most devices will remain connected for a very long time. In addition, these devices support both wired and wireless connections.

2. Coffee Shop Network

Imagine you're opening a new coffee shop in your hometown and want to offer wireless internet access to your customers. Some coffee shops even offer network printers and smartboards via Wi-Fi to encourage business meetings or other endeavors.

A router or server configured with DHCP can manage a segment with print devices for customers while also providing more robust services to a private business segment for employees to manage scheduling, accounting, inventory, etc. As with SOHO networks, this configuration is straightforward and does not require much technical knowledge to implement.

DHCP IP address lease durations in these scopes are relatively short since most customers will only be in the coffee shop for a limited time (perhaps one hour).

3. Business Network

DHCP saves a significant amount of time in business network environments. Imagine a call center with 500 cubicles equipped with a standard desktop computer on a wired network. Without DHCP, administrators would have to go to each computer to configure IP address settings. No duplicates and no typographical errors can occur during the configuration. Furthermore, if any machine is replaced, the new device must receive the identical configuration, adding time to the system's return to business and increasing the risk of a misconfiguration.

DHCP manages these environments effortlessly. Once the administrator configures a scope of available IP addresses and enters gateway and DNS settings, the individual computers lease their configurations automatically. The DHCP server does not make typos and will not knowingly lease duplicate addresses (the service includes a mechanism for checking for duplicates, too). When administrators replace a computer, the device automatically leases a new IP address configuration, providing connectivity to the rest of the business wide area network (WAN).

In addition, if the network environment changes, administrators can update the DHCP server with the modifications, and the client computers will receive the updates. Perhaps you added a new DNS server to the segment or are forced to change the router's IP address (default gateway). It is far easier to update the DHCP server and let the changes propagate to the clients than updating 500 clients manually.

Advantages and Disadvantages of DHCP

DHCP doesn't really have disadvantages and few vulnerabilities, but it is used in specific cases. Typically, network servers and devices should have static IP address settings.

It's essential to get the DHCP pool configuration correct, however. Consider the following possible problems:

  • Duplicate DHCP servers on the same segment may cause one group of DHCP clients to be configured differently than another group.
  • Misconfigured options on the DHCP server may cause clients to receive the incorrect settings. Be especially careful to get the default gateway and DNS settings correct.
  • DHCP servers with overlapping address pools may cause clients to lease duplicate IP addresses. The resulting IP address conflicts cause various configuration problems for the clients.

DHCP offers many advantages over static IP addressing for client computers. The most significant benefits are efficiency and consistency. Clients are essentially self-configured during the boot process, requiring no effort from deployment teams and ensuring the clients are all configured the same way. Most operating systems assume the device will be a DHCP client. Administrators do not have to manually configure the devices, which would introduce the possibility of duplicates and errors. Today's DHCP servers support both IPv4 and IPv6 addresses.

DHCP Best Practices

DHCP is not a difficult or glamorous service, but it is a crucial one. It ensures client machines can participate on the network and find two key services—routing and name resolution—necessary for communication. It simplifies the administrative process, allowing administrators to focus on other more finicky services.

Use the following best practices to ensure DHCP makes your life easier:

  • Carefully configure options such as default gateways and DNS servers
  • Document IP address ranges in multi-DHCP environments
  • Configure pools with the correct number of addresses
  • Explore the advanced settings available on Windows Server-based DHCP servers, including failover, duplicate address detection and logging

In most environments, the DHCP network management protocol is a set-it-and-forget-it service, but it's one that your network clients rely on daily.

Learn the skills you need with CompTIA CertMaster Learn. Sign up today for a free trial today!

Email us at [email protected] for inquiries related to contributed articles, link building and other web content needs.

Read More from the CompTIA Blog

Leave a Comment