DHCP stands for Dynamic Host Configuration Protocol. It’s a network protocol used to automatically assign IP addresses and other network configuration parameters to devices on a network. DHCP is commonly used in enterprise networks to simplify the process of connecting devices and managing IP addresses.
Here’s how DHCP generally works:
- Client Request: When a device (referred to as a client) joins a network, it sends out a DHCP request for an IP address and other configuration information (DNS, default gateway, etc.)
- DHCP Server: A DHCP server on the network receives the client’s request. The server manages a pool of available IP addresses and their associated configuration settings.
- IP Address Assignment: The DHCP server selects an available IP address from its pool and assigns it to the requesting client. This helps prevent IP address conflicts that could occur if multiple devices tried to use the same IP address.
- Configuration Parameters: In addition to an IP address, the DHCP server can provide other configuration parameters to the client, such as subnet mask, gateway (router) IP address, DNS server IP addresses, and more.
- Lease Duration: The DHCP server assigns IP addresses for a specific period known as the lease duration. After this period, the client’s IP lease expires, and the client must renew its lease if it wants to continue using the same IP address.
Using DHCP simplifies the network administration process, as it eliminates the need to manually configure IP addresses on each device. It also allows for efficient utilization of available IP addresses by reclaiming addresses that are no longer in use when leases expire.
However, it’s worth noting that DHCP might not be suitable for all scenarios. In certain cases, such as servers or devices that need static IP addresses for consistent network access, manual configuration might be preferred.
In summary, DHCP is a protocol that automates the process of assigning IP addresses and other network configuration settings to devices, making network management more efficient and less error-prone.
DHCP Frame Format
DHCP (Dynamic Host Configuration Protocol) uses two UDP (User Datagram Protocol) port numbers for its operations:
- UDP Port 67: This port is used by DHCP servers to receive DHCP client requests. When a client is looking to obtain an IP address and other configuration parameters, it sends out a DHCPDISCOVER message to the server using UDP port 67.
- UDP Port 68: This port is used by DHCP clients to send their requests to DHCP servers. When a client wants to renew its IP address lease or perform other DHCP-related actions, it uses UDP port 68 to communicate with the server.
These port numbers are well-defined and standardized to ensure that DHCP clients and servers can communicate effectively on a network. The client and server use these ports to send and receive DHCP messages as part of the IP address assignment and configuration process.
“DORA” is an acronym that stands for “Discover, Offer, Request, Acknowledge.” It’s a four-step process used in the Dynamic Host Configuration Protocol (DHCP), which is a network management protocol commonly used to automatically assign IP addresses and network configuration parameters to devices on a network. The DORA process describes how a DHCP client and DHCP server interact to obtain and assign IP addresses.
Here’s a breakdown of each step in the DHCP DORA process:
PC2 DHCP Server Configuration
PC2(dhcp-config)#do show run | sec dhcp
ip dhcp excluded-address 192.168.13.1 192.168.13.10
ip dhcp pool LAB_DHCP
network 192.168.13.0 255.255.255.0
default-router 192.168.13.1
dns-server 4.2.2.1 8.8.8.8
domain-name dhcplab.net
lease 0 10
vIOS3’s g0/0 interface configuration with the helper address pointing to the DHCP server.
vIOS3#show run int g0/0
Building configuration...
Current configuration : 170 bytes
!
interface GigabitEthernet0/0
description PC-LINK
ip address 192.168.13.1 255.255.255.0
ip helper-address 192.168.62.2
duplex auto
speed auto
media-type rj45
end
- Discover (D): The DHCP client broadcasts a DHCPDISCOVER message on the network, indicating that it is looking for a DHCP server. This broadcast is usually sent as a UDP packet to the destination IP address 255.255.255.255 (or the broadcast address of the subnet).
2. Offer (O): When a DHCP server receives the DHCPDISCOVER message, it checks its available IP address pool. If there are free IP addresses, the server sends a DHCPOFFER message to the client. This message contains an available IP address along with other network configuration parameters such as subnet mask, default gateway, and DNS server addresses.
The DHCP offer frame will contain additional attributes
3. Request (R): The DHCP client receives one or more DHCPOFFER messages from different DHCP servers (if available). The client then chooses one of the offered IP addresses and sends a DHCPREQUEST message to the chosen DHCP server, indicating its intent to use the offered IP address. This step prevents conflicts in case multiple DHCP servers responded with offers. This message tells the server that it accepts the IP address given by the server. This message tells the server that it accepts the IP address given by the server.
The source IP address will be 0.0.0.0 as the DHCP server hasn’t yet assigned an IP address to the client. DHCP Request Message is also a broadcast message.
DHCP Request from the client to the server
4. Acknowledge (A): The DHCP server that received the DHCPREQUEST message verifies that the offered IP address is still available. If the IP address is available, the server sends a DHCPACK (DHCP Acknowledge) message to the client, confirming the assignment of the IP address and providing the final set of network configuration parameters. If the offered IP address is no longer available, the server sends a DHCPNAK (DHCP Not Acknowledge) message and the client has to restart the process.
PC1’s interface is configured for DHCP
PC1#show run int e0/0
Building configuration...
Current configuration : 65 bytes
!
interface Ethernet0/0
ip address dhcp
no ip route-cache
end
Once the client receives the DHCPACK message, it configures its network interface with the provided IP address and other configuration settings. The client is now connected to the network with a dynamically assigned IP address and appropriate network settings.
The DORA process ensures that IP address assignment is coordinated and avoids conflicts between multiple devices requesting IP addresses simultaneously.