Subnetting Simplified: Mastering Network Segmentation Step by Step

Overview

IPV4 Address Format
IPV4 Address Format
2726252423222120
1286432168421

Example:

  • Convert binary into decimal 10100100 -> 128 + 32 + 8 = 188 decimal
Binary to Decimal
Binary to Decimal

Network Portion

Network Portion
Network Portion

How to find the prefix /25 in dotted-decimal form

  • Write 1, 25 times from left to right 11111111.11111111.11111111.10000000 -> 255.255.255.128

Count the number of networks in one prefix

Number of networks = 2n

  • n = number of bits borrowed from the host portion

Example: Count the number of networks in the prefix /24

Number of Network
Number of Network

What does “number of /24 networks” mean?
It means: How many unique /24 subnets can exist across all of IPv4.

0.0.0.0/24
0.0.1.0/24
0.0.2.0/24
...
192.168.1.0/24
...
255.255.255.0/24

Host Portion

Count the number of hosts in one network

Number of hosts = 2n - 2

  • n = the number of zero bits in the netmask

Example:
Calculate the number of hosts available on each network on the /24 prefix

Number of Host
Number of Host

Subnetting

Subnetting is a method for breaking down a classful IP network into smaller subnetworks. The reasons for using subnetting include:

  • Reducing network traffic
  • Improving network performance
  • Simplifying network management
  • Optimizing network resources

Subnet Mask

A subnet mask is a 32-bit value that divides an IP address into network and host portions. It is used to determine which part of an IP address is the network address and which part is the host address.

Calculate Number of Subnet

Number of subnet = 2(target_prefix - original_prefix)

Example: Calculate how many subnets are generated if network 172.16.0.0/16 is subneted with /18

Number of subnet = 2^(target_prefix - original_prefix)
                 = 2^(18 - 16) 
                 = 2^2 
                 = 4

Calculate Range of each Subnet

Block Subnet = 256 - n Where n is the position where the bits of the prefix stop (at the octet)

Block Subnet
Block Subnet

The subnet block obtained for the /18 prefix is ​​64

172.16.0.0/18 -> 172.16.0.0 - 172.16.63.255
172.16.64.0/18 -> 172.16.64.0 - 172.16.127.255
172.16.128.0/18 -> 172.16.128.0 - 172.16.191.255
172.16.192.0/18 -> 172.16.192.0 - 172.16.255.255

Calculate IP usable in each Subnet

Number of usable IP = 2^(32 - target_prefix) - 2

Example: Calculate the number of usable IP in each subnet of the /18 prefix

Number of usable IP = 2^(32 - 18) - 2
                    = 2^14 - 2
                    = 16384 - 2
                    = 16382

Total IP in all subnet

Total IP = Number of subnet * Number of usable IP
         = 4 * 16382
         = 65528