blog posts

What Is DHCP And How Does It Work?

What Is DHCP And How Does It Work?

Every System In The Network Needs To Have A Correct IP Address To Connect To The Network. DHCP Protocol Performs The Task Of Automatic IP Assignment In These Networks.

DHCP protocol (abbreviation of Dynamic Host Configuration Protocol) is a protocol for dynamically configuring hosts, which automatically assigns an IP address to each device on the network. Every device needs an IP address to connect to the Internet, posted through a router equipped with DHCP service.

A single router cannot manage all connected devices in extensive networks. In such cases, a separate dedicated server is placed on assigning IP addresses to the devices on the web, and the DHCP protocol is run on the server instead of the router.

dhcp

DHCP is not only an automatic IP address assigner; It also manages network configuration for the subnet mask, default gateway, and DNS service.

DHCP architecture

DHCP architecture has three main parts: clientserver, and relay agent.

A client is any device that can connect to the Internet and communicate with the DHCP server. In addition to telephones and computer systems, printers and servers in the network are also considered DHCP clients.

A server is a computer system that performs IP assignments in the DHCP protocol.

The relay agent sends the request signal between the client and the server in the DHCP protocol. This factor is not necessary for small networks, But their presence is required for the operation of massive networks.

DHCP allocation

An IP address has a limited lifetime from when it is assigned to a device. Today’s IP assigned to a system by the DHCP protocol may differ from tomorrow’s. Of course, if the system returns to the network during the HP lifetime and before the allocation period expires or stays on the web for the same period, its IP will not change; Otherwise, a new IP will be assigned to the device.

Additionally, any device on the network can request an IP reassignment from DHCP. Registering this request with the help of network settings on computers or Wi-Fi settings on smartphones creates a new IP address for the device.
dhcp relay agents

When a new device is added to the network, it sends a request to the web to have a unique IP, and after receiving this request, the DHCP server sends information such as the proposed IP address and server address to the new device.

After the IP is accepted, the server sends a confirmation message. This message contains more information, including the requested transmission of the device.

What we said applies to small networks; Because in more extensive networks, more requests are sent to the server, and there must be a process to detect each request.

Also, each device may receive a response from several servers after sending its request. In such a situation, Relay Agents check the request of each device and send it to the central server. These agents again send the response to the device after receiving the response from the server.

DHCP target

The presence of DHCP on the network is necessary to determine the number of devices connected to the network. As each device enters the web, it needs to be assigned an IP address immediately; so that it does not interfere with other IPs in the network. The lack of DHCP leads to IP interference and prevents the device from connecting to the web easily and quickly.

This is one of the network management problems. Assigning IP manually and solving the interference problem, even in small networks, is tedious and time-consuming. In large networks, this is almost impossible.

dhcp

An essential service of DHCP to network administrators is to assign IP addresses to all devices on the network automatically. Also, due to the dynamic nature of the IP address, the unavailability of the IP for the computer system rarely happens. In such a network, infinite device connection will also be possible.

IP conflict with DHCP

Although DHCP is responsible for IP allocation, sometimes it can be the cause of IP interference itself. An error in DHCP causes this problem, But this protocol can solve the problem while working.

When you see an IP conflict error on your system, you often see it, and the problem will resolve itself. If the problem persists, you should restart the router. Again, if the interference problem doesn’t go away, you probably have a more extensive network problem with the router and DHCP.

Advantages and disadvantages of DHCP

According to what was said, the advantages and disadvantages of using the service are:

Advantages of DHCP

  • Automatic IP assignment to clients
  • High speed of IP allocation
  • Reducing interference between IPs
  • IP assignment to different people who are not in a fixed place

Disadvantages of DHCP

  • Not having a static IP for clients
  • Possibility of DHCP Spoofing attack on the network
  • The cost of providing and maintaining a suitable server for DHCP

Common Questions

What is the DHCP protocol?

The DHCP protocol stands for Dynamic Host Configuration Protocol, and as its name suggests, it dynamically assigns IP addresses to clients in the network. This protocol works in the application layer.

How does DHCP work?

When it first connects to the network, each client does not have an IP to communicate with other clients and automatically requests an IP from the server. After receiving this request, the DHCP server sends an IP address to the desired client.