The Cisco DHCP server feature is a full implementation that assigns and manages IP addresses from specified address pools to DHCP clients. After a DHCP client has booted, the client begins sending packets to its default router. The IP address of the default router should be on the same subnet as the client.
The DHCP discovery follow four steps:
- The client send a DHCPDISCOVER in broadcast to find a DHCP server.
- The server sends a DHCPOFFER to the client in unicast. In this phase the DHCP server sends a proposed configuration to the DHCP client.
- The clients sends a DHCPREQUEST in broadcast, if the clients finds the offer agreeable. Why in broadcast? Because the DHCPDISCOVER sended by the client might have reached more than one DHCP server.
- The server sends a DHCPACK unicast to the client
- If the client detects that the ip is already in use it sends a DHCPDECLINE
- If the client receives a DHCPNAK from the server, it restart the process
- If there is no conflict with the ip address, the client can ‘autoconfigure’ the NIC.
To configure a DHCP server on your cisco router:
- Define the IP range that must be excluded from being offered by the router’s DHCP service: Ciscozine(config)# ip dhcp excluded-address [low ip address] [high ip address]
- Define a pool for your DHCP pool configuration: Ciscozine(config)# ip dhcp pool [name of your pool]
- Define the features of your pool:
- Define the network and subnet that the clients must belong. Ciscozine(config-dhcp)# network [Network number] [Network mask or prefix length]
- Define the default router for the DHCP client: Ciscozine(config-dhcp)# default-router [ip of your default router] (You can configure more than one default gateway)
- Define the DNS server used by the DHCP client: Ciscozine(config-dhcp)# dns-server [dns server ip] (You can configure more than one dns server)
- You could configure others features like domain-name, netbios-name, lease, …
Example of configuration:
!The ip address that could not be used by the dhcp server process ip dhcp excluded-address 172.16.0.1 ip dhcp excluded-address 172.16.0.2 ip dhcp excluded-address 172.16.0.3 !My dhcp pool named Ciscozine_LAN ip dhcp pool Ciscozine_LAN network 172.16.0.0 255.255.255.0 default-router 172.16.0.253 dns-server 188.8.131.52 184.108.40.206 220.127.116.11
Useful command to verify DHCP Operations are:
- show ip binding: DHCP address bindings
- show ip conflict: DHCP address conflicts
- show ip database: DHCP database agents
- show ip server statistics: Miscellaneous DHCP server information
Helpful command for troubleshooting DHCP configurations and operations are:
- debug ip dhcp events: Report address assignments, lease expirations, etc.
- debug ip dhcp linkage: Show database linkage
- debug ip dhcp packet: Decode message receptions and transmissions
as I know the DHCPACK Answer of a DHCP-Server is Broadcast and not Unicast.
@Matt: Hi peep, you can crosscheck your references cos DHCPACK is usually sent to client in unicast
It will turn into a unicast if it get passed by a router with a helper address to a specific dhcp server. And the DHCPACK is a tcp ack towards the server not a broadcast on to the network.
After the DHCP server receives the DHCPREQUEST, it acknowledges the request with a DHCPACK message, thus completing the initialization process. The DHCPACK message has a source IP address of the DHCP server, and the destination address is once again a broadcast and contains all the parameters that the client requested in the DHCPREQUEST message. When the client receives the DHCPACK, it enters into the Bound state, and is now free to use the IP address to communicate on the network. Meanwhile, the DHCP server stores the lease in its database and uniquely identifies it using the client identifier or chaddr, and the associated IP address. Both the client and server will use this combination of identifiers to refer to the lease. The client identifier is the Mac address of the device plus the media type.
Before the DHCP client begins using the new address, the DHCP client must calculate the time parameters associated with a leased address, which are Lease Time (LT), Renewal Time (T1), and Rebind Time (T2). The typical default LT is 72 hours. You can use shorter lease times to conserve addresses, if needed.