6

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?

2
  • 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.
    – Eddie
    Jun 13, 2016 at 1:35
  • 1
    Like 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

2 Answers 2

5

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.

17
  • 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 ?
    – Zephyr
    Dec 11, 2017 at 4:16
  • 2
    Layer-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.
    – Ron Maupin
    Dec 11, 2017 at 4:52
  • 1
    Yes, 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.
    – Ron Maupin
    Dec 11, 2017 at 5:16
  • 1
    @NK-cell, the original IP plan, prior to the public Internet, was that a host on one network would be able to broadcast on a different network. That requirement was changed to default to disabled when it became obvious that there are bad actors who simply want to disrupt another network. It can be useful inside a company. One case I know is to send stock data in near real-time from a service to a different network. Remember that IPv4 is a government/academic experiment that escaped the lab. IPv6 takes lessons learned in IPv4, and it has eliminated broadcast altogether as a bad idea.
    – Ron Maupin
    Aug 9 at 16:59
  • 1
    @NK-cell, "If I'm on the network 192.168.0.0/24 and sending broadcast IPv4-packet to hosts in 10.0.0.0/24" You would be sending a unicast packet to 10.0.0.255 because packets do not contain masks, your host, and anything before the final router, has no idea that it is a broadcast on the destination network. "What if dst IP is 192.168.0.255?" That is the source network, so hosts on that network know it is the broadcast address for that network.
    – Ron Maupin
    Aug 9 at 21:24
3

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.

3
  • 2
    Doesn't DHCP actually use the limited broadcast address (255.255.255.255)?
    – dantebarba
    Dec 16, 2018 at 23:49
  • 1
    This is absolutely wrong answer. Can't downvote because of reputaion.
    – NK-cell
    Aug 9 at 20:59
  • DHCP Discover is made when host even doesn't know something about network. I.e. it doesn't know the network address, netmask and so on. So this packet obviously goes to 255.255.255.255
    – NK-cell
    Aug 9 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.