DHCP (Dynamic Host Configuration Protocol)
The DHCP protocol allows clients to dynamically configure network parameters without the need for a manual configuration process. Dynamically assigns an IP address to the client, subnet mask, default gateway, DNS server, lease time, etc.
The four basic DHCP phases:
- Step 1.- DHCP Discover.- Broadcast message from a client to find a dhcp server
- Step 2.- DHCP Offer.- DHCP server response from the client’s DISCOVER message. This message contains the network information provided by the dhcp server, such as client ip, subnet mask, gateway, dns server, etc.
- Step 3.- DHCP Request. The client’s message is used to respond to the DHCP server and accept the information provided in step 3.
- Step 4.- DHCP Ack.- The DHCP server sends you acknowledgment to confirm the lease.
DHCP server configuration in router:
Switch(config)# ip dhcp excluded-address 10.1.1.1 10.1.1.10. ////Exclude a range of IP addresses from being delivered automatically.
Switch(config)# ip dhcp pool Users //Assign a name to the address pool
Switch(dhcp-config)# network 10.1.1.0 255.255.255.0
Switch(dhcp-config)# default-router 10.1.1.1
Switch(dhcp-config)# dns-server 10.10.10.1
Switch(dhcp-config)# lease infinite //Lease time for the client, can be configures by day, hour and minutes
Verification:
Switch# show ip dhcp binding //Show all IPs assigned by the server
Switch# clear ip dhcp binding * //Delete all DHCP leases
Switch# debug ip dhcp server packet|events //View real-time dhcp discover, offer, request and ack.
DHCP Relay – Relay Agent
It used to forward DHCP messages to DHCP servers on remote networks. It converts the packets to unicast and delivers them to the IP configured as a DHCP server.
It is applied on the physical interface or SVI, so no DHCP pools are created.
Configuration:
Switch(config)# interface vlan 1
Switch(config-if)# ip helper-address 10.1.10.1