Tuesday 26 June 2012

Dynamic Host Configuration Protocol (DHCP)


In a network, you can assign IP addressed to clients and servers in two ways, i.e. either manually or automatically. Assigning addresses manually is quite an easy task if the network is small and limited but problem arises as the network grows larger. Just imagine an administrator trying to assign 500 IP addresses, subnet masks, default gateways, and other configuration settings required to run the network. Definitely this will not work.

In such a large network, a DHCP (Dynamic Host Configuration Protocol) server is used to centralize the process of IP address allocation.

The DHCP Address assignment (DORA process)



The lease process involves the following steps:

Discover | Offer | Request | Acknowledge (DORA) Process 



  • Discover The Windows XP Professional DHCP client requests an IP address by broadcasting a message (known as a DHCPDiscover message) to  the local subnet.

  • Offer The client is offered an address when a DHCP server responds with a DHCPOffer message containing an IP address, and associated configuration information, available for lease to the client.

  • Request The client selects the offered address and replies to the server with a DHCPRequest message.

  • Acknowledge The client is assigned the address, and the DHCP server sends an acknowledgment message (DHCPAck) approving the lease. Other  DHCP option information, such as default gateway and DNS server addresses, might be included in the message.

After the client receives acknowledgment, it configures its TCP/IP properties using any DHCP option information in the DHCPAck  message and completes the initialization of TCP/IP.

If no DHCP server responds to the client request, the Windows XP Professional–based client can proceed in one of two ways:

  • If APIPA is enabled, the client self-configures a unique IP address in the range 169.254.0.1 through 169.254.255.254.
  • If APIPA has been disabled, the client network initialization fails. The client continues to re-send DHCPDiscover messages in the background until it receives a valid lease from a DHCP server. The client makes four attempts to obtain a lease, one every five minutes.


The address Leases

A DHCP server maintain a list of all the IP addresses that the server has distributed to its client computers so that no address is assigned to two client computers at the same time. The server assigns an IP address to a client in the form of a lease that extends to six or eight days. 

A lease is a contract in which the IP address allocation is valid only up to a specific period. The default durations are 6 days for wired networks and 8 hours for wireless networks. These values can be modified.

When a client machine reaches half of the lease period then it sends a request to the DHCP server to extend the lease period. If the DHCP server is not found then one more request is sent at the half of remaining half i.e. at the time when 75% of the lease expires. If still there is no offer from the DHCP server, a final request is sent when 87.5% of lease gets expired. In case of no response from the DHCP server, the client machine starts searching for another DHCP Server on the network.

If a client machine shut downs properly or command ipconfig /release is executed then the DHCP server takes the IP address away from the client and now it can be assigned to any other machine. But if a client goes out of the network abruptly then DHCP server waits till the client machine joins the network again or the lease period expires so that the IP address can be assigned to some other machine.

Now let's configure perform the DHCP practical.

Practical

Install Role DHCP Server

Server Manager
Click on Roles Node
Add Roles -> Next
Select DHCP Server

Select Role DHCP Server
Next -> Select the network which this DHCP server will use for servicing clients. 

DHCP Network Selection
Next -> Click on Validate to verify the IP address of the preferred DNS server

Validate DNS Server IP Address
Keep WINS is not required for applications on this network and give Next

Now you have to add Scope of IP addresses that can be assigned by the DHCP server. Click on Add and Fill the details.

DHCP Scope

You can add more than one scope. 



Give next and select Disable DHCPv6 stateless mode for this server -> Next


Disable DHCPv6 stateless mode




Keep User current credentials selected and give Next & Install -> Close

Now start the Client Machine


Go to Network and Sharing Center
Change Adapter Settings
Select IPv4 -> Click properties & select 


  • Obtain an IP address automatically
  • Obtain DNS serve address automatically
Obtain an IP address dynamically @ Client machine
OK.

Now the the DORA process will be performed to obtain the IP address.

Connected to the mcitp.com server with dynamically assigned IP address
To check which IP address assigned, 
Right Click on the Local Area Connection
Click Status
Click Details
and you will see the IP address assigned by the DHCP server.

No comments:

Post a Comment

Your comments are very much valuable for us. Thanks for giving your precious time.

Do you like this article?