How does DHCP client knows that DHCP acknowledgement is intended to it?

Started by networkloser, February 06, 2024, 02:15:09 AM

Previous topic - Next topic

networkloser

Let's discuss the "DORA" of DHCP.

1) Discover
Client broadcasts that "I want IP address".
Destination IP address=All 0s.
Destination hardware address=All Fs.
Source hardware address=DHCP Client address

2) Offer

Server/s makes an offer.
Destination hardware address=client's mac address
So that client knows the offer is for it.
It also should contain server's IP address/es.

3) Request

Client broadcasts DHCP request packet.

This includes,
DHCP Server's IP address so that other can cool down their IP address so client gets from who it wants.
Client's hardware address so that client hardware->IP address mapping can be done.
Destination address is All Fs, so that all hosts receive the notification.

4) Acknowledgement.

I am following TCP/IP foundations by Black and I'm confused how will the client know that the acknowledgement came for it?

deanwebb

The network device that the client is attached to handles the DHCP request. The request is bound to a MAC address, so the network device makes sure that the request gets back to the device with that MAC address. In the case of multiple DHCP servers, the first to respond will be the one the client goes with.
Take a baseball bat and trash all the routers, shout out "IT'S A NETWORK PROBLEM NOW, SUCKERS!" and then peel out of the parking lot in your Ferrari.
"The world could perish if people only worked on things that were easy to handle." -- Vladimir Savchenko
Вопросы есть? Вопросов нет! | BCEB: Belkin Certified Expert Baffler | "Plan B is Plan A with an element of panic." -- John Clarke
Accounting is architecture, remember that!
Air gaps are high-latency Internet connections.

networkloser

The next screen capture shows the Ethernet portion of the DHCP ack packet.
The Ethernet destination address is FFFFFFFFFFFF, which is the broadcast hard-
ware address, and the Ethernet source address is 005004744FFF, which is the
hardware address of the DHCP server

The DHCP portion of the DHCP ack packet contains information about the IP
address and the lease parameters. The following screen capture shows the DHCP
portion with all the DHCP options. After the DHCP client receives this acknowledg-
ment, then the client has an IP address. Now that the client has a valid lease on an
IP address, the client finishes building its TCP/IP stack.


Taken from TCP/IP foundations by andrew G blank

Otanx

Not sure why your book says it is a broadcast. The ACK is a Unicast back to the client. However, even if it is a broadcast the DHCP packet contains the Client MAC address. See the Wireshark Wiki here: https://wiki.wireshark.org/DHCP

The first capture file on that page has a basic DHCP session. You can see the Discover and Request are both broadcasts. However, the Offer and Ack are both Unicast.

-Otanx

config t

Quote from: deanwebb on February 06, 2024, 09:39:19 AMThe network device that the client is attached to handles the DHCP request. The request is bound to a MAC address, so the network device makes sure that the request gets back to the device with that MAC address. In the case of multiple DHCP servers, the first to respond will be the one the client goes with.

To add to this; The network device handling the DHCP request, usually a switch, is the DHCP-Relay. It sends the layer 2 broadcast frames encapsulated as unicast UDP packets to the configured DHCP server(s). On a Cisco switch these are the "ip-helper" addresses configured on SVI.

DHCP service can also be configured locally on a device such as a router or L3 switch. We do this in cases where remote sites only have access to DHCP servers across unreliable or very low bandwidth WAN links that make UDP communication difficult.
:matrix:

Please don't mistake my experience for intelligence.