Home > DHCP Tutorial

DHCP Tutorial

June 18th, 2015 Go to comments

In IP environment, before a computer can communicate to another one, they need to have their own IP addresses. There are two ways of configuring an IP address on a device:
+ Statically assign an IP address. This means we manually type an IP address for this computer
+ Use a protocol so that the computer can obtain its IP address automatically (dynamically). The most popular protocol nowadays to do this task is called Dynamic Host Configuration Protocol (DHCP) and we will learn about it in this tutorial.

A big advantage of using DHCP is the ability to join a network without knowing detail about it. For example you go to a coffee shop, with DHCP enabled on your computer, you can go online without doing anything. Next day you go online at your school and you don’t have to configure anything either even though the networks of the coffee shop and your school are different (for example, the network of the coffee shop is while that of your company is Really nice, right? Without DHCP, you have to ask someone who knows about the networks at your location then manually choosing an IP address in that range. In bad situation, your chosen IP can be same as someone else who is also using that network and an address conflict may occur. So how can DHCP obtain an suitable IP address for you automatically? Let’s find out.


How DHCP works

1. When a client boots up for the first time (or try to join a new network), it needs to obtain an IP address to communicate. So it first transmits a DHCPDISCOVER message on its local subnet. Because the client has no way of knowing the subnet to which it belongs, the DHCPDISCOVER is an all-subnets broadcast (destination IP address of, which is a layer 3 broadcast address) and a destination MAC address of FF-FF-FF-FF-FF-FF (which is a layer 2 broadcast address). The client does not have a configured IP address, so the source IP address of is used. The purpose of DHCPDISCOVER message is to try to find out a DHCP Server (a server that can assign IP addresses).


2. After receiving the discover message, the DHCP Server will dynamically pick up an unassigned IP address from its IP pool and broadcast a DHCPOFFER message to the client(*). DHCPOFFER message could contain other information such as subnet mask, default gateway, IP address lease time, and domain name server (DNS).


(*)Note: In fact, the DHCPOFFER is a layer 3 broadcast message (the IP destination is but a layer 2 unicast message (the MAC destination is the MAC of the DHCP Client, not FF-FF-FF-FF-FF-FF). So in some books they may say it is a broadcast or unicast message.

3. If the client accepts the offer, it then broadcasts a DHCPREQUEST message saying it will take this IP address. It is called request message because the client might deny the offer by requesting another IP address. Notice that DHCPREQUEST message is still a broadcast message because the DHCP client has still not received an acknowledged IP. Also a DHCP Client can receive DHCPOFFER messages from other DHCP Servers so sending broadcast DHCPREQUEST message is also a way to inform other offers have been rejected.


4. When the DHCP Server receives the DHCPREQUEST message from the client, the DHCP Server accepts the request by sending the client a unicast DHCPACKNOWLEDGEMENT message (DHCPACK).


In conclusion there are four messages sent between the DHCP Client and DHCP Server: DHCPDISCOVER, DHCPOFFER, DHCPREQUEST and DHCPACKNOWLEDGEMENT. This process are often abbreviated as DORA (for Discover, Offer, Request, Acknowledgement).

After receiving DHCPACKNOWLEDGEMENT, the IP address is leased to the DHCP Client. A client will usually keep the same address by periodically contacting the DHCP server to renew the lease before the lease expires.

If the DHCP Server is not on the same subnet with the DHCP Client, we need to configure the router on the DHCP client side to act as a DHCP Relay Agent so that it can forward DHCP messages between the DHCP Client & DHCP Server. To make a router a DHCP Relay Agent, simply put the “ip helper-address <IP-address-of-DHCP-Server>” command under the interface that receives the DHCP messages from the DHCP Client.


As we know, router does not forward broadcast packets (it drops them instead) so DHCP messages like DHCPDISCOVER message will be dropped. But with the “ip helper-address …” command, the router will accept that broadcast message and cover it into a unicast packet and forward it to the DHCP Server. The destination IP address of the unicast packet is taken from the “ip helper-address …” command.

When a DHCP address conflict occurs

During the IP assignment process, the DHCP Server uses ping to test the availability of an IP before issuing it to the client. If no one replies then the DHCP Server believes that IP has not been allocated and it can safely assign that IP to a client. If someone answers the ping, the DHCP Server records a conflict, the address is then removed from the DHCP pool and it will not be assigned to a client until the administrator resolves the conflict manually.

Configure a DHCP Server on Cisco router

Instead of using a separate computer/server as a DHCP Server, we can save the cost and configure a Cisco router (even a Layer 3 Cisco switch) to work as a DHCP Server. The following example configuration will complete this task:

Configuration Description
Router(config)#ip dhcp pool CLIENTS Create a DHCP Pool named CLIENTS
Router(dhcp-config)#network /24 Specifies the subnet and mask of the DHCP address pool
Router(dhcp-config)#default-router Set the default gateway of the DHCP Clients
Router(dhcp-config)#dns-server Configure a Domain Name Server (DNS)
Router(dhcp-config)#domain-name 9tut.com Configure a domain-name
Router(dhcp-config)#lease 0 12 Duration of the lease (the time during which a client computer can use an assigned IP address). The syntax is “lease {days[hours] [minutes] | infinite}”. In this case the lease is 12 hours. The default is a one-day lease.
Before the lease expires, the client typically needs to renew its address lease assignment with the server
Router(config)# ip dhcp excluded-address The IP range that a DHCP Server should not assign to DHCP Clients. Notice this command is configured under global configuration mode
Comments (50) Comments
Comment pages
  1. dexter
    August 16th, 2016

    Done with exam today scored 980/1000.Exam was easy Acl(mod3),EIGRP,OSPF were same.If u need latest dump V26 knock me.(menon_007(@)yahoodotcom.
    All the best

  2. dexter
    August 16th, 2016

    Done with exam today scored 980/1000.Exam was easy Acl(mod3),EIGRP,OSPF were same.If u need latest dump V26 knock me menon_007(@)yahoodotcom.
    All the best

  3. Vicky
    September 18th, 2016


    Can you please send me the latest Dumps please at waq.ahmed01 (at) gmail.com

  4. Dexter
    September 27th, 2016

    Can you please send me the latest Dumps please at {email not allowed}

  5. Anonymous
    November 17th, 2016

    i not understand dhcp to range explain

  6. ALI
    December 2nd, 2016

    this command is to reserve these IP addresses. These address you can use for devices like server , router or switch.
    This command says do not use these address other than that you can use all address to give to devices when they ask for IP address

    Hope this help

  7. Anonymous
    December 6th, 2016

    Please help with the latest dump files ronopatrick @ rocket mail dot com

  8. Anonymous
    December 21st, 2016

    Can you please send me the latest dumps? email to {email not allowed}

  9. bravesword
    January 6th, 2017

    Hi Dexter,

    Well done.
    Can you please send me the latest dumps as well?
    My email: {email not allowed}

  10. Joe
    January 10th, 2017

    Hi Dexter

    Please can you send me the latest dumps to {email not allowed}

    Thanks in anticipation!

  11. Joe
    January 10th, 2017

    Hi Dexter
    Please can you send me the latest dumps to nnamdij25 @ yahoo dot com
    Thanks in anticipation!

  12. Fahad
    February 2nd, 2017

    Hi Dexter,
    Can you please send me the latest dumps? My email: {{email not allowed}}

  13. Fahad
    February 2nd, 2017

    Hi Dexter,
    Can you please send me the latest dumps? {email not allowed}

  14. xup
    February 3rd, 2017

    Hello, i see in your configuration of DHCP you put the same ip address to default gateway and the dns-server. Should not they be different?

  15. Jawad
    February 26th, 2017

    Can anyone send me the lates ccnav3 dumps at {email not allowed}. Thanks in Advance!

  16. Jawad
    February 26th, 2017

    Can anyone send me the latest ccnav3 dumps at jawad_023 @ yahoo dot com? Thanks in Advance!

  17. foe
    March 6th, 2017

    please any one have latest dumps send me at lebamnegn at gmail dot com. Thanks in Advance!

  18. Abe
    March 9th, 2017

    Good explain
    So many thanks

  19. Abe
    March 9th, 2017

    Hi All,
    Some body have file update of CCNA 200-125 for me?

  20. CardoTuazon
    March 17th, 2017

    Please Send Me the latest ccna 200-125 file. i want to take the exam. thanks you very much in advance.

  21. CardoTuazon
    March 17th, 2017

    Here is my Email: cardotuazon 26 @ gmail dot com

  22. umair
    March 21st, 2017

    also please send me latest ccna 200-125 at
    umair512 (at) gmail.com

  23. hugh
    March 24th, 2017

    Hello! everyone I’m about to take the ccna 200-125. Please can anyone Send Me the latest ccna 200-125 file.Thanks you very much in advance.

  24. Anonymous
    April 9th, 2017

    Hi, pliz can anyone send me latest dumps email is kiprop4 at gmail dot com

  25. haluc
    April 11th, 2017

    can someone send me the latest dumps filonfisteku2017 at gmail dot com

    Thank you

  26. Talisha Withy
    April 15th, 2017

    That is the best search engine in the planet


  27. Ranga
    April 16th, 2017

    can someone send me the latest dumps {email not allowed}

    Thank you

  28. Ranga
    April 16th, 2017

    can someone send me the latest dumps gphrdesilva at gmail dot com

    Thank you

  29. Tyson Fineout
    April 19th, 2017

    Excellent article. I surely appreciate this site . Keep it up!


  30. Kent Mcquigg
    April 19th, 2017

    Awesomely done article piece. I definitely love this site . Continue the good work!


  31. henry007
    May 13th, 2017

    please dexter send me the latest dump. okekeifeanyi1808 @ gmail dot com

  32. celine
    May 31st, 2017

    Hello Brothers and Sisters!
    I beg Anyone here who has exams all correct Q&A of ccna exam 200-125,
    kindly give me here a link to find it. thank you in advance and God bless u mch.

  33. Anonymous
    June 12th, 2017

    Pls send me the latest dumps on {email not allowed}, thanks and God bless u as u send me

  34. grey
    July 14th, 2017

    hello, kindly send me the latest dumps on my email {email not allowed} thanks in advance. anyone please

  35. grey
    July 14th, 2017

    hello, kindly send me the latest dumps on my email hairgrey95 at gmail dot com thanks in advance. anyone please

  36. dean
    July 14th, 2017

    pls anyone who has latest Q&A 200-125 kindly mail me on zvacudecu hotmail thanks and God bless u

  37. Ruf
    July 23rd, 2017

    Need the latest dump please {email not allowed}

  38. Ruf
    July 23rd, 2017

    At rfiossi at Yahoo dart fr

  39. Anonymous
    August 2nd, 2017

    {email not allowed}

  40. Kapatid
    August 6th, 2017

    can you send me the latest dumps of Aug 2017 my email is mark.besa02 @ gmail.com

  41. Anonymous
    August 8th, 2017

    very very useful thanks 9tut, you’re the best

  42. Nahro Asiacell
    August 8th, 2017

    very very useful thanks 9tut, you’re the best

  43. Anonymous
    August 10th, 2017

    Please, I need the latest dumps as am preparing to take the exam soon. Thanks.
    {email not allowed}

  44. patel
    September 9th, 2017

    hello i have a ccna switching and routinmg next week anyone with latest dumps email at patrickngare @ gmail dot com

  45. Anonymous
    September 13th, 2017

    Hi! If anyone have a latest version of ccna dump please send me willon95@gmail(dot)com

  46. Akins
    September 26th, 2017

    pls anyone wif d latest dump shld pls hlp me out wif it — {email not allowed}

  47. Dumpsforsure
    September 27th, 2017
  48. Anonymous
    November 2nd, 2017

    thanks for sharing this article.
    Dexter can you please send latest dumb to oladunjoyeebenatgmaildotcom

  49. Anonymous
    November 3rd, 2017

    hello admin team
    i have paid amount but still not able to access all features can you check and do the needfull..

  50. KT
    November 8th, 2017

    Hi can someone send me the lates dumps for CCNP. please. kimdctorres @ gmail . com thank you!

Comment pages
Add a Comment