DHCPv4 works in a client/server mode. When a client communicates with a DHCPv4 server, the server assigns or leases an IPv4 address to that client.
When the client boots (or otherwise wants to join a network), it begins a four-step process to obtain a lease:
1.DHCP Discover (DHCPDISCOVER)
2.DHCP Offer (DHCPOFFER)
3.DHCP Request (DHCPREQUEST)
4.DHCP Acknowledgment (DHCPACK)
Prior to lease expiration, the client begins a two-step process to renew the lease with the DHCPv4 server, as shown in the figure:
Before the lease expires, the client sends a DHCPREQUEST message directly to the DHCPv4 server that originally offered the IPv4 address. If a DHCPACK is not received within a specified amount of time, the client broadcasts another DHCPREQUEST so that one of the other DHCPv4 servers can extend the lease.
On receiving the DHCPREQUEST message, the server verifies the lease information by returning a DHCPACK.
Displays the DHCPv4 commands configured on the router.
Displays a list of all IPv4 address to MAC address bindings provided by the DHCPv4 service.
Displays count information regarding the number of DHCPv4 messages that have been sent and received
Verify DHCPv4 Client Received IPv4 Addressing
https://github.com/pnetlabrepo/ishare2/tree/main/upgrades/from_any_to_5.3.11
Configure DHCP Relay
Configure R1 and R3 as a DHCP relay agent.
R1(config)# interface g0/0
R1(config-if)# ip helper-address 10.1.1.2
Configure R2 to exclude the first 10 addresses from the R1 LAN.
R2(config)#
ip dhcp excluded-address 192.168.10.1 192.168.10.10
Create DHCP pool R1-LAN
ip dhcp pool R1-LAN
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
dns-server 192.168.20.254
Configure R2 to exclude the first 10 addresses from the R3 LAN
R2(config)#
ip dhcp excluded-address 192.168.30.1 192.168.30.10
Create DHCP pool R3-LAN
ip dhcp pool R3-LAN
network 192.168.30.0 255.255.255.0
default-router 192.168.30.1
dns-server 192.168.20.254
Configure a Router as a DHCP Client
R2(config)# interface g0/1
R2(config-if)# ip address dhcp
R2(config-if)# no shutdown
Configure DHCP Relay
Configure R1 and R3 as a DHCP relay agent.
R3(config)# interface g0/0
R3(config-if)# ip helper-address 10.2.2.2
SW1 configuration
vlan 10
name SALES
vlan 20
name MARKETING
interface f0/1
switchport mode access
switchport access vlan 10
interface f0/2
switchport mode access
switchport access vlan 20
interface g0/1
switchport mode trunk
SW2 configuration
vlan 10
name SALES
vlan 20
name MARKETING
interface f0/1
switchport mode access
switchport access vlan 10
interface f0/2
switchport mode access
switchport access vlan 20
interface g0/2
switchport mode trunk
MLS configuration
vlan 10
name SALES
vlan 20
name MARKETING
interface range g0/1-2
switchport trunk encapsulation dot1q
switchport mode trunk
interface f0/1
no switchport
ip address dhcp
ip routing
interface vlan 10
ip address 192.168.10.1 255.255.255.0
interface vlan 20
ip address 192.168.20.1 255.255.255.0
ip dhcp excluded-address 192.168.10.1 192.168.10.9
ip dhcp excluded-address 192.168.20.1 192.168.20.9
ip dhcp pool LAN10
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
dns-server 192.168.30.30
domain-name procloud.bh
ip dhcp pool LAN20
network 192.168.20.0 255.255.255.0
default-router 192.168.20.1
dns-server 192.168.30.30
domain-name procloud.bh
SW(config)#
ip dhcp snooping
ip dhcp snooping vlan 1
interface f0/4
ip dhcp snooping trust