What is a DHCP Server
A DHCP server is a device that automatically assigns IP addresses and other network settings to the devices on a network. It is the server side of DHCP (Dynamic Host Configuration Protocol), a technology for centralized management and configuration of user IP addresses.
DHCP follows the RFC 2131 standard and works in a client/server model. A DHCP client sends a request to a DHCP server, and the server allocates an IP address to the client for a set period of time known as the lease time.
This approach suits hosts that only need temporary network access, and networks where the number of hosts is large but the available addresses are limited. It is especially useful when hosts do not need a permanent network connection.
The server selects an address from an address pool and assigns it to the client. It can also provide other network parameters, such as the default gateway address, DNS server addresses, and WINS server addresses. A DHCP server can handle request packets from its own subnet, as well as requests forwarded from other subnets through a DHCP relay.
DHCP Roles
A typical DHCP network has three roles:
· DHCP server: Selects an IP address from an address pool and assigns it to a client, together with other network parameters.
· DHCP client: Sends DHCP request packets, using the BOOTP or DHCP protocol, to obtain an IP address and other network parameters. Typical clients include IP phones, personal computers, mobile phones, and diskless workstations.
· DHCP relay: Forwards DHCP packets between clients and servers that are not in the same subnet. A client broadcasts its request, and only servers in the same subnet can receive it. A relay receives the request or response packets, builds new DHCP unicast packets, and forwards them across the Layer 3 network. This is different from ordinary IP packet forwarding.
How a DHCP Server Assigns an IP Address
The address acquisition process has five stages:
Discover: When a client joins a network or needs new network information, it broadcasts a DHCP Discover message to all devices on the local network to find available DHCP servers.
Offer: Each DHCP server that receives the Discover message replies with a DHCP Offer message. It contains an available IP address, a lease duration, a subnet mask, a default gateway, and other configuration details.
Request: If the client receives several Offer messages, it typically chooses one and broadcasts a DHCP Request message to the chosen server, to accept the offered configuration.
Acknowledgment: The server confirms the allocation of the IP address and configuration with a DHCP Acknowledgment message. The client has now acquired its network configuration.
Renewal and release: Before the lease expires, the client tries to renew it by contacting the server halfway through the lease duration. If the client no longer needs the configuration or leaves the network, it can send a DHCP Release message to give up the address.
Why a DHCP Server is Beneficial
Centralized address management: IP addresses and network parameters are managed in one place, instead of being set by hand on each host.
Efficient use of limited addresses: Because addresses are leased for a period of time, they can be reused by other hosts when they are no longer needed.
More than an IP address: Clients also receive the gateway, DNS servers, and other parameters they need to work on the network.
Works across subnets: With a DHCP relay, one server can serve clients in many subnets.
Customized settings by client type: Using DHCP options, the server can recognize vendor information in a client's request and allocate parameters suited to that client.