With Cisco Packet Tracer, you can create network topologies and gain experience. This software is a Cisco network simulator program and is entirely free.
How to Enable and Configure DHCP on a Cisco Router
The easiest way to configure a network is to take advantage of DHCP servers located on routers. The DHCP server is responsible for providing an IP address and network parameters (subnet mask and gateway) to all equipment and devices connected to it.
This server is also responsible for configuring the DNS servers of the connected equipment. Still, because of the firmware installed by the providers on their routers, the default DNS added is the manufacturer’s DNS.
Dynamic Host Configuration Protocol is the protocol that allows the automatic assignment of IP addresses.
The DHCP protocol uses UDP as the transport protocol, UDP port 67 is the destination port of a server, and the client uses UDP port 68.
With the DHCP service, you can configure the following parameters automatically:
- IP Address
- Subnet Mask
- Default Gateway
- DNS
By using Cisco’s network simulator software to create a new network topology and add multiple clients and one Cisco Router to the network, you can automatically configure it with the DHCP service instead of manually configuring the TCP/IP configuration of all clients that will be connected to the network.
Step 1
First, create a network topology with two separate segments (192.168.1.0/24 and 192.168.2.0/24) in Packet Tracer.
Step 2
In the Router0 window, click the CLI command prompt tab, and on the initial configuration screen, type No and press Enter. If you select Yes on this screen, the Cisco router will ask you step-by-step to make basic settings.
Step 3
Assign IP addresses and open ports to Cisco router interfaces according to the network topology you create. Then, enable DHCP by executing the following commands to distribute IP information from the Router to the clients automatically.
Router>enable
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface gigabitethernet 0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#interface gigabitethernet 0/1
Router(config-if)#ip address 192.168.2.1 255.255.255.0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#ip dhcp pool LAN1
Router(dhcp-config)#network 192.168.1.0 255.255.255.0
Router(dhcp-config)#default-router 192.168.1.1
Router(dhcp-config)#dns-server 192.168.1.1
Router(dhcp-config)#exit
Router(config)#ip dhcp excluded-address 192.168.1.1
Router(config)#ip dhcp pool LAN2
Router(dhcp-config)#network 192.168.2.0 255.255.255.0
Router(dhcp-config)#default-router 192.168.2.1
Router(dhcp-config)#dns-server 192.168.2.1
Router(dhcp-config)#exit
Router(config)#ip dhcp excluded-address 192.168.2.1
Router(config)#end
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#wr
Building configuration...
[OK]
Router#
Step 4
After you apply the Cisco DHCP commands, you must set up the computers that you add to the Packet Tracer workspace for the automatic IP address. To do this, click on PC0, click IP Configuration in the window that opens, and then activate the DHCP option.
Step 5
After enabling DHCP on PC0, an IP address request will be sent as in the following image.
Step 6
DHCP will allocate an IP address by responding to PC0’s request.
Step 7
Enable the DHCP option for computers on the 192.168.2.0/24 network and check the status.
Step 8
PC2 will also obtain the IP address successfully because the DHCP pool is configured for the 192.168.2.0/24 network on the Cisco router.
Step 9
When you test the network connection by pinging PC0 to 2.0, this will be successful as follows.
Step 10
Ping over PC3 to the 1.0 network will also be successful.
Step 11
You can see the IP addresses and MAC addresses assigned to the clients with the show ip dhcp binding command on the Router.
Step 12
You can also review the DHCP pool details, as shown in the image below when you execute the show ip dhcp pool command.
Show Commands
Router#show ip dhcp ?
binding DHCP address bindings
conflict DHCP address conflicts
pool DHCP pools information
relay Miscellaneous DHCP relay information
Router#show ip dhcp binding
IP address Client-ID/ Lease expiration Type
Hardware address
192.168.1.2 000C.8536.A381 -- Automatic
192.168.1.3 00E0.B0AC.5779 -- Automatic
192.168.2.2 00E0.F7CA.7827 -- Automatic
192.168.2.3 000A.F383.BCDE -- Automatic
Router#show ip dhcp pool
Pool LAN1 :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses : 254
Leased addresses : 2
Excluded addresses : 2
Pending event : none
1 subnet is currently in the pool
Current index IP address range Leased/Excluded/Total
192.168.1.1 192.168.1.1 - 192.168.1.254 2 / 2 / 254
Pool LAN2 :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses : 254
Leased addresses : 2
Excluded addresses : 2
Pending event : none
1 subnet is currently in the pool
Current index IP address range Leased/Excluded/Total
192.168.2.1 192.168.2.1 - 192.168.2.254 2 / 2 / 254
Router#
Video
PT yazılımını kullanarak Cisco yönlendirici üzerinde DHCP’yi yapılandırmak için aşağıdaki videoyu izleyebilir ve ayrıca bize destek olmak için YouTube kanalımıza abone olabilirsiniz!
Conclusion
In growing network topology, manually configuring the TCP/IP settings of network devices will save you time by adding a DHCP Server to the environment to automatically distribute IP information to clients or activate the server on the Router you are using. Thanks for following us!