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 192.168.1.0/24 while that of your company is 10.0.0.0/8). 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.

DHCP_Advantages.jpg

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 255.255.255.255, 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 0.0.0.0 is used. The purpose of DHCPDISCOVER message is to try to find out a DHCP Server (a server that can assign IP addresses).

DHCP_Discover.jpg

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

DHCP_Offer.jpg

(*)Note: In fact, the DHCPOFFER is a layer 3 broadcast message (the IP destination is 255.255.255.255) 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.

DHCP_Request.jpg

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

DHCP_Acknowledgement.jpg

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.

DHCP_Relay_Agent.jpg

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 10.1.1.0 /24 Specifies the subnet and mask of the DHCP address pool
Router(dhcp-config)#default-router 10.1.1.1 Set the default gateway of the DHCP Clients
Router(dhcp-config)#dns-server 10.1.1.1 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(dhcp-config)#exit  
Router(config)# ip dhcp excluded-address 10.1.1.1 10.1.1.10 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 3 4 5 6 2425
  1. Mrs. Confused
    November 8th, 2017

    Hi Guys!
    My exam Ccna R&S 200-125 is on the next month (dec 2017)
    Can anybody share latest dumps with me?
    here is me
    e.gamze.kaya(at)gmail(dot)com

  2. Anonymous
    December 4th, 2017

    Hi Guys,

    exam Ccna R&S 200-125 , Can anybody share latest dumps with me?

    {email not allowed}

  3. Joe
    January 12th, 2018

    Pls guys what percentage do I need to pass the exam

  4. ahmed2018
    January 20th, 2018

    hello guys
    My exam Ccna R&S 200-125 is on the next month (feb 2018)
    Can anybody share latest dumps with me?

  5. Zaks
    January 31st, 2018

    Hi Guys!
    My exam Ccna R&S 200-125 is on the next month feb
    Can anybody share latest dumps with me?
    here is me
    Samaria again gmail.com

  6. Zaks
    January 31st, 2018

    Xakariadabai@ gmail.com

  7. Anino
    February 11th, 2018

    My Ccna exam will be next week

    Kindly please share the latest dumps {email not allowed}

  8. Anino
    February 11th, 2018

    Kindly please share the latest dumps netconn32 (at) gmail that com

  9. Pascal
    February 16th, 2018

    Hi Guys!
    My exam Ccna R&S 200-125 is on this month (February 2018)
    Can anybody share latest dumps with me?
    here is me
    dattepascal(at)yahoo(dot)fr

  10. mike
    March 3rd, 2018

    My exam Ccna R&S 200-125 is this month.Can anybody share latest dumps with me?
    mdoc357 at yahoo

  11. Karthik S
    March 11th, 2018

    Isnt the DHCPACK a broadcast message ? How it will be Unicast as the DHCP server has not learnt about the client IP address .

  12. Anonymous
    May 4th, 2018

    Hi Guys!
    Please can some kindly send me the latest dumps to np597(at)hotmail(dot)com

  13. Wulf Schmidt
    May 12th, 2018

    Karthik. Yeah DHCP message is broadcoast if you connect your hosts to one switch or organise your network within a one vlan. You can configure your network to pass DHCP requests via different subinterfaces, so it becomes not a broadcoast but a unicast message.

  14. Tony
    June 12th, 2018

    Karthik S
    “Isnt the DHCPACK a broadcast message ? How it will be Unicast as the DHCP server has not learnt about the client IP address.”

    The DHCP server doesn’t learn a client’s IP address, the server leases this address to the client. The DHCP Acknowledgement is the last message in the exchange process(already established L2 communication), therefore it is a unicast message.
    It is also the message containing IP address information that is sent to the client. If it was a broadcast it will be received by multiple clients and you can end up with multiple devices having the same IP address.

  15. Donny
    June 21st, 2018

    Passed today, used the 552q dumps.

  16. Rivaldi
    October 19th, 2018

    Hello guys!
    My exam Ccna R&S 200-125 is this month.Can anybody help me to share latest dumps with me?
    you can send to my email rivaldi.fawzi(@)gmail.com

  17. Mukesh
    November 22nd, 2018

    (*)Note: In fact, the DHCPOFFER is a layer 3 broadcast message (the IP destination is 255.255.255.255) 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.

    The above information provided is wrong. plzzz check

  18. andrew Wap
    February 12th, 2019

    my Ccna R&S 200-125 is on april 2019, can someone send me the lates dumps on nntimci(@)gmail.com

  19. Veriz
    May 6th, 2019

    HERE YOU GO. Pass exams easily.
    CCNA EXAM FEE DISCOUNT VOUCHER ALSO AVAILABLE.

    CCNA 200-125
    CCNP ROUTE 300-101
    CCNP SWITCH 300-115
    CCNP TSHOOT 300-135
    CCIE R&S 400-101

    AT BELOW LINK:
    R E M O V E-S P A C E S

    c b . l k / 4 N f J Y

  20. Verizz
    May 6th, 2019

    HERE YOU GO. Pass exams easily.
    CCNA EXAM FEE DISCOUNT VOUCHER ALSO AVAILABLE.

    CCNA 200-125
    CCNP ROUTE 300-101
    CCNP SWITCH 300-115
    CCNP TSHOOT 300-135
    CCIE R&S 400-101

    AT BELOW LINK:
    R E M O V E-S P A C E S

    c b . l k / 4 N f J Y

  21. abdesslem
    May 18th, 2019

    Hi all, am looking for the valid CCNA SP dumps (spngn1&2), pls share where i can get them.thanks
    Jerbi (dot) abdesslem ( at) gmail (dot)com

  22. nickojam
    June 23rd, 2019

    please.. i failed in my first ccna 200-125 exam. Exam fee is difficult in my situation.. I will retake exam soon.. please to whom kind hearted, help me with the latest dumps.. nickojamkoh2914 (at) gmail.com

  23. anonymous
    June 26th, 2019

    Can someone please share the latest CCNA 200-125 dumps at payalm1595 (at) gmail. com.
    Thanks in advance

  24. Macwani
    July 18th, 2019

    Can someone please share with me latest dumps for CCNA 210-260- Implementing Cisco Network Security. Send to my email address {email not allowed}.

  25. Anonymous
    July 22nd, 2019

    hi everyone pls am in dear need of recent dumps for CCNA 210-260 exams is in less than 2 weeks osuntobs (at) gmail , would be extremely happy and gratefull to have this.

  26. Wanjau
    August 1st, 2019

    hi guys, can anyone pls share CCNA 200-125 at wanjaunjagi94(at)gmail.com

  27. Anonymous
    August 2nd, 2019

    Hi everyone just started ccna could anyone help me with the ccna 200-125 cert guide {email not allowed}

  28. Anonymous
    August 14th, 2019

    Hello all,
    Can anyone please send me latest dumps for CCNA RS 200-125 exam at importantinformation at yopmail dot com

  29. Anonymous
    August 16th, 2019

    Hey, can you please send me latest dumps for CCNA 200/125, at clearccna @ yopmail . com

  30. ID
    August 19th, 2019

    Hello Guyz,

    Please i am trying to take CCNA for the first time i wull need a help from anyone with DUMPS and materials to use as guide thanks … my email {email not allowed}

  31. AK
    August 21st, 2019

    Dear 9tut
    how can i contact to you by email or phone, cause i have a problem logging my account, i have paid my monthly subscription can you help ASAP please. I have the exam next week.
    when ever i try to logon is saying
    anyone has 9tut contact email or telephone number pass to me thanks.

  32. AK
    August 21st, 2019

    Dear 9tut
    how can i contact to you by email or phone, cause i have a problem logging my account, i have paid my monthly subscription can you help ASAP please. I have the exam next week.
    when ever i try to logon is saying
    anyone has 9tut contact email or telephone number pass to me thanks.

    i urgently need my account to active please send the contact email or phone number.
    thanks

  33. Anonymous
    August 21st, 2019

    Dear 9tut
    how can i contact to you by email or phone, cause i have a problem logging my account, i have paid my monthly subscription can you help ASAP please. I have the exam next week.
    when ever i try to logon is saying
    anyone has 9tut contact email or telephone number pass to me thanks.

    i urgently need my account to active please send the contact email or phone number.
    and how can i contact website administrator?

  34. 9tut
    August 21st, 2019

    @Anonymous: If your problem still exists, please send an email to support@9tut.com with your username or Invoice ID so that we can help you.

  35. Anonymous
    August 25th, 2019

    Hello All!

    Please help by sharing the latest 200-125 CCNA dump with me! gwy0215 @ G M A I L

    Thanks!

  36. Good Luck..
    August 26th, 2019

    Yall need to try and get the CCNA before February 2020

    http:// http://www.mediafire.com /file/l9hw0l30u1krtm1 /CCNA-200-125-DUMP-2019.rar/ file

  37. cobran89
    August 27th, 2019

    Hi ,
    Can anyone please send me latest dumps for CCNA RS 200-125 or any important information. Or tell me where to find help

  38. help with latest 200-125
    August 29th, 2019

    hello
    please help with the latest 200-125 dump
    please send to seeyram at gmail if possible

    thanks a lot

  39. 200-301
    September 6th, 2019

    Hello,
    What will happen with this certification, you will implement the new ccna certification

  40. Vince
    September 15th, 2019

    Please help and send me latest 200-125 dump
    vm.glspci@gm*ail*com

  41. Anonymous
    September 18th, 2019

    Is Passleader good for exam 210-060 CICD?

  42. Anonymous
    September 23rd, 2019

    Latest dumps please. My exam is very close.
    walewalex44@gm*a*il.com

  43. Amin
    September 27th, 2019

    Hi Ebrahem

    can you send me the latest Dump for CCNA?

    thank you so much

    amin.moghim at live.com

  44. jana
    October 5th, 2019

    stop asking for dumps like morons, people posted links to them. gosh, learn english

  45. maoca
    October 7th, 2019

    Kindly would anyone send me 200-125 test dumps to mariolopznet at hotmail.com? thank you in advance.

  46. Moon
    October 9th, 2019

    Please send latest 200-125 dumps to MoonBlood1433 at gmail thank you in advance.

  47. Luis
    October 9th, 2019

    Please send latest 200-125 dumps to ledd64 at gmail thank you

  48. Anonymous
    October 13th, 2019

    pls i took the the CCNS RS 200-125 on 12 OCtober 2019 and failed 692/810. i just discovered this site and i can see lab sim from the exam here. pls ayone should send latest dump for the exam for me (greyhatnaija @ gmail . com) . my retake is 18 Oct 19.

    thank you very much

  49. Gracia Fatima
    October 14th, 2019

    Can anyone please send me latest dumps for CCNA RS 200-125 or any important information. please ( gracinhafatima91 @ gmail.com )

  50. Eugene Loweh
    October 21st, 2019

    Please can someone help me with latest dumps for CCNA routing and switching. I am doing recertification. Please will be glad to receive help – {email not allowed}

Comment pages
1 3 4 5 6 2425
Add a Comment