Networking-Forums.com

Education => Homework Help => Topic started by: networkloser on February 06, 2024, 02:15:09 AM

Title: How does DHCP client knows that DHCP acknowledgement is intended to it?
Post by: networkloser on February 06, 2024, 02:15:09 AM
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?
Title: Re: How does DHCP client knows that DHCP acknowledgement is intended to it?
Post by: deanwebb on February 06, 2024, 09:39:19 AM
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.
Title: Re: How does DHCP client knows that DHCP acknowledgement is intended to it?
Post by: networkloser on February 06, 2024, 10:55:57 AM
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
Title: Re: How does DHCP client knows that DHCP acknowledgement is intended to it?
Post by: Otanx on February 06, 2024, 02:26:57 PM
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
Title: Re: How does DHCP client knows that DHCP acknowledgement is intended to it?
Post by: config t on February 06, 2024, 09:32:42 PM
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.