On any individual subnet, you can issue a broadcast to every other device on the subnet by doing two things. First, on the data link layer (Layer 2), you set the MAC address to the appropriate broadcast address for that medium. For Ethernet and Token Ring, the broadcast address is FF-FF-FF-FF-FF-FF—that is, all bits are set to one. Note that this address is consistent with what I mentioned earlier when talking about multicast addresses on Ethernet. Any time the lowest order bit of the destination MAC address is set to one, the packet is either a multicast or broadcast. Then, on the IP layer, you just set the destination address of the packet to be the subnet address followed by all ones or all zeros for the host portion of the address.
In fact, the standard prefers using all ones for the broadcast addresses, but both are used in practice. If the subnet uses a mask of 255.255.255.0, as in 10.1.2.0, then the broadcast address for this subnet would be 10.1.2.255 (all ones, the preferred version) or 10.1.2.0 (all zeros). Similarly, if the mask were 255.255.255.240 for the subnet address 10.1.2.32, then the all-ones broadcast address would be 10.1.2.47. The addresses in this subnet that are available for hosts range from 10.1.2.33 to 10.1.2.46.
The IP standard defines another type of broadcast called the all-subnets broadcast, which is seldom used in practice. It is considered optional, but on most equipment it must be explicitly disabled if it is not required. The all-subnets broadcast is exactly what it sounds like. It allows a broadcast to be sent simultaneously to every subnet in a network. The address for the all-subnets broadcast is simply the broadcast address for the entire network address. The previous example had a subnet of 10.1.2.32 with a mask of 255.255.255.240. But this is a subnet of the Class A network 10.0.0.0. Thus, you can send an all-subnets broadcast by addressing a packet to 10.255.255.255.
If you were dealing with a subnetted Class C network such as 192.168.1.0, then you have a mask of 255.255.255.0 for the whole network. The subnets may have a mask of 255.255.255.224, for example. Then the subnets would be as shown in Table 5-4.
Subnet |
Binary representation of last octet |
Comment |
---|---|---|
192.168.1.0 |
000-00000 |
All zeros in the network portion of the address |
192.168.1.32 |
001-00000 |
First nonzero subnet |
192.168.1.64 |
010-00000 |
|
192.168.1.96 |
011-00000 |
|
192.168.1.128 |
100-00000 |
|
192.168.1.160 |
101-00000 |
|
192.168.1.192 |
110-00000 |
|
192.168.1.224 |
111-00000 |
All ones in the network portion of the address |
This table should make the mechanics of subnetting clearer. Just as the all-zeros or all-ones addresses in each subnet are not used for host addresses, the all-zeros and all-ones subnet addresses are also problematic. Specifically, if you want to do any all-subnets broadcasting, you cannot use these networks. However, all-subnets broadcasting becomes ill-defined with CIDR.
If you look back at Table 5-1, it becomes clear why the subnet masks 255.255.255.192 and 255.255.255.128 are rarely used. The bit pattern for the number 192 is 11000000. If you subnet a Class C network, only the first two bits of the last octet are available for indicating subnets. If you don't use the all-zeros or all-ones subnets, you are left with only 01-000000 and 10-000000, which are 64 and 128, respectively. The situation is even worse if you want to use a mask of 255.255.255.128 on a Class C address because the bit pattern for 128 is 10000000, leaving you only one bit for selecting the subnet. This bit can be either one or zero, and that means it is always either all ones or all zeros, and therefore possibly reserved for broadcasts.
There are three important caveats to all of this. Because multiple subnet broadcasting is optional, you can still use the all-ones or all-zeros subnets if you just disable the feature on every router in the network. Since the routers are the only devices that care about propagating any packet between subnets, they are the only devices that need to be affected by this change.
The second caveat is that only subnets of Class C networks are covered here. If you subnet a Class A network, then you need ensure that you have a nonzero or nonone bit somewhere in the subnet address. However, this is a dangerous strategy. There have been a number of non-compliant IP implementations over the years, and the inability to distinguish properly between IP address classes is a bug that has appeared in some of these flawed implementations. In particular, some implementations assume that every subnet is a subnet of a Class C, regardless of the first octet in the address.
The third caveat is that you can use CIDR. As mentioned earlier, traffic passing through the Internet already assumes classless addressing. However, many organizations still use class-based addressing internally. If you enable classless routing, then the multiple subnet broadcast option also automatically disappears in most CIDR implementations because there is no longer any way to define a unique broadcast address for the entire network.[1] If the designer wants larger subnets, such as a 255.255.255.128, or even larger subnets, as in 255.255.254.0, it is best to explicitly disable the all-subnets broadcast feature and enable classless routing on all routers in the network.
[1] Note that the CIDR documents do not rule out an all-subnets broadcast. RFC 1700, when describing CIDR, states that all-subnets broadcasts still exist. However, it is not fully defined, and I am not aware of any working implementations or of any useful applications. Using multicast would probably be a better way to accomplish the same thing.
On some types of routers, the command to disable multiple subnet broadcasting takes the approach of allowing the all-zeros subnet addresses. But it should be clear that this is another way of saying the same thing, since you can't have all-subnets broadcasting if you don't reserve the all-zeros and all-ones subnet addresses for that purpose.