What Is DHCP? DHCP Process and Network Configuration Basics
Learn what DHCP is, how the Discover-Offer-Request-Acknowledgement process works, which network settings it supplies, and how DHCP leases operate on Linux networks.
What Is DHCP?
DHCP stands for Dynamic Host Configuration Protocol. It is a network protocol that automatically supplies devices with the settings they need to communicate over an IP network.
Without DHCP, an administrator would need to enter values such as an IP address, subnet mask, default gateway, and DNS server on every device. DHCP provides these values from a central service, reducing manual configuration and the chance of assigning duplicate or incorrect addresses.
DHCP uses a client-server model. A device configured to obtain its settings automatically acts as a DHCP client. A system or service that manages available addresses and responds to clients acts as a DHCP server.
DHCP Clients and Servers
DHCP client
A DHCP client is a device, host, or network interface that requests network configuration from a DHCP server. A workstation, laptop, phone, virtual machine, or server can be a DHCP client.
When a Linux host is configured for automatic network configuration, its network software acts as a DHCP client. The client requests an address and related settings, then uses the approved configuration for the duration of its lease.
DHCP server
A DHCP server is a system or service that allocates addresses and supplies network configuration to clients. It maintains an address pool: the range or collection of addresses that it can lease.
For example, a server might manage a pool of addresses for hosts on one local network. It can track which addresses are currently leased, which are available, and how long each lease remains valid.
Linux systems can perform either role. A Linux host may request configuration as a DHCP client, or it may provide configuration to other hosts as a DHCP server. This lesson focuses on the concepts rather than on a particular Linux server implementation.
What Information Does DHCP Provide?
DHCP can provide much more than an IP address. A successful configuration normally gives the client enough information to communicate on its local network, reach other networks, and translate hostnames into IP addresses.
| Setting | Purpose for the Client |
|---|---|
| IP address | Identifies the host at the network layer so it can communicate on an IP network. |
| Subnet mask | Identifies which part of an IPv4 address represents the local network. The client uses it to determine whether a destination is local or must be reached through a router. |
| Default gateway | Identifies the router the host uses to reach destinations outside its local network. |
| Domain name | Provides a human-readable network naming context that can be used when forming or interpreting hostnames. |
| DNS server | Identifies a server that translates domain names into IP addresses. |
| Lease duration | States how long the client may use the assigned address and related configuration before it must renew them. |
How the settings work together
The IP address gives the host a network identity. The subnet mask helps it distinguish local destinations from remote destinations. If the destination is remote, the host sends traffic to the default gateway.
The DNS server handles name resolution. For example, when software needs to contact a hostname rather than a numeric IP address, it can ask the supplied DNS server to translate that name. The domain name can provide the local naming context used with hostnames.
The DHCP DORA Process
When a client has no usable configuration and needs to find a DHCP server, it begins by sending a broadcast on its local LAN segment. A broadcast is a transmission intended for all hosts on the relevant local network segment.
The common four-stage exchange is called DORA, from the first letters of Discover, Offer, Request, and Acknowledgement. The exact packet details can vary by network state, but DORA provides a useful foundation for understanding the initial exchange.
| Stage | Message | Sender | Delivery Method | Purpose |
|---|---|---|---|---|
| Discover | DHCP Discover | Client | Broadcast on the local LAN segment | Finds available DHCP servers. |
| Offer | DHCP Offer | Server | Response to the client; delivery can involve broadcast or unicast behavior depending on the network state | Proposes an IP address, lease duration, and associated configuration. |
| Request | DHCP Request | Client | Broadcast during the initial selection exchange | Selects one offer and asks that server to provide the proposed configuration. |
| Acknowledgement | DHCP ACK | Server | Response to the selected client | Confirms the lease and supplies the final configuration details. |
1. DHCP Discover: locating servers
The client begins with a DHCP Discover message. Since it does not yet know the DHCP server's IP address, it broadcasts the message on the local LAN segment. DHCP servers that can serve that network can receive the discovery.
2. DHCP Offer: proposing configuration
A DHCP server answers with a DHCP Offer. The offer proposes an address from the server's pool and may include the subnet mask, default gateway, DNS server, domain name, and lease duration.
More than one DHCP server may receive the Discover and send an offer. In the simplified model, the client selects one offer, commonly described as accepting the first suitable offer it receives.
3. DHCP Request: selecting an offer
The client sends a DHCP Request to identify the offer it selected and request that configuration from the chosen server. During the initial exchange, this request is broadcast so that the other DHCP servers can see that their offers were not selected and can return those proposed addresses to their pools.
4. DHCP Acknowledgement: confirming the lease
The selected server sends a DHCP Acknowledgement, also called a DHCP ACK. This confirms that the client may use the address and supplies the final configuration details. The acknowledgement includes, directly or through the resulting options, the lease duration and the settings the client should use.
DHCP Leases and Renewal
A DHCP lease is a time-limited assignment of an IP address and related network settings. DHCP-provided configuration is therefore not ordinarily permanent. The server specifies how long the client may use the allocation.
The lease duration is communicated as part of the server's acknowledgement. A client that remains connected periodically performs lease renewal so it can retain or update its configuration. If renewal succeeds, the client can normally continue using the address. If the lease expires without a valid renewal, the client may need to obtain configuration again.
Leases allow a DHCP server to reuse addresses. A device that leaves the network does not need to keep its address forever; after the lease is released or expires, the address can become available for another client.
DHCP and Static Network Configuration
Static configuration means manually assigning network settings to a device instead of obtaining them automatically. DHCP centralizes that work in a server, while static configuration places the responsibility on the administrator or device configuration.
| Aspect | DHCP | Static Configuration |
|---|---|---|
| How settings are assigned | A DHCP server supplies the settings to a client. | An administrator or local configuration manually specifies the settings. |
| Administrative effort | Centralized and generally easier for many changing devices. | Each device must be configured and maintained separately. |
| Address duration | Usually temporary and controlled by a lease. | Usually remains assigned until someone changes it. |
| Typical use | Workstations, laptops, phones, and other general network clients. | Devices that need a predictable address, when manually managed or otherwise deliberately assigned. |
For example, manually configuring an office workstation requires entering its IP address, subnet mask, gateway, and DNS server. With DHCP, the workstation requests those values and receives them from the network service.
Practical DHCP Examples
A new workstation joins an office network
When a new workstation starts, its network interface acts as a DHCP client. It broadcasts a Discover message, receives a proposed address and network settings, selects a server response, and receives a confirmed, time-limited lease. The gateway information lets it reach networks beyond the office LAN, while the DNS information lets it use hostnames.
Several DHCP servers respond
A client may receive multiple Offers after its broadcast Discover. It selects one offer and broadcasts a Request identifying the selected configuration. The chosen server finalizes the lease with an ACK, while the other servers can withdraw their unused proposals.
A laptop renews its lease
A laptop that remains connected does not assume that its address is permanent. As the lease period requires, the laptop contacts the DHCP service to renew or refresh the allocation. A successful renewal allows it to continue using valid network settings.
DHCP Troubleshooting Concepts
The client does not receive an IP address
- Confirm that the client is configured to obtain its settings through DHCP.
- Confirm that a DHCP server is available and reachable on the relevant LAN segment.
- Check whether the server's address pool still contains available addresses.
- Check whether the initial client broadcasts can reach the server. Broadcasts normally remain within a local network segment unless a device such as a DHCP relay is configured to pass the requests onward.
The client has an IP address but cannot reach other networks
- Verify that the DHCP configuration included the correct default gateway.
- Verify that the subnet mask correctly describes the local network.
- Distinguish a routing or gateway problem from a failure to obtain an address.
The client can reach IP addresses but not domain names
- Verify that the DHCP server supplied valid DNS server information.
- Distinguish DNS name-resolution problems from basic IP connectivity problems.
- Remember that a working IP address does not by itself provide name resolution.
Connectivity fails after successful operation
- Check whether the DHCP lease expired or whether renewal did not complete.
- Verify that the DHCP server remains reachable and can provide a valid lease.
- Consider whether the server's address pool or other supplied settings changed.
Important DHCP Terms
- IP address: A network-layer address assigned to a host for communication on an IP network.
- MAC address: A link-layer hardware identifier associated with a network interface. DHCP can use it as useful device-identification background, especially when a server tracks clients or makes consistent assignments.
- LAN segment: The local network area on which a client's initial DHCP broadcasts can be received.
- Broadcast: A transmission intended for all hosts on the relevant local network segment.
- Address pool: The collection of addresses a DHCP server can assign.
- Lease: A time-limited allocation of an IP address and related settings.
- Static configuration: Manually assigning network settings rather than obtaining them automatically.
Summary
DHCP automatically supplies IP networking settings through a client-server protocol. A DHCP client requests configuration, and a DHCP server allocates an address from its pool along with values such as the subnet mask, default gateway, domain name, DNS server, and lease duration.
The initial exchange is commonly remembered as DORA: Discover, Offer, Request, and Acknowledgement. The client begins with a local broadcast, selects an offered configuration, and receives a confirmed lease. Because the lease is temporary, the client must periodically renew it. Linux systems can use DHCP as clients, provide DHCP as servers, or use static configuration when manual addressing is appropriate.