Router DHCP Configuration with Packet Tracer

DHCP4

In this DHCP Cisco Packet Tracer 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.

Before start-up I want to give some basic information about DHCP. As you know DHCP use UDP 67 and 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.


Firstly, a client sends a broadcast “DHCP Discovery” message that mentions that it need an ip address.

Then, the DHCP servers reply with configuration offers to the client by “DHCP Offer” unicast message.

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”.

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 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.

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 in Packet Tracer 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.

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 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 to dynamic ip assignment on PC by selecting the dynamic option on ip configuration screen like below.

 

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

DHCP Messages

We're Sorry!
Full Access is for only IPCisco Crew...
With IPCisco Membership, You Can Access:
• All Certification Courses (Cisco, Juniper, Nokia and Huawei),
• Thousands of Questions (Lesson Quizes and Special Quiz Section),
• Carieer Consultancy, CV/Resume Check, Career Advice Meeting,
• Cheat Sheets, Job Interview Trainings, Network Tools,
You will be Member of a Big IPCisco Community,
You will Learn Network Lessons with Always,
New And Different Learning Styles!
We are waiting for you!

54 Responses to “Router DHCP Configuration with Packet Tracer”


  • haleh / Reply

    hi
    thanks a lot
    i passed ccna and enjoyed from your post and you solve my problem with dhcp config in packet tracer!
    another my problem is config dhcp with different vlans and 1 dhcp server(like part2 of this project) in packet tracer .
    do you have a project about that?

    • gokhankosem / Reply

      Hi Halleh,
      Congratulations for your achievement! I am happy if my article was useful for you;)

      As you know some DHCP packets are broadcast, and so they do not pass any broadcast domain.
      You should cheat the router with ip helper-address:)

      If you give the command “ip helper-address dhcpaddress” command to the interface of the router that is in another broadcast domain,
      then you will able to set the DHCP to a different broadcast domain. Here, ip helper-address command will change the 255.255.255.255
      broadcast address to a unicast address (DHCP server’s address).

      I hope this will be useful for you;)

  • halleh / Reply

    hi gokhan
    can packet tracer 5.3.2 provide dhcp to multi vlans from one server?

  • halleh / Reply

    can serverP-T in yoyr project allocate ip to pcs in different vlan?

    • gokhankosem / Reply

      Hi Halleh,

      Yes it can allocate ip to different vlans by ip helper-address command;)

  • adepoju emmanuel / Reply

    pls can get me thru on how packet tracer 5.3.2 provide dhcp to multi-vlan from one server

  • Radia / Reply

    thank u for ur post.. and it was really helpful :)

    • gokhankosem / Reply

      You welcome Radio…ipcisco.com is a new website, I hope it will be more helpfull in the following days;)

  • vinayak kamble / Reply

    hi
    i want to configure dhcp on router. how to configure if have more than two switches in the network.
    pl help

  • mehrzad qashqae / Reply

    hi

    thank u for ur post.. and it was really helpful

  • Kiran / Reply

    Hi Gokhan,

    As per this article i am trying to configure DHCP in packet tracer. I am trying to configure “ip helper-address” in interface mode and “ip dhcp-server” in global config mode but none of them is working. I tried these two commands in router as well as in layer 3 switch but failed. My actual intention is to assign ip address from DHCP server to phone and pc where phone is connected to layer 2 switch and pc is connected to the phone. There are two layer 3 switches in between layer 2 switch and DHCP server. Every thing is working fine except this DHCP configuration in layer 3 switch and phones and PCs are not getting ip address. Please help me in this scenario.

    DHCP server–L3 switch–L3 switch–L2 switch—IP phone(DHCP client)–PC(DHCP client)

  • SANJEEV KUMAR / Reply

    Its very helpfull for me.

    thanks

  • Nelsen Marcelino / Reply

    Hey. Please help me to create 3 Lan, 3 Wan . Using 3 switches and as you many as you can PC. Here our IP address 192.170.9.0/26
    ASAP

  • prashant / Reply

    Can i create a user authenticated dhcp server in cisco packet tracer?How?

  • Priya / Reply

    Wow I learnt hw n\w are intersting from ur post

  • cisco kid / Reply

    hi gokhan
    i followed the tutorial you made but suddenly the pc4 wont received an ip address via dhcp but the pc3 has a dhcp ip add ,,, can u help me? thank in advance

  • Amira / Reply

    Thank you for the post… very helpful :)

  • sanjev / Reply

    I have configured DHCP but not able to get ip for the desktop

  • Thiyagu / Reply

    thanks a lot..learning here first about dhcp..

    @sanjev
    It works for me.may be u missed to change static radio button to dhcp.

  • fateme iranpour / Reply

    hi merc
    do u have bgp scenario?
    if u have plz send me.
    thanks

  • Sima / Reply

    Hi Gokhan,
    Thank for your useful posts, i want to request u for a dhcpv6 config tutorial with command explanation.
    Thanks…

  • tata / Reply

    Thank you!!!!!

  • Edem / Reply

    Thanks for the help was able to pass my ccna successfully and to finish my projects as well, unlike most sites you made things simple and straight to the point,thanks.

  • edris / Reply

    hello.I am Iranian
    1.VLAN mode by using the Subnetting Packet tracer software by 300 client?

  • Vincois Slayer / Reply

    Very nice……helps me a lot

  • Ole / Reply

    Made my day! Thanks alot!

  • John Philippe P. Liberato / Reply

    Thank you a lot man! :D

  • Czeth / Reply

    Hey thanks ! this tutorial helped me a lot !

  • Ibnu Mahardhika / Reply

    Its very helpfull for me.

    thanks

  • Cali / Reply

    Thanks, help me a lot.

  • dhananjayan / Reply

    best work keep up the good work

  • revathy / Reply

    hi gokhankosem
    Thank you so much it is very useful

  • Benk / Reply

    hi,
    DHCP request failed
    why?
    between router and switch is not connect :(

  • Salah / Reply

    nice

  • hazel / Reply

    Thank you for the notes. It was helpful. But I have some questions:
    1-Why the RIP and static route config? Is it necessary for DHCP? Because if you just type and give them static IPs, they all the PC can ping each other without the routing config.

    2- Using the configurations you provided, the 10.0.0.0 works fine. But the 192.x.x.x network does not. The hosts are given the gateway 0.0.0.0.
    I am not sure what went wrong.

    I hope you can help. Thank you again.

  • Jamal / Reply

    Nice share. helped me allot .

  • Akil Ansari / Reply

    thanks it’s very help full for me.

  • mohammad / Reply

    hi
    I do that but request failed. please help me in detail
    best regards

  • Jalal Anwar / Reply

    Thanks for the post it really helped me in my CCn class thanks for ur efforts because of you i have got 10 out of 10 in my Assignment Thankyou be Happy as always :) :) :) :) :)

    I am student of Comsats abbottabad Pakistan :) :)

  • Bilal Ahmad / Reply

    Thankyou sir for the great post u did

    actually today one of our teacher give us assignment in Router Dhcp and i have got the idea from your site thankyou …

  • Avinaba Chakraborty / Reply

    it is very helpfull

  • bundara / Reply

    thanks you for your configure dhcp

  • santhosh / Reply

    i want to know full advanced networking can u plz help me

  • Kend / Reply

    hi gokhan , it’s very helpful though i still have one question in my mind , can the dhcp gives ip addresses through multiple routers? As i’m trying to have multiple routers and switches and i want them to be auto assigned with ip address and they can connect to each others

  • Kend / Reply

    and what are the excluded addresses for?

  • Timoteo / Reply

    In wirehark, why am is it recording packets from ip source that are not allocated?

  • satish tiwary / Reply

    I have written so many articles on DHCP configuration in detail.Hope you guys like it.

  • sam / Reply

    thanks very helpful
    but i want save this i am not able to save help me

  • shella / Reply

    thank you dear
    very helpful

  • Pius / Reply

    Its helpful ever seen

  • eangly / Reply

    when i change from static to DHCP it show me “DHCP failed. APIPA is being used””\
    how can i fix it

  • Neelesh Kumar / Reply

    Eangly you will restart your PC and check again.

Leave a Reply