DHCP

Dynamic Host Configuration Protocol ( DHCP )

S Abhishek
4 min readJul 6, 2021
  • Every computer in the network has to have an IP Address.
  • There are two ways in which IP Addresses are assigned to the computers.

Static IP

Dynamic IP

Static IP

  • In this method, the IP Address is assigned to the computer manually by the user.
  • This was the original method that was done at the beginning of the networking.
  • To do this, every time you have to open the computer’s network configuration page and manually type in the IP Address along with the Subnet mask, Default gateway, and DNS server.
  • So each time when you want to add a computer to the network or device to the network you have to manually do it and it might turn tricky while dealing with a large network that has a lot of computers.
  • The major problem here is IP conflict ( ie ) two hosts having the same IP address, and configuring them manually will likely lead to errors.
  • Even on small networks manually assigning IP addresses can be confusing, particularly with mobile devices that require IP addresses on a non-permanent basis.
  • Also, most users aren’t technically proficient enough to locate the IP address information on a computer and assign it.
  • Automating this process makes life easier for users and the network administrator and this is where we use Dynamic IP.

Dynamic IP or DHCP

  • In this method, IP Addresses, subnet mask, default gateway address, domain name server (DNS) address, and other pertinent configuration parameters are automatically assigned to the computer by the DHCP server.
  • The computer would broadcast a request for an IP Address on the network and then the DHCP server will assign an IP Address from its pool and deliver it to the computer.
  • The DHCP server has a scope of IP Addresses that can be used to assign to the computers.
  • The DHCP server assigns IP Addresses as a lease so that the computer doesn’t actually own the IP Address.
  • Lease is the amount of time an IP Address is assigned to a computer.
  • The lease is to make sure that the DHCP server doesn’t run out of IP Addresses.
  • If this method of the lease is not used then if the computer which is assigned the IP Address is removed, it takes the IP Address that has been given to it.
  • So in this case, if some other computer gets added to the network as well as the DHCP server has run out of IP addresses, it won’t be able to access the network because the DHCP server has run out of IP addresses.
  • So even though the computer has been removed it's still occupying an IP address that could be used for another computer.
  • This is why IP addresses are leased and are not given because if the IP Addresses are leased then this will tell the DHCP server which IP Addresses are still being used and which ones are not being used.
  • If the lease expires, the IP address will go back to the IP address pool.
  • So now the IP address can be used for another computer.
  • Reservation on the DHCP server will ensure that a specific computer or device identified by its MAC Address, will always be given the same IP address when that computer or device requests an IP address from the DHCP server.

Components of DHCP

  • DHCP server: A networked device running the DCHP service that holds IP addresses and related configuration information. This is most typically a server or a router but could be anything that acts as a host, such as an SD-WAN appliance.
  • DHCP client: The endpoint that receives configuration information from a DHCP server. This can be a computer, mobile device, IoT endpoint or anything else that requires connectivity to the network. Most are configured to receive DHCP information by default.
  • IP address pool: The range of addresses that are available to DHCP clients. Addresses are typically handed out sequentially from lowest to highest.
  • Subnet: IP networks can be partitioned into segments known as subnets. Subnets help keep networks manageable.
  • Lease: The length of time for which a DHCP client holds the IP address information. When a lease expires, the client must renew it.
  • DHCP relay: A router or host that listens for client messages being broadcast on that network and then forwards them to a configured server. The server then sends responses back to the relay agent that passes them along to the client. This can be used to centralize DHCP servers instead of having a server on each subnet.

--

--

S Abhishek

Data Engineer Intern @Rolls-Royce | Computer Science Undergraduate | Amrita Vishwa Vidyapeetham | Former Member of security research & CTF team — @teambi0s.