In this lab, we use GNS3 to build a DHCP server (R1), and DHCP relay agent(R2).

Purpose:
  • Configure the DHCP server and DHCP relay agent.
  • Use Pc1 to test the process of the DHCP “Discovery Offer Request Acknowledgement”.
1, Configuration.

Configure the DHCP server, DHCP relay agent ip address according to the diagram; configure static route on R1;DHCP_lab

R1(config)#ip dhcp excluded-address 192.168.3.1
R1(config)#domain-name frankfu.com
R1(config)#ip dhcp pool home

R1(config)#lease 0 0 3    // first number 0 means day, second number 0 means hour, third number 3
R1(dhcp-config)#network 192.168.3.0 255.255.255.0
R1(dhcp-config)#end

Configure the DHCP relay agent.

R2(config)#interface g0/0

R2(config-if)#ip add 192.168.3.1 255.255.255.0

R2(config-if)#ip helper-address 192.168.1.10

 

Verify the configuration, Run debug mode and observe the process:

R1#show run | section dhcp
no ip dhcp use vrf connected
ip dhcp excluded-address 192.168.3.1
ip dhcp pool home
network 192.168.3.0 255.255.255.0
domain-name frankfu.com
default-router 192.168.3.1
lease 0 0 3

R1#debug ip dhcp server packet

R1#

Then switch to PC1 and enter the command:

PC1> ip dhcp
DORA IP 192.168.3.2/24 GW 192.168.3.1

PC1> show ip

NAME        : PC1[1] IP/MASK     : 192.168.3.2/24
GATEWAY     : 192.168.3.1
DNS         :
DHCP SERVER : 192.168.1.10
DHCP LEASE  : 163, 180/90/157
DOMAIN NAME : frankfu.com
MAC         : 00:50:79:66:68:00
LPORT       : 10007
RHOST:PORT  : 127.0.0.1:10006
MTU:        : 1500

Switch back to R1 and we can watch the DHCP process:

*Mar  1 01:34:04.739: DHCPD: DHCPDISCOVER received from client 0100.5079.6668.00 through relay 192.168.3.1.
*Mar  1 01:34:04.743: DHCPD: Sending DHCPOFFER to client 0100.5079.6668.00 (192.168.3.2).
*Mar  1 01:34:04.743: DHCPD: unicasting BOOTREPLY for client 0050.7966.6800 to relay 192.168.3.1.
*Mar  1 01:34:05.687: DHCPD: DHCPREQUEST received from client 0100.5079.6668.00.
*Mar  1 01:34:05.687: DHCPD: Appending default domain from pool
*Mar  1 01:34:05.691: DHCPD: Using hostname ‘PC11.frankfu.com’ for dynamic update (from hostname option)
*Mar  1 01:34:05.691: DHCPD: Sending DHCPACK to client 0100.5079.6668.00 (192.168.3.2).
R1#
*Mar  1 01:34:05.691: DHCPD: unicasting BOOTREPLY for client 0050.7966.6800 to relay 192.168.3.1.
R1#
R1#
*Mar  1 01:35:34.463: DHCPD: DHCPREQUEST received from client 0100.5079.6668.00.
*Mar  1 01:35:34.463: DHCPD: Appending default domain from pool
*Mar  1 01:35:34.467: DHCPD: Using hostname ‘PC11.frankfu.com’ for dynamic update (from hostname option)
*Mar  1 01:35:34.467: DHCPD: Sending DHCPACK to client 0100.5079.6668.00 (192.168.3.2).
*Mar  1 01:35:34.467: DHCPD: unicasting BOOTREPLY for client 0050.7966.6800 to relay 192.168.3.1.
R1#
*Mar  1 01:37:00.035: DHCPD: DHCPREQUEST received from client 0100.5079.6668.00.
*Mar  1 01:37:00.039: DHCPD: Appending default domain from pool
*Mar  1 01:37:00.039: DHCPD: Using hostname ‘PC11.frankfu.com’ for dynamic update (from hostname option)
*Mar  1 01:37:00.039: DHCPD: Sending DHCPACK to client 0100.5079.6668.00 (192.168.3.2).
*Mar  1 01:37:00.039: DHCPD: unicasting BOOTREPLY for client 0050.7966.6800 to relay 192.168.3.1.
R1#
*Mar  1 01:38:26.163: DHCPD: DHCPREQUEST received from client 0100.5079.6668.00.
*Mar  1 01:38:26.163: DHCPD: Appending default domain from pool
*Mar  1 01:38:26.167: DHCPD: Using hostname ‘PC11.frankfu.com’ for dynamic update (from hostname option)
*Mar  1 01:38:26.167: DHCPD: Sending DHCPACK to client 0100.5079.6668.00 (192.168.3.2).
*Mar  1 01:38:26.167: DHCPD: unicasting BOOTREPLY for client 0050.7966.6800 to relay 192.168.3.1.
R1#

Note the time stamp that every 1 minuts 26 seconds,which is the half of the lease time the client request to renew the DHCP lease.