07-17-2018 04:53 PM
I understand why the DHCP client uses a broadcase for the DHCP Discover and the DHCP Request, but why would the relay agent use it for the DHCP Offer and DHCP Ack. Why does not it use a Layer2 unicast for transmitting the offer and acknowledgment instead.
I know you can set up the relay agent to use a L2 unicast for the offer and acknowledgment messages, but why is the L2 broadcast the default?
Solved! Go to Solution.
07-18-2018 07:39 AM
In an ideal scenario (by default), if the “Broadcast Flag” field of the DHCP Offer message sent by a DHCP server is 0 (zero), the DHCP relay agent replaces the value in the Destination MAC address field with the PC MAC address (Client MAC), and unicasts the message. However, if the “Broadcast Flag” value is 1 (one), the relay agent replaces it with the broadcast MAC address (FF:FF:FF:FF:FF:FF), and broadcasts the message.
Regarding how the Broadcast Flag is set on the DHCP message from the DHCP server, I have included below an excerpt from the DHCP RFC 2131 that explains this best:
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'. If the 'giaddr' field is zero and the 'ciaddr' field is nonzero, then the server unicasts DHCPOFFER and DHCPACK messages to the address in 'ciaddr'. If 'giaddr' is zero and 'ciaddr' is zero, and the broadcast bit is set, then the server broadcasts DHCPOFFER and DHCPACK messages to 0xffffffff. If the broadcast bit is not set and 'giaddr' is zero and 'ciaddr' is zero, then the server unicasts DHCPOFFER and DHCPACK messages to the client's hardware address and 'yiaddr' address. In all cases, when 'giaddr' is zero, the server broadcasts any DHCPNAK messages to 0xffffffff.
Hope this helps.