28

We're trying to debug some applications performing broadcast.

What is the difference between the broadcast address 255.255.255.255 and as e.g. reported by ifconfig, Bcast:192.168.1.255

1

4 Answers 4

49

A broadcast address is always relative to a given network, there is no broadcast per se; when you have a network, you can compute its broadcast address by replacing all the host bits with 1s; simply put, the broadcast address is the highest numbered address you can have on the network, while the network address is the lowest one (with all host bits set to 0s); this is why you can't use either of them as actual host addresses: they are reserved for this use.

If your network is 192.168.1.0/24, then your network address will be 192.168.1.0 and your broadcast address will be 192.168.1.255.

If your network is 192.168.0.0/16, then your network address will be 192.168.0.0 and your broadcast address will be 192.168.255.255.

And so on...

255.255.255.255 is a special broadcast address, which means "this network": it lets you send a broadcast packet to the network you're connected to, without actually caring about its address; in this, is similar to 127.0.0.1, which is a virtual address meaning "local host".

More info here: http://en.wikipedia.org/wiki/Broadcast_address

3
  • Is 127.0.0.1 considered a "virtual address"? My understanding is that it's a real address and the RFC says it should point to the virtual loopback interface. However, I've seen instances where a device actually queries my DNS server for 127.0.0.1. Jan 7, 2011 at 18:00
  • 1
    Maybe my use of the word "virtual" was a bit of an oversimplification, but that is indeed a reserved address which can't belong to any physical interface and should never be seen outside an host; if something is asking your DNS server who 127.0.0.1 is, it should run as fast as it can to the nearest IP classroom :-p
    – Massimo
    Jan 7, 2011 at 19:06
  • 3
    "it lets you send a broadcast packet to the network you're connected to" ...what if you are connected to multiple networks? Are broadcast packets sent to all of them? May 26, 2015 at 4:54
15

To add to what Massimo has stated in his answer:

255.255.255.255 would be considered the phsyical layer broadcast address while 192.168.1.255 would be considered the network layer broadcast address. ARP would generate a physical layer broadcast, while NetBIOS would generate a network layer broadcast.

1
  • Do you mean something along the lines of "the equivalent of a layer-2 (link layer) broadcast address i.e., FF FF FF FF FF FF. A broadcast address of 255.255.255.255 is typically used when information about the broadcast of IP addresses i.e. layer-3 (network layer) are unknown".. "instead of physical layer broadcast"?
    – dr.doom
    Nov 1, 2021 at 22:37
13

In principle, 255.255.255.255 is the "global" broadcast address, which means that the IP stack is supposed to send the packet to all network interfaces, and routers that are configured to forward broadcasts are supposed to send them on.

In practice, there are almost no routers forwarding broadcasts, and a lot of stacks simply send one copy of the packet to the interface where the default route points to.

The subnet broadcast address is used to select a specific interface. In both cases, these should be mapped to the network layer broadcast address (which would be FF:FF:FF:FF:FF:FF for Ethernet).

In general, using 255.255.255.255 is a bad idea, as there are several setups where the interface with the default route is exactly the wrong choice. Selecting an interface explicitly is better, but needs to be done carefully.

My other suggestion would be to use multicast, if that makes sense for your application. The same caveats as for broadcast traffic still apply, but this allows uninterested hosts to quickly identify your packets, and it allows network managers to set up specific forwarding rules for your protocol.

1
  • 4
    When I search for 255.255.255.255 one of the first results which comes up is RFC 919. In that RFC I found this sentence: "The address 255.255.255.255 denotes a broadcast on a local hardware network, which must not be forwarded." (emphasis mine) So when you suggest routers might be configured to forward the packets, then that's not very likely.
    – kasperd
    Nov 17, 2018 at 12:25
5

255.255.255.255 and 192.168.1.255 have identical effect if there are no subnets in the network. However, there is a difference when you have broken down your network into subnets. 255.255.255.255 (called as 'Limited-Broadcast') is used by a host to broadcast to all of its immediate neighbors i.e. all those interfaces on the local subnet.

Whereas, you would use 192.168.1.255 (called as 'Directed-Broadcast') to broadcast to all the interfaces on the entire LAN or WAN.

Also, 255.255.255.255 is used by a node to broadcast on subnet if it doesn't know about its network (or simply prior to it IP configuration) and is requesting for its dynamic IP from a DHCP server. Refer to 'RFC 919' for more details.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .