Skip to content

Instantly share code, notes, and snippets.

@dragontheory
Last active March 21, 2025 18:00
Show Gist options
  • Save dragontheory/18f1678cad15ddd34fa0422dfbe5a589 to your computer and use it in GitHub Desktop.
Save dragontheory/18f1678cad15ddd34fa0422dfbe5a589 to your computer and use it in GitHub Desktop.

๐Ÿ–ง Dynamic Host Configuration Protocol (DHCP)

๐Ÿ—“๏ธ Last Updated: 27 Dec, 2024
๐Ÿ”— Source: GeeksforGeeks - Dynamic Host Configuration Protocol (DHCP)

Dynamic Host Configuration Protocol is a network protocol used to automate the process of assigning IP addresses and other network configuration parameters to devices (such as computers, smartphones, and printers) on a network. Instead of manually configuring each device with an IP address, DHCP allows devices to connect to a network and receive all necessary network information, like IP address, subnet mask, default gateway, and DNS server addresses, automatically from a DHCP server.

This makes it easier to manage and maintain large networks, ensuring devices can communicate effectively without conflicts in their network settings. DHCP plays a crucial role in modern networks by simplifying the process of connecting devices and managing network resources efficiently.

โ“ What is DHCP?

DHCP stands for Dynamic Host Configuration Protocol. It is the critical feature on which the users of an enterprise network communicate. DHCP helps enterprises to smoothly manage the allocation of IP addresses to the end-user clientsโ€™ devices such as desktops, laptops, cellphones, etc. is an application layer protocol that is used to provide:

  • ๐Ÿงฎ Subnet Mask (Option 1 - e.g., 255.255.255.0)
  • ๐Ÿšช Router Address (Option 3 - e.g., 192.168.1.1)
  • ๐ŸŒ DNS Address (Option 6 - e.g., 8.8.8.8)
  • ๐Ÿท๏ธ Vendor Class Identifier (Option 43 - e.g.,
    'unifi' = 192.168.1.9 ##where unifi = controller)

DHCP is based on a client-server model and based on discovery, offer, request, and ACK.

๐Ÿค” Why Do We Use DHCP?

DHCP helps in managing the entire process automatically and centrally. DHCP helps in maintaining a unique IP Address for a host using the server. DHCP servers maintain information on TCP/IP configuration and provide configuration of address to DHCP-enabled clients in the form of a lease offer.

๐Ÿงฉ Components of DHCP

The main components of DHCP include:

  • ๐Ÿ–ฅ๏ธ DHCP Server: DHCP Server is a server that holds IP Addresses and other information related to configuration.
  • ๐Ÿ“ฑ DHCP Client: It is a device that receives configuration information from the server. It can be a mobile, laptop, computer, or any other electronic device that requires a connection.
  • ๐Ÿ” DHCP Relay: DHCP relays basically work as a communication channel between DHCP Client and Server.
  • ๐ŸงŠ IP Address Pool: It is the pool or container of IP Addresses possessed by the DHCP Server. It has a range of addresses that can be allocated to devices.
  • ๐Ÿงฑ Subnets: Subnets are smaller portions of the IP network partitioned to keep networks under control.
  • โณ Lease: It is simply the time that how long the information received from the server is valid, in case of expiration of the lease, the tenant must have to re-assign the lease.
  • ๐Ÿงญ DNS Servers: DHCP servers can also provide DNS (Domain Name System) server information to DHCP clients, allowing them to resolve domain names to IP addresses.
  • ๐Ÿš Default Gateway: DHCP servers can also provide information about the default gateway, which is the device that packets are sent to when the destination is outside the local network.
  • โš™๏ธ Options: DHCP servers can provide additional configuration options to clients, such as the subnet mask, domain name, and time server information.
  • ๐Ÿ”„ Renewal: DHCP clients can request to renew their lease before it expires to ensure that they continue to have a valid IP address and configuration information.
  • ๐Ÿ›ก๏ธ Failover: DHCP servers can be configured for failover, where two servers work together to provide redundancy and ensure that clients can always obtain an IP address and configuration information, even if one server goes down.
  • ๐Ÿ”ƒ Dynamic Updates: DHCP servers can also be configured to dynamically update DNS records with the IP address of DHCP clients, allowing for easier management of network resources. $1 $1
  • ๐Ÿ“ Audit Logging: DHCP servers can keep audit logs of all DHCP transactions, providing administrators with visibility into which devices are using which IP addresses and when leases are being assigned or renewed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment