What Is DHCP? (Dynamic Host Configuration Protocol)

Definition of dynamic host configuration protocol

Picture of four hands using smartphones
© James Boast / Ikon Images / Getty Images

DHCP (Dynamic Host Configuration Protocol) is a protocol used to provide quick, automatic, and central management for the distribution of IP addresses within a network.

DHCP is also used to configure the proper subnet mask, default gateway, and DNS server information on the device.

How DHCP Works

A DHCP server is used to issue unique IP addresses and automatically configure other network information. In most homes and small businesses, the router acts as the DHCP server. In large networks, a single computer might act as the DHCP server.

In short, the process goes like this: A device (the client) requests an IP address from a router (the host), after which the host assigns an available IP address to allow the client to communicate on the network. A bit more detail below...

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

After the DISCOVER packet reaches the DHCP server, the server attempts to hold on to an IP address that the device can use, and 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, after which the server sends an ACK that's used 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.

All of this, of course, happens very quickly and you don't need to know any of the technical details you just read in order to get an IP address from a DHCP server.

Pros and Cons of Using DHCP

A computer, or any other 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, gaming consoles, etc.

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

Using DHCP also makes a network much 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 only other alternative is to manually assign addresses to each and every device on the network.

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

In most cases, when a device has an IP address assigned by a DHCP server, that IP address will change each time the device joins the network. If IP addresses are assigned manually, it means administration must not only give out a specific address to each new client, but existing addresses that are already assigned must be manually unassigned for any other device to use that same address. This is not only time-consuming, but manually configuring each device also increases the chance of running into human-made errors.

Though there are plenty of advantages to using DHCP, there are certainly some disadvantages as well. Dynamic, changing IP addresses should not be used for devices that are stationary and need constant access, like printers and file servers.

Although devices like that exist predominantly in office environments, it's impractical to assign them with an ever-changing IP address. For example, if a network printer has an IP address that will change at some point in the future, then every computer that's connected to that printer will have to regularly update their settings so their computers will understand how to contact the printer.

This type of setup is extremely unnecessary and can be easily 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 to have permanent remote access to a computer in your home network. If DHCP is enabled, that computer will get a new IP address at some point, which means the one you've recorded as that computer having, will not be accurate for long. If you're using remote access software that relies on a IP address-based access, you'll need to 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 can obtain a valid network connection.

This is another reason DHCP is so useful - because it allows lots of devices to connect to a network over a period of time without needing a massive pool of available addresses. For example, even if only 20 addresses are defined by the DHCP server, 30, 50, or even 200 (or more) devices can connect to the network so long as no more than 20 are using one of the available IP address simultaneously.

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

Though 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 are getting dynamic addresses and devices that have their IP addresses manually assigned to them, can both exist on the same network.

Even an ISP uses 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 can obtain one that works.

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