TCP/IP Subnet Masking

This is taking a large network block and breaking into pieces of equal size. Routers requires this logical segmentation to be able to address different logical subnets. Clients require a default gateway IP address (the router interface) to get off their local subnet. The subnet address is more important to a router than the TCP/IP value. The number of bits used in the subnet mask determine how many logical subnets you get.

The rules in subnet masking:

  1. The subnets cannot be all 0's or all 1's in the network or host portion of the address.
  2. The all 0 subnet is called Subnet Zero, and sometimes can be used (not recommended).
  3. The all 1 subnet is called All 1 subnet, and can never be used (direct broadcast).
  4. The incremental value is the IP host address starting point for the subnet.
  5. Each incremental value represents another logical subnet.
  6. Routers only care about the Net ID, and the subnet broadcast.
  7. Clients only care about the local IP subnet address on their subnet, and their subnet broadcast.
  8. Each bit represents a power of 2.
Binary Mask Decimal Mask Binary Hosts Bits Used Number of Subnets Valid Host Increments
00000000 0 00000000 0 Net ID Not a subnet
10000000 128* 00000001 1 1 128
11000000 192 00000011 2 2 64
11100000 224 00000111 3 6 32
11110000 240 00001111 4 14 16
11111000 248 00011111 5 30 8
11111100 252 00111111 6 62 4
11111110 254* 01111111 7 126 2*
11111111 255* 11111111 8 254 1*

* 7 subnets valid for Class A or B in first octet. Class C has only 5 valid, the last 2 are binary of 1.