Dynamic Host Configuration Protocol (DHCP) is a protocol used to give fast, automatic, and central management for the allotment of IP addresses within a network. The Dynamic Host Configuration Protocol automates the assigned IP addresses, subnet masks, gateways, and other networking parameters. This is dynamic or automatic IP addressing. The alternative to dynamic addressing is static addressing. In the static addressing, the network administrator manually assigns and configures IP addresses on hosts.
When a client requests an IP address from a Dynamic Host Configuration Protocol server; the Dynamic Host Configuration Protocol server chooses an address from a configured range of addresses called a pool and assigns it to the client device on lease bases. Dynamic Host Configuration Protocol is an ideal and efficient system on a larger network to configure IP address settings where the client’s changes occurred frequently. New User may arrive and want connection and someone want to leave the network. Static IP address configuration is too difficult in such a larger network.
Clients get IP addresses automatically from the DHCP server on leased bases. if the client is connected to the network and lease period is expired. The dynamic host configuration protocol automatically renews the lease period. If the client power down his device or unplug the network cable, the address is then free for the pool to reuse.
We can use a variety of devices as a DHCP server. The Dynamic Host Configuration Protocol server in most of the networks is generally a local and dedicated PC-based server. The home users DHCP server is usually a local router that connects the home network to the ISP. Several networks use both static and DHCP address settings. The network administrator uses static addressing for network devices and DHCP is for general purpose. The figure below illustrates the types of The Dynamic Host Configuration Protocol servers that can be used.
Types of Dynamic Host Configuration Protocol
There are two types of Dynamic Host Configuration Protocol, DHCPv4 and DHCPv6 both give similar services for there clients. The main difference between DHCPv4 and DHCPv6 is the gateway, DHCPv6 does not give a default gateway address. The gateway can only be obtained automatically from the router’s Router Advertisement message.
Dynamic Host Configuration Protocol (DHCP) Operation
When a device configured for DHCPv4 boots up or connects to the network; the DHCP client sends broadcasts a DHCP discover message to discover any available The Dynamic Host Configuration Protocol server. When Dynamic Host Configuration Protocol server receives (DHCPDISCOVER) message, it replies with a DHCPOFFER message. The offer message has the IPv4 address including a subnet mask; the IPv4 address of theserver, and the IPv4 address of the default gateway. The offer also includes the duration of the lease period.
Multiple DHCP servers
Incas of multiple DHCP servers exist on the network, and then the client may receive multiple SCOFFERS messages. So, the client should choose between them, and sends a DHCPREQUEST message. The DHCPREQUEST message identifies the exact server and leases offer that the client is accepting. A client can also request an address previously allocated to the client.
The server should allow the previously used IP address on a priority basis. Once DHCP server offer has made for the chosen IP address the device responds to the DHCP server with a DHCPREQUEST packet to accept offered IP address. Then the server replies with ack message to confirm the specific IP address for this device and define the lease time. If the server decides that the device cannot have the IP address, it will send a NACK.
For example, the client requests the IPv4 address or the server offer an address which is still available, the server returns a DHCPACK (DHCP Acknowledge) message. The message acknowledges the clients that lease has finalized. If the offer is no longer valid, then the server responds with a DHCP negative acknowledgement (DHCPNAK) message.
if the client received DHCPNAK message then the selection process should start again with a new DHCPDISCOVER message from the client. The client lease should renew before the lease expiration through another DHCPREQUEST message. The DHCP server is responsible to assign a unique IP address to the host. DHCPv6 has a similar set of messages, the messages are SOLICIT, ADVERTISE, INFORMATION REQUEST, and REPLY.