What Is DHCP? (Dynamic Host Configuration Protocol) 2021


DHCP (Dynamic Host Configuration Protocol) is a protocol that provides quick, automatic, and central management for the distribution of IP addresses within a network. It's also used to configure the subnet mask, default gateway, and DNS server information on the device.

The Dynamic Host Configuration Working Group of the Internet Engineering Task Force created DHCP.

How DHCP Works

A DHCP server issues unique IP addresses and automatically configures other network information. In most homes and small businesses, the router acts as the DHCP server. In large networks, a single computer might take on that role.

James Boast / Ikon Images / Getty Images

To make this work, a device (the client) requests an IP address from a router (the host). Then, the host assigns an available IP address so that the client can communicate on the network.

When a device is turned on and connected to a network that has a DHCP server, it sends a request to the server, called a DHCPDISCOVER request.

After the DISCOVER packet reaches the DHCP server, the server holds on to an IP address that the device can use, then offers the client the address with a DHCPOFFER packet.

Once the offer has been made for the chosen IP address, the device responds to the DHCP server with a DHCPREQUEST packet to accept it. Then, the server sends an ACK to confirm that the device has that specific IP address and to define the amount of time that the device can use the address before getting a new one.

If the server decides that the device cannot have the IP address, it will send a NACK.

Pros and Cons of Using DHCP

A computer, or any device that connects to a network (local or internet), must be properly configured to communicate on that network. Since DHCP allows that configuration to happen automatically, it's used in almost every device that connects to a network including computers, switches, smartphones, and gaming consoles.

Because of this dynamic IP address assignment, there's less chance that two devices will have the same IP address, which is common when using manually-assigned, static IP addresses.

Using DHCP makes a network easier to manage. From an administrative point of view, every device on the network can get an IP address with nothing more than their default network settings, which is set up to obtain an address automatically. The alternative is to manually assign addresses to each device on the network.

Because these devices can get an IP address automatically, devices can move freely from one network to another (given that each device is set up with DHCP) and receive an IP address automatically, which is helpful with mobile devices.

In most cases, when a device has an IP address assigned by a DHCP server, that address changes each time the device joins the network. If IP addresses are assigned manually, administrators must give out a specific address to each new client, and existing addresses that are assigned must be manually unassigned before other devices can use that address. This is time-consuming, and manually configuring each device increases the chance of errors.

When to Use a Static IP Address

There are advantages to using DHCP, and there are disadvantages. Dynamic, changing IP addresses should not be used for devices that are stationary and need constant access, like printers and file servers. Although these types of devices exist predominantly in office environments, it's impractical to assign them with a changing IP address. For example, if a network printer has an IP address that will change at some point in the future, every computer that's connected to that printer will have to regularly update their settings to understand how to contact it.

This type of setup is unnecessary and can be avoided by not using DHCP for those types of devices, and instead by assigning a static IP address to them.

The same idea comes into play if you need permanent remote access to a computer in a home network. If DHCP is enabled, that computer will get a new IP address at some point, which means the one you recorded for that computer will not be accurate for long. If you use remote access software that relies on an IP address-based access, disable DHCP and use a static IP address for that device.

More Information On DHCP

A DHCP server defines a scope, or range, of IP addresses that it uses to serve devices with an address. This pool of addresses is the only way a device obtains a valid network connection.

This is another reason DHCP is so useful. It allows several devices to connect to a network over a period of time without needing a pool of available addresses. For example, if 20 addresses are defined by the server, 30, 50, 200, or more devices can connect to the network as long as no more than 20 devices use one of the available IP addresses simultaneously.

Because DHCP assigns IP addresses for a specific period of time (called a lease period), using commands like ipconfig to find a computer's IP address yields different results over time.

While DHCP is used to deliver dynamic IP addresses to its clients, it doesn't mean static IP addresses can't also be used at the same time. A mixture of devices that get dynamic addresses and devices that have their IP addresses manually assigned to them, can both exist on the same network.

ISPs use DHCP to assign IP addresses. This can be seen when identifying your public IP address. It will likely change over time unless your home network has a static IP address, which is usually only the case for businesses that have publicly accessible web services.

In Windows, APIPA assigns a special temporary IP address when the DHCP server fails to deliver a functional one to a device and uses this address until it obtains one that works.

DHCP Error: What It Is and How to Fix It