As far as I know, both MAC and IP broadcast addresses are used to send a packet to all hosts that are connected to a local area network. Why would anyone need two addresses to send a broadcast package?
At its core, this question is about the difference between a Layer 2 address and a Layer 3 address. To that end, I would point you to this Q&A, and this section of an article discussing the individual roles of each layer. Essentially, the IP Broadcast address determines where the packet goes, and the MAC Broadcast address actually gets it there.– EddieJun 13, 2016 at 1:35
1Like the others have mentioned, it comes down to the layers each work in. Yes they both send packets to all hosts but sometimes you need one and not the other. One example is ARP. When you don't know the MAC address for the device, you send a layer 2 broadcast. But the layer 3 address remains unicast. So it comes down to where each is used. A broadcast on layer 3 may use a multicast on layer 2 as well.– Izy-Jun 13, 2016 at 4:57
Remember, IPv4 is not the only layer-3 protocol. Traffic on a LAN is delivered by a layer-2 protocol, so layer-2 protocols need a broadcast address to be able to deliver a broadcast to all hosts on a LAN. Layer-2 protocols can carry any number of layer-3 protocols.
An IPv4 host will drop layer-3 traffic delivered to it that is not destined to its IPv4 address, a subscribed IPv4 multicast address, or an IPv4 broadcast address, even if it is delivered via a layer-2 broadcast frame.
IPv4 has two different broadcasts: the limited broadcast (
255.255.255.255), and the network broadcast (highest IPv4 address in the network). The limited broadcast cannot leave the network on which it originated. The network broadcast used to be enabled on network equipment, e.g. routers, by default, but it is now disabled by default. It allows traffic from one network to be sent to a different network's broadcast address, in order to broadcast to all IPv4 hosts on the other network.
IPv6 has done away with broadcast altogether. You must use multicast.
What is difference between limited broadcast (255.255.255.255) address and MAC broadcast (FF:FF:FF:FF:FF:FF) address? Both broadcast the packets within the same network right ?– ZephyrDec 11, 2017 at 4:16
That is comparing apples and oranges. Those are at different network layers.Layer-3 packets are encapsulated in layer-2 frames fro delivery from host to host. Some layer-2 protocols (IEEE LAN protocols) use MAC, and thus have MAC addresses. The layer-2 addressing on the frames is different than the layer-3 addressing on the packets, just as the layer-3 addressing on the packets is different than the layer-4 addressing on the transport datagrams. Dec 11, 2017 at 4:23
But the function of both the addresses is to transfer the packets to all the devices within the local network right (this looks entirely same to me)?– ZephyrDec 11, 2017 at 4:28
2Layer-2 addresses deliver frames on the local network. A frame with a broadcast address is delivered to all the hosts on the LAN. It doesn't matter what the layer-3 address is. When layer-2 sends the packet up to layer-3, then layer-3 will inspect the layer-3 address. If it not addressed to the layer-3 address or the layer-3 broadcast address, then layer-3 will drop it. If the layer-3 packet is addressed as broadcast, but the layer-2 frame is not, it doesen't get delivered to every host. Dec 11, 2017 at 4:52
1Yes, but in reality, the sending host only knows that the destination layer-3 address is not on its network. It has no idea what the network mask of the other network is, so it doesn't know it is trying to broadcast to the other network. Dec 11, 2017 at 5:16
You use it both every time you send an IP broadcast message. For example a broadcast message lets say looking for a DHCP server in network 192.168.0.0/24 the broadcast address would be 192.168.0.255 and by sending it to that address you also need to send it to the FF:FF:FF:FF:FF:FF in order to find all the ip addresses in that range. if you do not already have communication with any of the hosts in the network range.
1Doesn't DHCP actually use the limited broadcast address (255.255.255.255)? Dec 16, 2018 at 23:49