How-To Geek

What is dhcp (dynamic host configuration protocol).

4

Your changes have been saved

Email is sent

Email has already been sent

You’ve reached your account maximum for followed topics.

5 Things I Never Back Up to the Cloud

4 reasons you shouldn't switch to an mvno, cpu vs gpu: what matters more for gaming, quick links, dhcp can handle ip assignments, dhcp controls the range of ip addresses, dynamically assigned addresses are temporary, static ip addresses are necessary for some devices.

  • DHCP automates the process of assigning IP addresses to devices connecting to a network, making it easier to connect multiple devices.
  • DHCP allows you to control the range of IP addresses available for use, ensuring you can limit the number of devices connected to your network.
  • While DHCP assigns IP addresses temporarily, static IP addresses are necessary for certain devices (e.g. servers) to maintain consistent connectivity and configuration.

The Dynamic Host Configuration Protocol (DHCP) is integral to networks and controls what IP addresses devices receive so they can communicate with the internet. Usually, IP assignment is automated, but if you need static IPs, familiarity with DHCP is essential.

Every device that connects to a network needs an IP address . In the early days of networking, users manually assigned themselves an IP address, but that's a cumbersome task, especially for places with many devices, such as a corporate office. DHCP, in part, automates this process, which makes connecting devices to the network far easier. DHCP servers or routers handle this process based on a set of defined rules. Most routers are set to use a 192.168.0.x range, for instance, so you'll commonly see IP addresses like this in home networks.

The process is pretty straight forward. When a client (a computer, IOT device , tablet, cell phone, etc.) connects to the network, it sends out a signal (called DHCPDISCOVER) to the DHCP server (or router). The server responds with all the rules and settings for the network and an IP address for use (a DHCPOFFER). The client acknowledges the information and asks permission to use the assigned address (a DHCPREQUEST message). Finally, the DHCP server acknowledges the request, and the client is free to connect to the network.

You can configure DHCP to control the range of IP addresses available for use. If you state that range as starting at 192.168.0.1 and the end as 192.168.0.100, then all available addresses will fall somewhere within that range. You'll never see a device assigned to 192.168.0.101. Also, bear in mind that the start IP (192.168.0.1 in this example) is reserved for the router. Some routers only list a starting address and then include an option for a maximum number of users (which determines the end address).

The upside to this is you can control how many devices connect to your network simultaneously (no more than 100 in this example). But the downside is if you set the range too small you can unintentionally prevent connection of new devices. To allow for a lower range of IP addresses, DHCP servers only lease out IP addresses to devices.

When a DHCP server assigns an IP Address, it does so under a lease system. The machine retains this IP address for a set number of days, after which it can try to renew the IP address. If no renewal signal is sent (such as a decommissioned machine), then the DHCP server reclaims the IP address to assign to another device. When the renewal signal is detected, the device retains its IP address for another set of days. This is why your IP address may appear to change from time to time if you use the ipconfig option often.

It's possible for two devices to end up with the same IP, such as a virtual machine (VM) that spends most of its time offline. The VM won't be able to send the renew signal, so its IP address will be handed out to another machine. When the VM is brought back up, it still has a record of the old IP address (especially if restored from a snapshot), but it won't be able to use that IP address since it is taken. Without that permission, it can't connect to the network until a new IP is assigned. But using dynamic IP addresses should prevent this type of scenario.

If you have a network connected printer or media server (such as a NAS unit Plex Server, or game server), it would be inconvenient for them to have their IP addresses changed. Sometimes hosted services require special configuration to function correctly. For example, a Minecraft server requires that port 25565 is forwarded , and you may have software pointing to your NAS's local IP. If the local IP of the device changes, then any rules (like port forwards) applied to it won't work anymore.

While renewal of the lease can prevent this, it's still possible for the IP address to change. If your router is restarted, due to a power outage or because you're trying to solve a pesky problem , then all Dynamically generated IP addresses may be reassigned. For those scenarios, manually assigning a Static IP address will solve the problem.

The exact process for this varies, especially as router web interfaces can change from device to device even when made by the same manufacturer. On some routers, like the Eero Mesh Router kit , this may be referred to by another term, such as IP reservation. But a static IP address still needs to conform to any range rules, if they exist. Using a current IP address as the basis for a static IP is usually the easiest thing to do. Depending on the device and its Operating System, it may be possible to set a static IP at the device end instead of through the router or DHCP server. This may be necessary if the router itself doesn't support Static IP.

  • Cloud & Internet
  • Trending Now
  • Foundational Courses
  • Data Science
  • Practice Problem
  • Machine Learning
  • System Design
  • DevOps Tutorial

How DHCP server dynamically assigns IP address to a host?

DHCP is an abbreviation for Dynamic Host Configuration Protocol. It is an application layer protocol used by hosts for obtaining network setup information. The DHCP is controlled by a DHCP server that dynamically distributes network configuration parameters such as IP addresses, subnet masks, and gateway addresses. 

What is a Dynamic host configuration protocol?    

  • Dynamic – Automatically
  • Host – Any computer that is connected to the network
  • Configuration – To configure a host means to provide network information(IP address, subnet mask, Gateway address) to a host
  • Protocol – Set of rules

Summing up, a DHCP server dynamically configures a host in a network. 

The disadvantage of manually Configuring the host: Configuring a host when it is connected to the network can be done either manually i.e., by the network administrator or by the DHCP server. In the case of home networks, manual configuration is quite easy. Whereas in large networks, the network administrator might face many problems.  Also, the manual configuration is prone to mistakes. Say a Network administrator might assign an IP address that was already assigned. Thus, causing difficulty for both administrators as well as neighbors on the network. 

So, here comes the use of the DHCP server. Before discussing how the DHCP server works, let’s go through the DHCP entities.   

Configuring a host using DHCP : To configure a host, we require the following things:   

  • Leased IP address – IP address to a host that lasts for a particular duration which goes for a few hours, a few days, or a few weeks.
  • Subnet Mask – The host can know on which network it is on.
  • Gateway address – The Gateway is the Internet Service Provider that connects users to the internet. The Gateway address lets the host know where the gateway is to connect to the internet.

DHCP Entities

  • DHCP server:  It automatically provides network information(IP address, subnet mask, gateway address) on lease. Once the duration is expired, that network information can be assigned to another machine.  It also maintains the data storage which stores the available IP addresses.
  • DHCP client:   Any node which requests an IP address allocation to a network is considered a DHCP client.
  • DHCP Relay Agent:  In case, we have only one DHCP server for multiple LAN’s then this Agent which presents in every network forwards the DHCP request to the DHCP server. So, using DHCP Relay Agent we can configure multiple LANs with a single server.

How DHCP server assigns an IP address to a host?

  • DHCPDISCOVER: When a new node is connected to the network, it broadcasts the DHCPDISCOVER message which contains the source address as 0.0.0.0 to every node on the network including the server. DHCP server on receiving the message returns the DHCPOFFER message to the requested host which contains the server address and new IP address to the node.  
  • DHCPOFFER:  If there are multiple servers on the network, the host receives multiple DHCPOFFER messages. It is up to the host to select a particular message.   
  • DHCPREQUEST:  The requested host on receiving the offer message, again broadcasts the DHCPREQUEST message on the network with the address of the server whose offer message is accepted by the host. The server which pertains to that server address sent by the host checks whether the address to be assigned to the node is available in the data storage.   
  • DHCPACK: If the address is assigned, it marks the IP address in the storage as unavailable to ensure consistency. Now, the server sends a DHCPACK packet to the requested host which contains network information(IP address, subnet mask, gateway address). In case, if the address is assigned to another machine meanwhile, then the server sends the packet DHCPNAK to the requested host indicating that the IP address is assigned to some other machine.   
  • DHCPRELEASE: And finally, If the host wants to move to another network or if it has finished its work, it sends the DHCPRELEASE packet to the server indicating that it wants to disconnect. Then the server marks the IP address as available in the storage so that it can be assigned to other machines.   

References:   For reference to DHCP protocol,  click here  

Similar Reads

  • How DHCP server dynamically assigns IP address to a host? DHCP is an abbreviation for Dynamic Host Configuration Protocol. It is an application layer protocol used by hosts for obtaining network setup information. The DHCP is controlled by a DHCP server that dynamically distributes network configuration parameters such as IP addresses, subnet masks, and ga 4 min read
  • Explicitly assigning port number to client in Socket Prerequisite: Socket programming in C/C++.In socket programming, when server and client are connected then the client is provided any random port number by an operating system to run and generally, we don't care about it, But in some cases, there may be a firewall on the client-side that only allows 4 min read
  • Dynamic NAT (on ASA) Prerequisite - Adaptive security appliance (ASA), Network address translation (NAT), Static NAT (on ASA) Network Address Translation is used for the translation of private IP addresses into public IP addresses while accessing the internet.NAT generally operates on a router or firewall. Dynamic NAT - 5 min read
  • Java.net.Inet4Address class in Java This class extends the InetAddress class and represents an IPv4 address. It provides methods to interpret and display useful information about IP addresses. Methods of this class take input in 4 formats: d.d.d.d: When this format is used as input, each of the given values are assigned to 4 bytes of 3 min read
  • Java.net.Inet6Address class in Java This class represents IPv6 address and extends the InetAddress class. Methods of this class provide facility to represent and interpret IPv6 addresses. Methods of this class takes input in the following formats: x:x:x:x:x:x:x:x -This is the general form of IPv6 address where each x can be replaced w 5 min read
  • Java.net.InterfaceAddress class in Java This class represents a network interface address. Every device that has an IP address has an IP address on the network interface. In fact the ping command doesn't ping a device but the devices interface address. Java provides certain methods to deal with interface addresses which can be used in pla 2 min read
  • Java.net.InetSocketAddress class in Java This class implements IP socket address( combination of IP address and port number). The objects of this class are immutable and can be used for binding, connecting purposes. Constructors : 1. InetSocketAddress(InetAddress addr, int port) : This constructor is similar to the general structure of a s 4 min read
  • Routing for Mobile Hosts Millions of people use computers while on go, from the truly mobile situations with a wireless device in moving cars, to nomadic situations in which laptop computers are used in a series of a different location. We use the term mobile hosts to mean either category, as distinct from stationary hosts 3 min read
  • Network Scanner in Python A network scanner is one major tool for analyzing the hosts that are available on the network. A network scanner is an IP scanner that is used for scanning the networks that are connected to several computers. To get the list of the available hosts on a network, there are two basic methods - ICMP Ec 3 min read
  • Working of Dynamic Host Configuration Protocol Dynamic Host Configuration Protocol (DHCP) is a network management protocol used in networks to dynamically assign IP addresses & other network configuration information like default gateway, mask, DNS server address etc. DHCP server automatically assigns IP address to various devices in network 3 min read
  • Which Protocol Is Used to Automatically Assign IP Addresses to Hosts? Answer : The Dynamic Host Configuration Protocol (DHCP) is used to automatically assign IP addresses to hosts.Purpose of DHCPDHCP is designed to reduce the administrative burden and complexity of manually configuring IP addresses for networked devices. How DHCP WorksA device connects to the network 1 min read
  • Who Assigns an IP Address to the Computer? Answer: An IP address is assigned to a computer by a Dynamic Host Configuration Protocol (DHCP) server, or manually by an administrator in static configurations.Dynamic Host Configuration Protocol (DHCP)Most commonly, a DHCP server automatically assigns an IP address to a computer within a network. 1 min read
  • How is a Private IP Address Assigned? Answer: Private IP addresses are assigned within a specific range reserved for private networks by a router or network administrator.Private IP addresses are assigned to devices within a local network to facilitate communication within that network. The assignment process typically involves a router 2 min read
  • How DORA Works? Dynamic Host Configuration Protocol(DHCP) uses the DORA. Dynamic Host Configuration Protocol is the protocol of the application layer. It is used to provide Subnet Mask, Router Address, DNS Address, and Vendor Class Identifier. In fact, DHCP provides an automatic IP address to Hosts which want to co 4 min read
  • Dynamic Host Configuration Protocol (DHCP) vs Static IP Assignment The two different approaches of network configuration to manage IP addresses for devices are DHCP (Dynamic Host Configuration Protocol) and Static IP Assignment which you can use to configure computer networks and to assign IP addresses to devices on a network are the focus. A distinctive feature of 5 min read
  • Manual and Automatic Addressing On a home network, the router typically determines how the LAN should function. The router will transport traffic between LAN clients as well as between the LAN and the Internet. The router in the network distributes IP addresses and other network-related information to the PCs. This was accomplishe 5 min read
  • Working of Web Request To connect to a Web Page on Internet, following steps and protocols play a vital role : Computer connecting to a network cannot perform anything without an IP address. So, Dynamic Host Configuration Protocol (DHCP) runs on client computer to obtain IP address, address of first-hop router, and addres 4 min read
  • What is a Dynamic IP Address? A Dynamic IP Address is an IP address that changes each time a device connects to the internet or network. This means your device could receive a different IP address every time it accesses the network. Dynamic IP addresses are commonly used for personal devices like smartphones, laptops, and home r 7 min read
  • Setting IP Address Using DHCP Server Every computer on the network has to have an IP address for communication purposes. An IP address is an identifier for a computer or device on a network. The IP address can be assigned in two ways i.e. Static IP or Dynamic IP. Static IP: A static IP is where a user assigns an IP address manually. It 5 min read

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

IMAGES

  1. DHCP IP Allocation Operation

    ip address assignment dhcp

  2. GitHub

    ip address assignment dhcp

  3. What is DHCP? It assigns IP addresses dynamically

    ip address assignment dhcp

  4. 27+ dhcp server network diagram

    ip address assignment dhcp

  5. Automatic IP Address Assignment How DHCP Works

    ip address assignment dhcp

  6. 5_Configuring DHCP for Automatic IP Address Assignment in Cisco Packet Tracer

    ip address assignment dhcp

VIDEO

  1. Basic DHCP and NAT configuration

  2. How to change the IP address from DHCP to Static

  3. Networking : DHCP (Dynamic Host Configuration Protocol)

  4. Bagaimana cara kerja DHCP ?

  5. What is DHCP Dynamic Host Configuration Protocol

  6. What is DHCP