It is normally unicast to the he address of the pc and the IP address that is to be offered. I say normally because there are exceptions. You can easily see this in wireshark. For more detail see page 24 in the following URL.
In the DHCP discover there is a flag called the broadcast bit that the client uses to tell the server how he would like the offer to be: broadcast if it is on or unicast if it is off but the server makes the final decision based on its capability.
Cisco routers when acting as dhcp clients have this broadcast bit turned off by default and so the dhcp offer from a Cisco router is unicasted.
Thanks for the reply....
How can it be a unicast if dhcp server dont have destination ip add., because client is not having any valid ip till.
How client set the brodcast bit means what are the criteria, because when i choose a Router to act as a dhcp server then the DHCPOFFER became unicast and when i use Multilayer switch then DHCPOFFER became broadcast.
Thanks for the link.
After reading all the conversation in the given link which is related to the same question, It is cleared that DHCPOFFER is a broadcast not a unicast unless DHCP server is behind a Layer 3 device.
- The client sends DHCPDiscover. It is broadcast both in Layer 2 and Layer 3.
- The server replies with DHCPOffer. It's broadcast in Layer 3 but unicast in Layer 2.
- The client replies with DHCPRequest. It's broadcast in both Layers 2/3.
- The server sends DHCPAck. It's broadcast in Layer 3 but unicast in Layer 2.
As you see, at Layer 3 all communication is broadcast. This makes sense as the client does not have an IP address. However, what many people overlook is both client and server have Layer 2 (i.e. MAC) addresses, so unicast communication is possible at Layer 2.
At Layer 2, the client's messages are always broadcast, and those of the server's can be unicast or broadcast depending on how vendor implemented it.
Sanjay Singh wrote:
Can someone help me out to understand DHCP address asginment process, and in which case "DHCPOFFER" message from DHCP to DHCP Client is unicast or broadcast?
Between a DHCP client and server in the same VLAN, without an IP helper option, it will be purely broadcast, as shown in the graphic.
in global config on a cisco router if you issue no ip dhcp-client broadcast-flag then the server will unicast the offer and the ack and if you leave the default then it will broadcast them.
in point 4 you said L3 broadcast and L2 unicast, I don't agree if you broadcast at layer 3 it must be broadcast at layer 2.
I attached a wireshark capture file taken on a GNS3 proof of concept lab with 2 routers back to back one being a host and dhcp client and the other a dhcp server.first I left default then I toggled broadcast bit with the above global config command and you can see the behavior is different.
dhcpoffer.pcap.zip 572 bytes
It can be unicast without a dhcp-relay as I explained before, it all depends on default behavior of client regarding broadcast bit value..
taken from rfc 2131:
In the case of a client using DHCP for initial configuration (before
the client's TCP/IP software has been completely configured), DHCP
requires creative use of the client's TCP/IP software and liberal
interpretation of RFC 1122. The TCP/IP software SHOULD accept and
forward to the IP layer any IP packets delivered to the client's
hardware address before the IP address is configured; DHCP servers
and BOOTP relay agents may not be able to deliver DHCP messages to
clients that cannot accept hardware unicast datagrams before the
TCP/IP software is configured.
To work around some clients that cannot accept IP unicast datagrams
before the TCP/IP software is configured as discussed in the previous
paragraph, DHCP uses the 'flags' field . The leftmost bit is
defined as the BROADCAST (B) flag. The semantics of this flag are
discussed in section 4.1 of this document. The remaining bits of the
flags field are reserved for future use. They MUST be set to zero by
clients and ignored by servers and relay agents. Figure 2 gives the
format of the 'flags' field.
Vista seems to request that the DHCP Offer be sent to a broadcast address. The image below is an XP SP3 example. It is a full discover, offer, request, acknowledge. Client and DHCP server are on the same subnet. The offer is sent to the appropriate mac address and the proposed IP address. See below--