What is Dynamic Host Configuration Protocol or DHCP ? It is a standard network protocol used over the Internet Protocol (IP) network, controlled through a DHCP server to distribute values. Network configuration for hosts that are under the same network, such as IP , Subnet , Gateway, most routers have the feature of DHCP server already, allowing home computers or PCs to connect to the router using DHCP in Distributing IP addresses without having to configure them to all hosts reduces the burden of network administrators by chasing network configurations on every host in the system.
After knowing what DHCP is, let’s look at and how it works by devices in the network to send data internally or between network via TCP / IP, which the DHCP server can manage the TCP / IP settings of each device in the network automatically or some devices. You can configure it yourself without DHCP, for example, in homes, you usually get a public IP from your internet service provider or ISP only 1 IP, so if we have multiple devices that need to connect to the internet, we can use the DHCP feature on the router. To distribute local IP or private IP (192.168.1.0/24) distributed to devices in our home instead. All of which will NAT back out to the internet with the same public IP.
DHCP works in a way Client-Server When the device within the network is connected to the DHCP client or the device itself will send broadcast to search DHCP server information and when the DHCP server receives the request information. Will manage the IP pool that itself stored This will contain the information of the default gateway, domain name, name servers and time servers. The DHCP server will send the network configuration information that has not yet been used to the client. This value, the DHCP side will remember it for a period of time. The client rebooted and reconnected to the DHCP server to send the same settings back. But if it exceeds that time, the DHCP server may return a new value instead.
Procedure for selecting IP address of DHCP server.
1. Dynamic allocation
Administrators can set the range of IP addresses for DHCP, what IP addresses will be distributed by DHCP clients in the system, and can set a time interval for DHCP server to retrieve IP addresses after inactivity back into the pool for distribution. Other devices.
2. Automatic allocation
Like dynamic allocation. DHCP server distributes persistent IP addresses to clients requesting them in accordance with dynamic allocation.The DHCP server keeps a table of which devices the IP addresses distribute to. It will distribute the same IP address that was previously assigned to that device if that IP address is still free.
3. Manual allocation (Static allocation)
The DHCP server can assign a private IP to the device based on the MAC address of the requested client by configuring. This is static DHCP assigmenet or fixed-address (dhcpd). If the Mac address is not found to be mapping, the DHCP server can return to it by Dynamic or Automatic allocation instead.
Currently, DHCP supports IPv4 and IPv6 , regardless of the version, DHCP is used for the same purpose. But IPv6 may have more configuration features such as stateless address autoconfiguration or ink-local addressing.
DHCP is connected as connectionless by using User Datagram Protocol (UDP), which is used with two ports:
Port 67 for server side
Port 68 for the client side
DHCP operation has a procedure known as DORA or discovery, offer, request, acknowledegment.
1. DHCP discovery
Beginning with Client, broadcast message to network subnet at IP address 255.255.255.255 or other subnet broadcast. Sometimes request to last known IP address, if client connects to same network, server side will accept that request but that depends. With the management of the server side, if the timeout expired has been exceeded, it will have to request a new IP address.
2. DHCP offer
When DHCP server receives DHCP discovery from client side. DHCP server will reserve IP address for client and send DHCP offer to client which will contain client’s MAC address. IP address provided, Subnet Mask, duration. And the IP address of the DHCP server to communicate.
3. DHCP request
Use a DHCP offer from the client side.You can receive a DHCP offer from multiple servers. But only one DHCP by the client, then the DHCP request tells you which server the client chooses and when the DHCP server receives this message. Will cancel the IP address reservation and return back to the pool
4. DHCP acknowledgment
After the DHCP server receives the DHCP request from the client side. The configuretion comes to the last phase, which is to send the DHCP ack packet back. Any other configuration that the client may need.Wherein the IP address has been setup.