255.255.255.255 vs 192.168.1.255

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


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


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.