Lab 09 : DHCP configuration in GNS3

Objective

A DHCP server is used to automatically provide IP addresses to clients. In this lab, you will configure a Dynamic Host Configuration Protocol (DHCP) server and two clients.

Lab Topology

The topology diagram below represents the NetMap in the GNS3

IP Addresses

  • The IP addresses and subnet masks used in this lab are shown in the table below:

Device

Interface

IP Address

Subnet Mask

R1

fa0/0

192.168.1.1

255.255.255.0

Server

e0

192.168.1.50

255.255.255.0

Task 1

  • On R1, issue the following commands to configure the router to respond to DHCP requests and to enable the DHCP server process:

Copy

R1#configure terminal
R1(config)#service dhcp

Task 2

  • On R1, issue the following command to add a range of IP addresses from 192.168.1.1 to 192.168.1.99 to the exclude list for all DHCP pools, which will prevent the DHCP server from allocating those IP addresses to a DHCP client:

R1(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.99

Task 3

  • On R1, issue the following command to configure pool name of LANPOOL:

R1(config)#ip dhcp pool LANPOOL
R1(dhcp-config)#

Task 4

  • On R1, issue the following command to configure LANPOOL to assign IP addresses to DHCP clients:

R1(dhcp-config)#network 192.168.1.0 255.255.255.0

Task 5

  • On R1, issue the following command to configure LANPOOL to lease each IP address for 2 days, which is equivalent to 48 hours:

The syntax of the lease command is lease {days [hours [minutes]], where days is an integer value from 0 through 365, hours is an integer value from 0 through 23, and minutes is an integer value from 0 through 59.

R1(dhcp-config)#lease ?
  <0-365>   Days
  infinite  Infinite lease

R1(dhcp-config)#lease 2

Task 6

  • On R1, issue the following command to configure LANPOOL to use the IP address configured on the FastEthernet 0/1 interface as the default gateway for DHCP clients from this pool:

R1(dhcp-config)#default-router 192.168.1.1

The default router is also known as the default gateway. A client directs a packet to its default gateway if it does not have a direct route to the destination IP address in a packet’s header.

Task 7

  • After you start the VPCS node you can connect to the console and issue the following command:

PC1> dhcp
DORA IP 192.168.1.100/24 GW 192.168.1.1

PC1> show ip

NAME        : PC1[1]
IP/MASK     : 192.168.1.100/24
GATEWAY     : 192.168.1.1
DNS         :
DHCP SERVER : 192.168.1.1
DHCP LEASE  : 172796, 172800/86400/151200
MAC         : 00:50:79:66:68:00
LPORT       : 10002
RHOST:PORT  : 192.168.56.1:10003
MTU:        : 1500

PC1>

Task 8

  • On Server, issue the following command:

Server> ip 192.168.1.50/24 192.168.1.1
Checking for duplicate address...
PC1 : 192.168.1.50 255.255.255.0 gateway 192.168.1.1

Server> show ip

NAME        : Server[1]
IP/MASK     : 192.168.1.50/24
GATEWAY     : 192.168.1.1
DNS         :
MAC         : 00:50:79:66:68:01
LPORT       : 10005
RHOST:PORT  : 192.168.56.1:10004
MTU:        : 1500

Server>

Task 9

  • Verify DHCP Server Functionality

R1#show dhcp lease
R1#show ip dhcp bi
R1#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name
192.168.1.100       0100.5079.6668.00       Apr 16 2018 12:32 PM    Automatic

Task 10

  • On R1, issue the show ip dhcp server statistics command to examine a general summary of each DHCP server’s operating statistics. The command output includes statistics about the numbers of configured address pools, automatic and manual bindings, and types of DHCP messages sent and received.

R1#show ip dhcp server statistics
Memory usage         31951
Address pools        1
Database agents      0
Automatic bindings   1
Manual bindings      0
Expired bindings     0
Malformed messages   0
Secure arp entries   0

Message              Received
BOOTREQUEST          0
DHCPDISCOVER         3
DHCPREQUEST          2
DHCPDECLINE          0
DHCPRELEASE          0
DHCPINFORM           0

Message              Sent
BOOTREPLY            0
DHCPOFFER            2
DHCPACK              2
DHCPNAK              0
R1#

Task 11

  • On R1, issue the show ip dhcp pool command to verify the address ranges of the configured DHCP pools and their respective number of leased addresses. The output includes the number of currently leased addresses, the IP address range of the pool, and the value of the IP address that will be offered to the next client.

R1#show ip dhcp pool

Pool LANPOOL :
 Utilization mark (high/low)    : 100 / 0
 Subnet size (first/next)       : 0 / 0
 Total addresses                : 254
 Leased addresses               : 1
 Pending event                  : none
 1 subnet is currently in the pool :
 Current index        IP address range                    Leased addresses
 192.168.1.101        192.168.1.1      - 192.168.1.254     1
R1#

Last updated