How to Configure DHCP on Cisco Router in GNS3

DHCP configuration automatically distributes IP addresses to computers that are communicating on the network, so you don’t have to manually assign IP addresses to computers.

How to Configure DHCP on Cisco Router in GNS3

How to Enable DHCP on a Cisco Router with GNS3

After you configure DHCP on Cisco Routers, the IP Address, Subnet Mask, DNS Address, Default Gateway, and Domain Name automatically distribute to each device on the network.

But the point to note here is that a device connected to the network must be configured to obtain the TCP/IP settings automatic IP address.

Using the GNS3 simulator and VMware virtual machines, you can configure DHCP and better understand the operating logic by creating a more realistic network topology.

   Step 1

First, open the GNS3 program and create a network design as in the image below. And then add one Cisco Router and Switch, and three virtual machines to the workspace.

Configure the adapter settings of the virtual machines as VMnet.

Three Computers and One Cisco Router Connected to a Switch

   Step 2

You must configure the Cisco Switch that you added to the workspace. Otherwise, computers on the network will not be able to communicate with the Router.

To configure the switch, change its settings as shown in the following illustration.

Switch EtherType Configuration

   Step 3

Open the CLI prompt by double-clicking on the router, and then activate DHCP to automatically distribute the IP address to the virtual machines on the same network.

For the GNS3 DHCP configuration on the Router, run the following commands in the CLI.

R1# conf t
R1(config)# interface fastethernet 0/0
R1(config-if)# ip address 192.168.8.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# ip dhcp pool LAN
R1(dhcp-config)# network 192.168.8.0 255.255.255.0
R1(dhcp-config)# default-router 192.168.8.1
R1(dhcp-config)# dns-server 192.168.8.1
R1(dhcp-config)# domain-name sysnettechsolutions.com
R1(dhcp-config)# ip dhcp excluded-address 192.168.8.1
R1(dhcp-config)# lease infinite
R1(dhcp-config)# end
R1# copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
R1#

 
Command descriptions:

ip dhcp pool LAN: Defines a name for the IP pool that you create.
network 192.168.8.0 255.255.255.0: Configures the network to which the IP address will distribute.
default-router 192.168.8.1: Configures the device that is the default gateway on the network.
dns-server 192.168.8.1: Configures the DNS server address on computers.
domain-name sysnettechsolutions.com: Assigns domain name to PCs.
ip dhcp excluded-address 192.168.8.1: Sets the IP address/addresses to exclude.
lease infinite: Configures the lease duration of the information assigned to the PCs on the network.

After executing the necessary commands, run the virtual machines on VMware, and set the TCP/IPv4 settings automatically.

After you configure the IP address automatically, the virtual computers will receive all IP information from the DHCP server.

   Step 4

Now, let’s take a look at the TCP/IP information that computers receive from the Router.

Open the CMD on the Windows 8.1 virtual machine and execute the ipconfig command to review the information reported in the image below.

Windows 8.1 / Hostname

   Step 5

Also, check the TCP/IP information of the Windows 10 virtual machine.

Windows 10 / Hostname

   Step 6

Similarly, check the IP configuration of Windows XP.

The DHCP server configured for 192.168.8.0 IP block has successfully assigned IP addresses to all virtual machines/computers on the network!

Windows XP / Hostname

Show Commands

R1#show running-config
Building configuration...
Current configuration : 1157 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
no aaa new-model
memory-size iomem 5
no ip icmp rate-limit unreachable
ip cef
!
no ip dhcp use vrf connected
ip dhcp excluded-address 192.168.8.1
!
ip dhcp pool LAN
network 192.168.8.0 255.255.255.0
dns-server 192.168.8.1
default-router 192.168.8.1
domain-name sysnettechsolutions.com
lease infinite
!
no ip domain lookup
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
ip tcp synwait-time 5
!
interface FastEthernet0/0
ip address 192.168.8.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
no cdp log mismatch duplex
!
control-plane
!
gatekeeper
shutdown
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
line vty 0 4
login
!
end
R1#

 

R1#show ip dhcp ?
binding              DHCP address bindings
conflict              DHCP address conflicts
database           DHCP database agents
import               Show Imported Parameters
pool                    DHCP pools information
relay                   Miscellaneous DHCP relay information
server               Miscellaneous DHCP server information

 

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.8.3         0100.5056.3a87.3f             Infinite Automatic

 

R1#show ip dhcp pool
Pool LAN :
|     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.8.1 192.168.8.1 - 192.168.8.254 1

 

R1#show ip dhcp server statistics
Memory usage 23999
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 104
DHCPREQUEST 7338
DHCPDECLINE 0
DHCPRELEASE 0
DHCPINFORM 0

Message Sent
BOOTREPLY 0
DHCPOFFER 104
DHCPACK 4408
DHCPNAK 0
R1#

 

How to Enable DHCP on Router ⇒ Video

You can watch the video below to use DHCP on Router and also subscribe to our YouTube channel to support us!

   Final Word


In this article, we have examined how to set up DHCP on the Cisco Router using the Graphical Network Simulator-3. Thanks for following us!

   Related Articles


♦ GNS3 and Static NAT
♦ GNS3 and Dynamic NAT
♦ GNS3 and PAT
♦ SDM and NAT
How to Backup Router Config

Add a Comment

Your email address will not be published. Required fields are marked *

shares
error: