DHCP stands for Dynamic Host Configuration Protocol. DHCP is used to control the network configuration of a host through a remote server. It comes installed as a default feature in most of the contemporary operating systems. DHCP is an excellent alternative to the time-consuming manual configuration of network settings on a host or a network device.
DHCP works on a client-server model. Being a protocol, it has its own set of messages that are exchanged between client and server.
- A client boots and initiates its network hardware
- client sends out a DHCPDISCOVER message :
- Source MAC is – Client’s MAC
- Destination MAC is – Hardware-layer broadcast (FFFFFF-FFFFFF) all 1’s
- Message type is – DHCPDISCOVER
- Server hears the DHCPDISCOVER request and responds
- Source MAC is – Server’s MAC
- Destination MAC is – Client’s MAC
- Message type is – DHCPOFFER containing:
- Server-provided IP address from pool of free addresses (the server should but is not required to check for address conflicts before offering the IP address).
- List of DHCP configuration parameters
- Client responds with DHCPREQUEST message and does one or more of the following:
- requests values for the server-offered parameters from a single server (rejecting all offers from other servers)
- confirm the correctness of the previously allocated IP address (after the client had rebooted or lost connection to the network)
- requests extension of the lease on the specific address already supplied.
- The server responds with
- a DHCPACKnowledge to confirm the server-offered options and IP previously confirmed by the client –
- a DHCPNOACKnowledge to reject the server-offered options.
– or –
- a DHCPDECLINE message to indicate to the server the address is in use.
- The client retains the information throughout the period of its lease.
- The client sends a DHCPRELEASE message to release its IP address at the DHCP server when it is leaving the network.