(SUBNETwork mask) The technique used by the IP protocol to create a subnet address. The subnet mask is a binary pattern that is stored in the client machine, server or router. It is matched with the IP address of a packet to determine which network segment the packet is destined for. See subnet.|
A Tradeoff Between Hosts and Subnets
Depending on the network class (A, B or C), some number of bits are reserved for hosts and subnets, and these bits become a tradeoff. The more hosts, the fewer the subnets can be created; the more subnets, the fewer the hosts can be individually addressed.
A Subnet Mask Example
The subnet mask below is a Class C address, which uses the first 24 bits for network ID and the last 8 for host ID. These last 8 can be divided between hosts and subnets. In the Example #1 default mask below, the 0 means no subnets, and up to 254 hosts can be addressed.
Class C Default Mask (No Subnets)
Class C Mask for Six Subnets
In Example #2 above, the 224 reserves the three high-order bits of that field for subnets (sss), leaving the remaining five bits for hosts (hhhhh). The 224 creates six subnets from 001 to 110 (000 and 111 are reserved), and each subnet can have 30 hosts from 00001 to 11110. Likewise, 00000 and 11111 are reserved: all 0's mean "this" node, and all 1's mean "all" nodes (see broadcast address). This is why calculations for maximum hosts and subnets are always minus 2. For a list of Class B and C subnet masks, see subnet mask tables.