Monday, April 4, 2011

DHCP - Dynamic Host Protocol Configuration

DHCP - Dynamic Host Protocol Configuration

Larger networks need to adapt to hosts connecting and disconnecting from the network constantly. In this changing environment, static addressing schemes can be very difficult to manage. A dynamic address allocation process allows each IP address to be temporarily assigned by the host. The network can then re-use an address when the host is finished with it. In addition to assigning the hosts IP address, this protocol also passes network configuration information to the host. The central manager of this process is the Dynamic Host Protocol Configuration (DHCP) server. The DHCP server keeps all hosts up to date with network changes through an address leasing and refresh process. The IP address basically is loaned to the host for a defined amount of time. If the time expires before a host requests a RENEW, the IP address is no longer valid and must be re requested by the host. The host requests to RENEW or REBIND an existing address. The server then responds with a new lease (which may or may not be the original address) and updated network configuration information.

Network configuration information distributed by the DHCP server includes:
  • DNS Server IP: The IP address of the Domain Name System Server;
  • Default Gateway: All communications not on the subnet and broadcast addresses are routed through a single address;
  • Subnet-mask: Used to identify which sub-net they are on;
  • Lease time: Client may request a specific duration or accept an assigned value in seconds;
  • Max-lease time: Client may only request up to this time value;
  • ddns update style: Identifies whether the DHCP server can update the host DNS IP address when lease accept and or release occur.
DHCP transaction

There are 3 types of Network Configuration
  1. Automatic allocation – Network administrator defines what address the DHCP server passes to each host;
  2. Dynamic allocation – Addresses are doled out on a dynamic bases by the server;
  3. Manual allocation – Address is hard coded into the host and passed to the server.
The sequence of events (1 and 2):
  • Host broadcasts a discover packet;
  • DHCP sends an offer of an address;
  • The host broadcasts a request for the server specified address;
  • DHCP server responds with an acknowledge and a lease duration for the address.
DHCP Detail:

Upon connection to the network, the host broadcasts a discover datagram over UDP identified as a DHCP transmission. This DISCOVER datagram includes the host MAC ID and time stamp. The MAC address is also referred to as the Ethernet address of the host. The unique MAC ID is used to identify the host and to register it in the DHCP servers address table. The DHCP server then responds with an OFFER datagram. The offer datagram includes the prospective host address. Upon seeing the offer, the host broadcasts a REQUEST for the offered address. The DHCP server offering the address then commits the host IP address into the table and responds to with an ACKNOWLEDGE datagram including a timed address lease. This lease time requires the host to re-contact the server within a specified time or the server will remove the address from its address table requiring the host to begin the DHCP process again. The IP address lease can be renewed in 2 ways. The specific type of renewal is dependant on the age of the address. If the address age is less than 75% of the allotted ownership time, the host sends a renewal request. If however the address age has exceeded 75% of the allotted time, a rebind is sent. In either instance the same address may be granted or a new address re-assigned through the acknowledge datagram from the DHCP server. What if the DHCP server is not on the local network? If the DHCP server is not on the local network a hop is required to obtain an address. A local relay or gateway identifies the requirement for a hop through examining the time stamp in the host DISCOVER datagram. If the time stamp is 0, the relay does nothing allowing any local DHCP servers time to respond to the request. If however, the time stamp is greater than 0, the relay identifies the host discover transmission as a repeat and un-serviced. The relay then passes the discover datagram through the gateway in an effort to find a DHCP server. This process is performed through as many gateways as necessary to find the DHCP server.

Figure 1.0. DCHP Host Server Transaction Diagram