Skip to content

The Arithmetic

Subnet size

The size of a subnet is calculated from the hosts bits. So, for /24:

  • host bits: 32 - 24 = 8
  • size: \(2^8\)

For /27:

  • host bits: 32 - 27 = 5
  • size: \(2^5\)

Two addresses in each subnet are reserved (subnet ID and broadcast ID). so:

  • usable: \(size - 2\)

Fixed Length subnetting

  • This is simply division. You divide the starting size by the desired number of subnets:
    • subnet sizes are always powers of 2. As a result, division is also by powers of 2
    • subnetting entails growing the prefix by a certain number of bits:
      • growing the prefix by 1 bit is equivalent to dividing by 2
      • growing the prefix by 2 bits is equivalent to dividing by 4
      • growing the prefix by 3 bits is equivalent to dividing by 8
      • given n extra bits, division is by \(2^n\)
    • the bits added to the prefix are "borrowed" from host bits.
    • consequently, a subnet's size shrinks as its prefix grows and vice versa

Variable Length subnetting

This is essentially repeated fixed-length subnetting

  1. Determine number of networks
  2. Determine number of hosts per network
  3. Add 2 to number of hosts per network and round up to the nearest power of 2
  4. Perform a quick check that assigned network range can accommodate all the required addresses.
  5. Sort the networks in order of size (this can be altered but makes process not algorithmic)
  6. Starting with largest network:
    1. Divide the network into equal parts sized according to the largest subnet. The number of parts will determine how many extra bits to use in subnetting.
    2. Example: 1 extra bit to yield 2 subnets, 2 extra bits to yield 4 subnets, 3 extra bits to yield 8 subnets, etc
    3. Assign the blocks to subnets excluding already assigned blocks.
    4. Repeat the process, starting with the next biggest subnet until all subnets have been assigned.