3

If a router is connected to a switch via LAN to LAN connection, then the router will be the DHCP server.

Now, the question is, if two routers are connected to a switch via LAN-LAN, then which DHCP will work??

  • 2
    This can be set up to work reasonably (where you divide up the address space and the DHCP servers only hand out their part of the address space to those things that "hear them first") but it's prone to confusion (on the wetware side of things) and generally simpler to just have one DHCP server for that reason. – Ecnerwal Aug 9 '15 at 13:44
  • U told that DORA is broadcast but i have a little confusion that how can DHCP ACK & Offer be a Broadcast, they are specifically sent to Client. So shouldn't it be unicast. correct me if i m wrong – Narender Banduni Aug 10 '15 at 3:49
  • @NarenderBanduni How could it be unicast if the Client doesn't yet have an IP to send a unicast packet TO (i.e. the DHCP transaction is not complete and acknowledged) – Brett Lykins Aug 10 '15 at 18:17
  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer. – Ron Maupin Aug 7 '17 at 18:57
10

DHCP (Dynamic Host Configuration Protocol) utilizes four key steps as illustrated below:

  1. DHCP Discovery (DHCPDISCOVER) - Sent by the Client seeking a DHCP Server.
  2. DHCP Offer (DHCPOFFER) - Sent by the DHCP Server to offer an address (and other DHCP options) to the Client.
  3. DHCP Request (DHCPREQUEST) - Sent by the Client to accept the lease for the offered address.
  4. DHCP Acknowledgement (DHCPACK) - Sent by the Server to acknowledge that the Client now has the lease for that address.

Diagram of these transactions:

Client            DHCP Server
  |                    |
  |  DHCPDISCOVER ---> |
  |                    |
  |    <--- DHCPOFFER  |
  |                    |
  |  DHCPREQUEST --->  |
  |                    |
  |      <--- DHCPACK  |
  |                    |
  \/                   \/

Each of these messages is a broadcast packet, sent to a destination of 255.255.255.255. Meaning this will go to all hosts on a particular L2 segment. (By default DHCP is a broadcast centric technology, however you can use DHCP Relay features to cross L3 boundaries.)

Also note that DHCP uses UDP ports 67 for the DHCP Server and 68 for the Client.


Now, for your answer:

When there are two (or more) DHCP servers accessible from a particular L2 segment, it becomes a race condition.

The Client issues a broadcast DHCPDISCOVER and then waits. Both DHCP Servers receive the message and broadcast DHCPOFFER replies.

Whichever DHCP Server's DHCPOFFER packet is received first by the Client will "win", and that Server will receive a DHCPREQUEST from the Client. This can actually cause a Denial of Service condition depending on the circumstances.

In a past job, I worked in the NOC of a regional ISP. We utilized a particular brand of DSLAM which had a software bug that caused it to not filter DHCP messages coming from the customers.

This meant that anytime a customer plugged their home router in backwards (LAN port to the DSL Modem, instead of WAN port to the DSL Modem), they began to issue DHCPOFFERs to every router attached to a modem on that DSLAM.

Because this new Rouge DHCP Server was significantly closer to the customers than the actual DHCP server, it won the race every time. This caused a cascading outage as DHCP leases expired on routers on that DSLAM, and they acquired private addresses from the Rouge DHCP Server.

  • 1
    Interesting case-study about the DHCP DOS at the ISP. I am curious to know about the rest of that story; was the software issue resolved? – Yosef Gunsburg Aug 9 '15 at 6:47
  • 1
    I believe it was, however there were so many other issues with the box that we stopped using them pretty quickly. The manufacturer was bought out a few years later too, so no one has to suffer from a Pannaway BAS anymore... :) – Brett Lykins Aug 10 '15 at 0:58
0

As said already - the fastest one. We did a case for a customer who wanted to have static addresses for hosts, but with dynamic provisioning. We installed two FreeBSD boxes with DHCP server on two different server rooms which received configuration from customers frontend application upon change and included them into isc dhcpd. Both servers had the same config just to insure everything would work in case of failure of one server, server room or something else. It was funny observing how one box was way faster than the other one. Both received DHCPDISCOVER messages and both tried to respond, but one was fastest.

This worked for more than 2 years if I remember correctly.

  • On the switch u need to configure dhcp snooping. – Gngogh Sep 8 '15 at 20:38
  • When you need more security, yes. – Tomaž Nov 21 '15 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.