How to Configure DHCP on Cisco Routers?

DHCP4

In this DHCP Cisco Packet Tracer router example, we will focus on DHCP Configuration in Cisco Packet Tracer. In other words, we will see how to configure a DHCP Server with Packet Tracer Router.

 

Before start-up I want to give some basic information about DHCP.

 

As you know DHCP uses UDP 67 and UDP 68 ports. It has a messaging system for the communication between DHCP Server and DHCP Client. These messaging system’s messages and their types are mentined below:

 

• DHCP Discover (broadcast)
• DHCP Offer(broadcast)
• DHCP Request (broadcast)
• DHCP Ack (broadcast)
• DHCP Nak (unicast)
• DHCP Release (unicast)
• DHCP Decline (unicast)
• DHCP Inform (unicast)


dhcp-messages-DORA
DHCP Messages


• You can also check DHCP Overview Lesson and DHCP IP Allocation Lesson to learn more.

• You can Reach All Cisco Packet Tracer Labs and DOWNLOAD the Packet Tracer Examples with .pkt format.

• You can DOWNLOAD this lessons Packet Tracer Example with .pkt format HERE.


 

 

  1. Firstly, a client sends a broadcast “DHCP Discovery” message that mentions that it need an ip address.
  2. Then, the DHCP servers reply with configuration offers to the client by “DHCP Offer” unicast message.
  3. After that DHCP client sends a broadcast “DHCP Request” message to the network with the “Transaction ID” of the first DHCP Server that send Offer. The other servers understand that client wants to use the server that has the related “Transaction ID”.
  4. Lastly, the Server sends a unicast “Acknowledgement” message to the client that mentions the ip assignment is successfully done or it send a refuse messaged named “DHCP-NACK”.

 

To configure a Packet Tracer Router ’s DHCP, we must follow some basic steps. For this configuration the important point is broadcast domains. If we have only one broadcast domain in our topology, our work is simpler, else we must get help from “ip-helper address” command.

 

What is ip helper address command? Ip helper address command is the command that helps us to convince the router and make it pass the broadcast packets.

 

Now, let’s go to our two different configuration topology and see how to configure a server in packet tracer for DHCP, how to configure a DHCP Server in packet tracer.

 


 

DHCP Packet Tracer Config For One Broadcast Domain

 

Our one broadcast domain topology is like below. There is a router that will carry our DHCP server role beside its routing functionalities. And there is a switch for PCs.

DHCP Packet Tracer Example Topology
DHCP Example Topology (One Broadcast Domain)
 

Firstly, let’s see How to Configure a DHCP Server  on a Packet Tracer Router for One Broadcast Domain. For this first case of our DHCP Cisco packet tracer example, the One Broadcast Domain topology that we will use, is like below. There is a router that will carry out Server role beside its routing functionalities. And there is a switch for PCs.

 

On routerA, firstly we will give an ip address to the router interface that is connected to the switch.Secondly that we will create a DHCP pool named IPD. In this pool we will mention ip addresses that will be given to the DHCP clients.After that we will assign the router’s interface address as a default-router address for clients. And in the last part, we will exclude some addresses with “ip dhcp excluded address” command, that we don’t want to use during this dynamic ip assignments. With “ip dhcp excluded address” command, the mentined addresses will not used in the pool.

 

RouterA# config terminal

RouterA(config)# interface fastEthernet 1/0

RouterA(config-if)# ip address 192.168.10.1 255.255.255.0

RouterA(config-if)# no shut

%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up<

RouterA(config-if)# exit

RouterA(config)# ip dhcp pool IPD

RouterA(dhcp-config)# network 192.168.10.0 255.255.255.0

RouterA(dhcp-config)# default-router 192.168.10.1

RouterA(dhcp-config)# exit

RouterA(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10

RouterA(config)# ip dhcp excluded-address 192.168.10.12 192.168.10.14

After this configuration, when we check the ip address of PC0, we will see the ip address 192.168.10.11 . Because it is the first available address in DHCP pool.

We can also check the pool information with Cisco “show ip dhcp pool” command.

 


 

Packet Tracer DHCP Config For Multiple Broadcast Domains

 

Our second case is how to enable DHCP on router for multiple broadcast domains. In our second Cisco packet tracer example, we will use ip helper, cisco command “ip helper-address“. So, what is ip helper address?

 

Many CCNAs learn that routers do not pass broadcasts. But progress in CCIE, network engineers learn that it is not true. Because you can pass broadcast traffic for many protocols as DHCP by “ip-helper address” command. Here we will refer only the broadcast of DHCP requests. We can use a router as a DHCP Server again, but I use a separate DHCP Server instead of router in this topology.

 

DHCP Example Topology (One Broadcast Domain)
 

DHCP Example Topology (Multiple Broadcast Domains)
 

In the first place we will configure the DHCP Server for its DHCP pools and its ip configuration. The ip address is 192.168.1.10 and the default gateway will be the routers interface’s ip address that is face to DHCP server.

 

 

 

For the subnets 192.168.1.0 and 10.10.0.0 there must be two DHCP pool.The below screenshot is showing how these assignments will be done in DHCP Server.

 

 


In the Packet Tracer router the following configuration will be done for two different subnet DHCP achivement:

RouterC # config terminal

RouterC(config)# interface fa0/0

RouterC(config-if)# ip address 10.10.0.1 255.255.255.0

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

RouterC(config-if)# no shutdown

RouterC(config-if)# exit

RouterC(config)# interface fa1/0

RouterC(config-if)# ip address 192.168.1.1 255.255.255.0

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

RouterC(config-if)# no shutdown

RouterC(config-if)# end

RouterC# copy run start

After this configuration, we can try dynamic ip assignment on PC by selecting the dynamic option on ip configuration screen like below.

 

As you can seee, our PCs get their IP configuration form DHCP Server.  The IP assignment is done automatically.

 

 

DHCP Messages, DHCP Discovery, DHCP Offer, DHCP Request, DHCP ACK, DHCP NACK
 

DHCP Messages
Lesson tags: DHCP, cisco packet tracer
Back to: CCIE Enterprise Infrastructure > DHCP

Leave a Reply

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

CCIE Enterprise Infrastructure

Collapse
Expand