carl_townshend Tue, 06/03/2008 - 02:02

i want to know, that happens when my pc sends a layer 2 broadcast, and a layer 3 broadcast, for both types is the mac address always ff.ff.ff.ff.ff.ff ?

Ryan Carretta Tue, 06/03/2008 - 02:06

Since we're talking about the broadcast in the ethernet header at layer-2, there is no concept of a directed broadcast vs. a standard broadcast, which is distinguished by the layer-3 header. The MAC should be ffff.ffff.ffff in both scenarios.

Ryan Carretta Tue, 06/03/2008 - 10:20

Yes, that's correct. They layer-2 (ethernet header) mac address will always be ffff.ffff.ffff


In the layer-3 (IP header), the IP address for a standard broadcast will be 255.255.255.255. For a directed broadcast, it would use the broadcast address of the subnet (last IP address of the subnet).

carl_townshend Tue, 06/03/2008 - 11:16

i see, so basically for every layer 2 and 3 broadcast, it will always be broadcast at layer 2 no matter what? so if any ip address sent out with dest ip of 255, will my pc tuen this into a layer 2 broadcast ?

Ryan Carretta Tue, 06/03/2008 - 11:31

So for example, if your pc is 192.168.1.2/24, the directed broadcast for this subnet would be 192.168.1.255. A standard broadcast might look like this


dip = 255.255.255.255

sip = 192.168.1.2

dmac = ffff.ffff.ffff

smac = xxxx.xxxx.xxxx


A directed broadcast would look like this:

dip = 192.168.1.255

sip = 192.168.1.2

dmac = ffff.ffff.ffff

smac = xxxx.xxxx.xxxx

michael.leblanc Tue, 06/03/2008 - 12:56

To get all hosts in "your" broadcast domain to process the "frame", you need to use a destination MAC address of "ff:ff:ff:ff:ff:ff".


It is this address that conveys to all NICs that receive it, that it is addressed to them, and that they need to process it (strip off the frame, process the packet within).


A Layer 3 broadcast "within" your network would use an IP address of 255.255.255.255, which you will note is not routable.


A "directed" Layer 3 broadcast needs to be delivered to the destination network, and therefore needs to be routable (e.g.: 192.168.1.255).


A "directed" broadcast sent from your host would need to use the destination MAC address of your first-hop router in order for the router to deliver the broadcast to the destination network.


Presumably, when the directed broadcast is placed on the destination network by a router with a connected interface, the destination MAC address would be "ff:ff:ff:ff:ff:ff", in order to get all the hosts on "that" network to process the frame.



javickas1 Wed, 06/04/2008 - 05:26

For Instance lets look at DHCP.

If your host gets its address etc from DHCP, then when you boot up you will send a frame (layer2) with a destination address of ff:ff:ff:ff:ff:ff, in that frame will be an IP datagram with a destination address of 255.255.255.255 and a source address of 0.0.0.0 (cause you don't have an address yet). The frame will have your nics MAC as its source. This packet (frame and datagram) is a broadcast which "can" be forwarded by your router if it is configured to forward DHCP (which most routers "can" be configured to do). It will use UDP ports 67 and 68 and if you look into the DHCP protocol you'll find your hosts MAC address as well

Actions

This Discussion