3

Given this network

 [DHCP Client]
       |
  (172.16.0.1)
[DHCP Relay Agent]
   (10.1.0.2)
       |
   (10.1.0.1)
 [DHCP Server]

Where the DHCP Server has a pool for 172.16.0.0/16, when the realy-agent relays the client request to the server, the server sends the offer to 172.16.0.1 where I would expect 10.1.0.2.

Is there a specific reason for that? What if the DHCP Server doesn't have any route to the client network?

Tolsadus
  • 1,183
  • 11
  • 23
  • Because that is what the RFC says to do? `If the 'giaddr' field in a DHCP message from a client is non-zero, the server sends any return messages to the 'DHCP server' port on the BOOTP relay agent whose address appears in 'giaddr'.` https://tools.ietf.org/html/rfc2131 – Zoredache Feb 24 '17 at 18:01
  • Yes, I understand that is what the RFC says to do. I'm asking the logic here: why the RFC says so? Why the server does not reply to the unicast address the relay used to send the request? – Giovanni Lovato Feb 24 '17 at 18:03
  • If you send reply to the address the relay used(in your case, 10.1.0.2), the relay don't know which interface to forward the reply. Of coz, in your case, only one relay scope(172.16.0.1), consider if the relay agent is responsible for multiple scopes, you need to find out which interface to forward. So by what, 'GIADDR". – alfred Sep 14 '18 at 02:49

1 Answers1

1

I'm going to answer this 6 years later (nobody else did and the comments don't cover it fully) because I've just given the wrong advice on another question about DHCP relay elsewhere (wrong answer shortly to be deleted), and had to revisit this topic in detail! Part of my searching brought me to this question.

The reason RFC 2131 dictates sending the response to the GIADDR rather than the source address of the request is likely that there can potentially be multiple relays in the path. If the response was simply returned to the last relay before the DHCP server, all the other intermediate relays would have to store state about in-flight requests so that they could look up the correct next-hop at each stage of the return flow. That is inefficient and unnecessary compared to just naturally routing to the GIADDR.

If the server doesn't have a route back to the client, DHCP will fail, especially later on during lease renewal which is generally a unicast operation between the client and the DHCP server (that does not involve relays).

Mintra
  • 561
  • 3
  • 7