What is DHCP ?
- DHCP (Dynamic Host Configuration Protocol) is a protocol used to provide quick, automatic, and central management for the distribution of IP addresses within a network.
- DHCP is also used to configure the proper subnet mask, default gateway, and DNS server information on the device.
- DHCP allows hosts to obtain required TCP/IP configuration information from a DHCP server.
![What is DHCP](https://cdn.wikitechy.com/interview-questions/networking/what-is-dhcp.png)
How DHCP Works
- A DHCP server is used to concern single IP address and automatically configure other network information.
- Maximum the home and small businesses, the router acts as the DHCP server. In large networks, a single computer might act as the DHCP server.
- A device (the client) requests an IP address from a router (the host), after which the host assigns an available IP address to allow the client to communicate on the network.
- Once a device is turned on and connected to a network that has a DHCP server, it will send a request to the server, called a DHCPDISCOVER request.
- After the DISCOVER packet reaches the DHCP server, the server goes to hold on to an IP address that the device can use, and then offers the client the address with a DHCPOFFER packet.
- Once the offer has been made for the chosen IP address, the device responds to the DHCP server with a DHCPREQUEST packet to accept it, after which the server sends an ACK that’s used to confirm that the device has that specific IP address and to define the amount of time that the device can use the address before getting a new one.
- If the server decides that the device cannot have the IP address, it will send a ACK.