Glossary: DHCP

What is DHCP?

What is DHCP? Everything you need to know

The quick answer to “What is DHCP?” (or Dynamic Host Configuration Protocol) is that it’s the standard mechanism to dynamically assign IP addresses within a network. IP, which stands for Internet Protocol, is how devices on a network communicate with each other.

IP addressing is a logical means of assigning addresses to devices on a network. Each device connected to a network requires a unique IP address.

At home, DHCP assigns IP addresses to your smartphones, laptops, tablets, and IoT (internet of things) devices like doorbell cameras. When you use wifi on your home network, typically your router is a DHCP server.

In a large enterprise setting, a DHCP server is usually a dedicated computer.

In this glossary entry, we’ll explore the fundamentals of how DHCP works. Then, we’ll take a deeper look at two aspects: dynamic addressing and the communications protocol.

What is DHCP? How does it work?

When a client device (also called a DHCP client) such as a laptop or smartphone joins a network, it typically requests an IP address from a DHCP server. These servers are often set up in a DHCP configuration with redundancy or clustering among other network servers. Servers can run on IPv4 or newer IPv6 networks or can be dual-stacked to simultaneously support both.

What is DHCP

The server will quickly and automatically assign an IP address and some related network configuration parameters. Once the device has accepted the assignment, it can communicate with both the internal network and the public internet.

When you use an IPAM solution in isolation, integration with DNS and DHCP gets dicey.

A quick review of networking basics

A networking protocol suite that includes IP and other protocols governs the rules for packetizing, addressing, transmitting, routing, and receiving data over networks.

Small units of data called packets are routed through a network. A source host, like your computer, sends these IP packets to a destination host, such as a server, based on IP addresses in packet headers.

An IP address has two numeric parts. One part identifies the host address, such as a computer or other network device. The other part identifies the address of the network it belongs to.

Delivery between networks is handled by routers, specialized computers that connect two or more local networks together.

Relevant parameters

In addition to assigning IP addresses, DHCP servers also provide relevant parameters, known as DHCP options. Clients can send their own options as part of the request. The Internet Assigned Numbers Authority (IANA), the global coordinator of IP addresses, defines available DHCP parameters.

Options number in the hundreds. Basic ones include how long the IP address can be used—known as the lease time—the default gateway, its subnet mask, and its DNS server.

Let’s define some of these terms we just mentioned:

  • A default gateway serves as an intermediary between the local network and the internet, or between local subnets, transferring data back and forth. Essentially, this is the router connecting a subnet to the rest of the network.
  • IP networking uses a subnet mask to separate the host address and the network address portions of a DHCP IP address. This helps devices know which addresses are local and which need to be sent via the local router.
  • A DNS server resolves names to IP addresses, translating domain names that we easily remember, like bluecatnetworks.com, into IP addresses like 104.239.197.100.

Dynamic IP addressing with DHCP

DHCP assignment of IP addresses happens dynamically within a given address range. This means that a device connected to the network doesn’t have a forever address unless the address is reserved specifically for that device. The IP address can periodically change as its lease time expires unless the lease is successfully renewed. DHCP servers also have a defined range of IP addresses they can assign.

For services that always need to be on, a static IP address is often a better option than a dynamic one. Corporate enterprises commonly use static IP addresses for hardware like mail servers. Certainly, a DHCP server should have a static IP address.

However, dedicating a specific IP address to a device or service has its shortcomings. A network administrator must manually assign, configure, and track the IP address. It’s a time-consuming task. Oftentimes, that requires the admin to physically be with the device.

Dynamic IP addresses are usually the preferred choice because they:

  • Cost less to manage than static IP addresses;
  • May offer more privacy and security with a constantly changing IP address; and
  • Don’t require manual administration when a device roams from one subnet to another.

DHCP communications protocol

Communications to fulfill a DHCP request involves the DHCP server and client. Furthermore, in most enterprise networks, a DHCP relay agent or IP helper facilitates communication between the two. Relay agents receive broadcast DHCP messages from clients and then re-send those messages with configuration information to DHCP servers.

Server and client communications

The server and the client send several communications back and forth. Here’s how it essentially happens: 

  1. First, the client sends a request, a DHCPDISCOVER packet, to the local network. If a DHCP server is not on the local network, a DHCP relay or IP helper will forward the request to one or more configured DHCP servers. The client will send DHCP options as part of the request.
  2. Next, the server receives the request and attempts to find an available IP address. Once one is identified, the server sends a broadcast DHCPOFFER packet. If multiple DHCP servers receive the request, they may all respond with a packet. The DHCPOFFER packet includes options such as the lease time.
  3. Then, the client receives the DHCPOFFER packet and, after validating the contents, sends a DHCPREQUEST packet to accept the IP address. If multiple DHCPOFFERs were received, the client chooses any one of them to accept. To validate the DHCPOFFER, the client uses the Address Resolution Protocol to ask the local network if the address is already in use.
  4. Finally, the server sends a DHCPACK packet to confirm the chosen IP address. The DHCPACK packet also includes the same DHCP options as in the DHCPOFFER. The “ACK” in DHCPACK is short for “acknowledgment”.
  5. Furthermore, if a server can’t confirm an IP address for a device, it may send a DHCPNAK packet, or negative acknowledgment. Typically, this happens when the server receives a DHCPREQUEST for an address outside the subnet or when the requested address is already in use by another client.

Four steps to DHCP communications

Renewing a lease

When a client has used an address for a significant portion of its lease, it can try to renew it. In this case, it starts by resending the DHCPREQUEST message. If all is well, the server will respond with a new DHCPACK message.

BlueCat DDI

The IP address management (IPAM) effort, along with DHCP and DNS, are together known as DDI. Want to know how DHCP works with DNS and IPAM to form a complete DDI solution? The BlueCat platform is the place to start.