Board index Linux DHCP

Moderator: chandranjoy

DHCP - How it works?

Postby chandranjoy » Wed Dec 22, 2010 6:06 pm

Dynamic Host Configuration Protocol (DHCP) is a TCP/IP standard that uses a central server to manage IP addresses and other configuration details for an entire network. A DHCP server responds to requests from clients, dynamically assigning properties to them.

DHCP client-server interaction
DHCP provides an automated method for dynamic client configuration. Clients that are DHCP enabled automatically obtain their own IP address and configuration parameters from the server. This process occurs through a series of steps, illustrated below.

Figure 1-1: DHCP client-server interaction.

Client requests DHCP information: DHCPDISCOVER
First, the client sends out a DISCOVER message requesting an IP address. The DISCOVER message contains an identifier unique to the client (usually the MAC address). The message may also contain other requests, such as requested options (for example, subnet mask, domain name server, domain name, or static route). The message is sent out as a broadcast. If the network contains routers, those routers can be configured to forward DISCOVER packets to DHCP servers on attached networks.

DHCP server offers information to client: DHCPOFFER

Any DHCP server that receives the DISCOVER message may send an OFFER message in response. The DHCP server may not send an OFFER message back to the client for multiple reasons; the most common reasons are that all available addresses are currently leased, the subnet is not configured, or the client is not supported. If the DHCP server sends an OFFER message in response, the DHCPOFFER will contain an available IP address and any other configuration information that is defined in the DHCP setup.

Client accepts DHCP server offer: DHCPREQUEST
The client receives OFFER messages from the DHCP servers that responded to the DISCOVER. The client compares the offers with the settings it requested and then selects the server it wants to use. It sends a REQUEST message to accept the offer, indicating which server it selected. This message is broadcast to the entire network to let all DHCP servers know which server was selected.

DHCP server acknowledges the client and leases the IP address: DHCPACK
If a server receives a REQUEST message, the server marks the address as leased. Servers that were not selected will return offered addresses to their available pool. The selected server sends the client an acknowledgment (DHCPACK), which contains additional configuration information.

The client may now use the IP address and configuration parameters. It will use these settings until its lease expires or until the client sends a DHCPRELEASE message to the server to end the lease.

Client attempts to renew the lease: DHCPREQUEST, DHCPACK
The client starts to renew a lease when half of the lease time has passed. The client requests the renewal by sending a REQUEST message to the server. If the server accepts the request, it will send a DHCPACK message back to the client. If the server does not respond to the request, the client may continue to use the IP address and configuration information until the lease expires. As long as the lease is still active, the client and server do not need to go through the DHCPDISCOVER and DHCPREQUEST process. Once the lease has expired, the client must start over with the DHCPDISCOVER process.

Client terminates the lease: DHCPRELEASE
The client terminates the lease by sending a RELEASE message to the DHCP server. The server will then return the client's IP address to the available address pool.

Enjoy :)
Site Admin
Posts: 283
Joined: Fri Oct 23, 2009 11:19 pm

Return to DHCP

Who is online

Users browsing this forum: No registered users and 1 guest