Saturday, 19 July 2014

DHCP (Dynamic Host Configuration Protocol)


DHCP works slightly differently from Bootp. The following steps occur when a client retrieves IP configuration details from a DHCP server:
  • The client sends a DHCPDISCOVER IP broadcast to find available DHCP servers on its subnet. This broadcast message could give indications of the address required and the length of the lease.
  • A router configured with Bootp Relay agent forwards the request on to other subnets specified in the router configuration (e.g. Cisco's ip helper).
  • The DHCP server responds with a unicast DHCPOFFER containing an available IP address in the 'Your IP Address' field and other configuration parameters such as default gateway, subnet mask and lease time. This occurs when the DHCPDISCOVER has a 0 in the Client IP address field. The server should check that the IP address has not already been allocated. Optionally, the server could be configured to reserve previously allocated IP addresses. In the case of the server being on a different subnet to the client, this DHCPOFFER is sent to the client's router's LAN IP address which is the source of the original DHCPDISCOVER broadcast. Where the server and the client sit on the same LAN, the MAC address of the client is sufficient, being as it is the source of the broadcast.
  • The client examines the various offers it receives, picks one and sends aDHCPREQUEST broadcast including the server identifier of that particular server to obtain the offered configuration parameters. The DHCPREQUEST broadcast is also used to renew a lease or to decline an offer.
  • All servers receive this broadcast if they are on the LAN. If they are on another subnet and a relay agent is configured on the router, then this broadcast is unicast to the server identified by the server identifier. The router is configured with the IP address of the desired server.
  • The chosen server replies with a unicast DHCPACK containing IP address, duration for the lease of that IP address and the other configuration parameters. The server commits to this IP address and it is passed to persistent memory. A DHCPNACK is sent if the IP address happens to have been allocated in the meantime.
  • The client receives the DHCPACK and checks the IP address is not being used locally e.g. with an ARP request. If the IP address IS in use then the client sends a DHCPDECLINE, waits at least 10 seconds and then restarts the process.
The DHCP server may have a number of scopes configured for different subnets, it knows from which subnet a request comes from because the unicast sent from the local router contains the source IP address of the LAN interface on which the client's broadcast request was received

No comments:

Post a Comment

The Future of Remote Work, According to Startups

  The Future of Remote Work, According to Startups No matter where in the world you log in from—Silicon Valley, London, and beyond—COVID-19 ...