Subnetting the Easy Way

I have read post after post on common tech forums regarding new comers having trouble with subnetting and even some veterans who know of subnetting but forget how to do the math manually. So I wanted to share the easiest way that I have found to subnet!

What is subnetting?

Subnetting is the practice of dividing a network into two or more smaller networks.

Why use subnetting?

  • Improves network performance and speed
  • Reduce network congestion
  • Enhance network security
  • Easier to control the growth of your network

Key concept of subnetting

  • IP addresses are made up of 32 bits
    • An IP address is split into 4 octets (4 groups of 8 bits)
      • For example, with the 192.168.1.100 IP address: 192 is the first octet, 168 is the second octet, 1 is the third octet, and 100 is the fourth octet.
  • Like we said earlier, subnetting is the practice of dividing a network into two or more smaller network. That means some bits are reserved for identifying the network and the remaining bits identify the host (this will make more sense in a few minutes).
  • There are 3 main IP address classes. The information below shows the IP address range for the given IP class, along with how the addresses are split in terms of network and host bits (N == network bit, H == host bit).
    • Class A: 1.0.0.0 to 126.255.255.255
      • NNNNNNNN . HHHHHHHH . HHHHHHHH . HHHHHHHH
    • Class B: 128.0.0.0 to 191.255.255.255
      • NNNNNNNN . NNNNNNNN . HHHHHHHH . HHHHHHHH
    • Class C: 192.0.0.0 to 223.255.255.255
      • NNNNNNNN . NNNNNNNN . NNNNNNNN . HHHHHHHH
  • IMPORTANT: at each dot of an IP address, think of it as a boundary. That would mean there are boundaries at 8, 16, 24, and 32 bits.
  • IMPORTANT: The first and last ip addresses of a subnet range cannot be used by a host, they are set aside for the subnet address and broadcast address. The remaining IP addresses can be assigned.

Problem 1: What subnet does 192.168.19.25/27 belong to?

  1. What’s the mask: 27
  2. To get the block size, do the following:
    • What’s the boundary above 27? It’s 32, so we subtract 27 from 32.
      • 32 – 27 = 5
    • Next we calculate 2^ 5, which gives us 32
    • 32 is the block size
  3. Now we can start putting together the subnets
    • 192.168.19.0
    • 192.168.19.32
    • 192.168.19.64
    • 192.168.19.96
    • 192.168.19.128
    • etc…
  4. From looking at the IP ranges above, we can see 192.168.19.25 would fall into the 192.168.19.0 subnet

Problem 2: What subnet does 192.168.131.22/18 belong to?

  1. What’s the mask: 18
  2. To get the block size, do the following:
    • What’s the boundary above 18? It’s 24, so we subtract 18 from 24.
      • 24 – 18 = 6
    • Next we calculate 2^ 6, which gives us 64
    • 64 is the block size
  3. Now we can start putting together the subnets
    • 192.168.0.0
    • 192.168.64.0
    • 192.168.128.0
    • 192.168.192.0
    • 192.168.255.0
  4. From looking at the IP ranges above, we can see 192.168.131.22 would fall into the 192.168.128.0 subnet.

Problem 3: Provide a valid host range of the 3rd subnet of 192.168.144.0/29

  1. What’s the mask: 29
  2. To get the block size, do the following:
    • What’s the boundary above 29? It’s 32, so we subtract 29 from 32.
      • 32 – 29 = 2
    • Next we calculate 2^ 3, which gives us 8
    • 64 is the block size
  3. Now we can start putting together the subnets
    • 192.168.144.0
    • 192.168.144.8
    • 192.168.144.16 (3rd subnet)
    • 192.168.144.24
    • 192.168.144.32
    • 192.168.144.40
    • 192.168.144.48
  4. From looking at the IP ranges above, we can see 192.168.144.16 to 192.168.144.23.
  5. Remember that the subnet address (192.168.144.16) and the broadcast address (192.168.144.23) can not be used by a host.
  6. So the valid host range of the 3rd subnet is: 192.168.144.17 to 192.168.144.22