when setting up a network in Cisco Packet Tracer, manually assigning IP addresses to every client can be time-consuming and prone to errors. That's where DHCP (Dynamic Host Configuration Protocol) comes in. DHCP automatically assigns IP addresses and other network parameters (like subnet mask, default gateway, and DNS) to devices, making network management easier.
In this tutorial, we'll walk through how to configure a DHCP server in Cisco Packet Tracer and test it with client PCs.
What is DHCP?
DHCP (Dynamic Host Configuration Protocol) is a network service that automatically provides:
- IP address
- Subnet Mask
- Default Gateway
- DNS Server
Instead of configuring each client manually, the DHCP server takes care of assigning IP addresses dynamically.
Lab Topology Setup
- 1 Router (acts as DHCP server)
- 1 Switch
- 2 PCs (DHCP Clients)
You can expand this later by adding more PCs or even configuring a dedicated DHCP server device.
Step 1: Basic Device Setup
- Drag and drop a Router, Switch, and 2 PCs in Cisco Packet Tracer.
- Connect them using copper straight-through cables:
- Router -> Switch -> PCs
Step 2: Configure Router Interfaces
- Click on the router -> CLI
- Enter the following commands:
Router> enable
Router# configure terminal
Router(config)# interface fastEthernet 0/0
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Router(config-if)# no shutdown
Router(config-if)# exit
Here, the router's interface will act as the gateway for our network.
Step 3: Configure DHCP on the Router
Now let's set up the DHCP pool
Router(config)# ip dhcp pool **LAN**
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 8.8.8.8
Router(dhcp-config)# exit
Router(config)# end
Router# write
This configuration means:
- The DHCP pool is named LAN
- IP range will be in the
192.168.1.0 /24
network - Default gateway is the router
192.168.1.1
- DNS server is set to Google's DNS
8.8.8.8
Step 4: Exclude IP Addresses
You might want to reserve some IPs (for example, for the router itself or servers).
Router(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.10
This ensure IPs from .1
to .10
are not assigned to clients.
Step 5: Configure PCs as DHCP Clients
- Click on a PC -> go to Desktop -> IP Configuration
- Select DHCP
- The PC should automatically receive an IP address, subnet mask, gateway, and DNS.
Do this for both PCs.
Step 6: Verify DHCP Assignment
- On the PC's Command Prompt, type:
ipconfig /all
You should see an IP address like 192.168.1.11
(since .1
to .10
are excluded).
- Try pinging the router:
ping 192.168.1.1
If you get replies, you DHCP setup is working correctly!
Conclusion
In this tutorial, we learned how to:
- Configure a router interface as a gateway
- Set up a DHCP pool in Cisco Packet Tracer
- Excluded IP addresses from DHCP assignment
- Verify that clients successfully receive IP addresses
Using DHCP not only saves time but also reduces the chance of IP conflicts in larger networks.
Next Step: Try configuring multiple DHCP pools on a router with a sub-interfaces (for VLANs). That's a more advanced setup for larger enterprise environments.
Top comments (0)