Labs ICT
โญ Pro Login

Subnetting

Dividing networks into smaller, manageable pieces.

Dividing Networks into Smaller Pieces

Subnetting is the practice of dividing a large network into smaller, more manageable sub-networks (subnets). It's like dividing a large office building into separate floors and departments โ€” each section has its own address range and can be managed independently.

Subnetting is essential for efficient IP address usage, improved security, and better network performance.

Why Subnet?

  • Efficiency โ€” Without subnetting, a Class C network with 254 hosts might be wasted on a department of 10 people. Subnetting lets you allocate just the right number of addresses.
  • Performance โ€” Smaller subnets mean fewer devices on each broadcast domain. Broadcast traffic (like ARP requests) stays within the subnet instead of flooding the entire network.
  • Security โ€” Subnets can be separated by routers or firewalls, allowing you to control traffic between departments.
  • Organization โ€” Subnets mirror the organizational structure โ€” different departments, locations, or functions get their own subnets.

How Subnetting Works

Subnetting borrows bits from the host portion of an IP address to create a subnet ID. The subnet mask determines how many bits are borrowed.

Example: Take the network 192.168.1.0/24 (254 usable hosts). If we borrow 2 bits for subnetting:


  Original:     192.168.1.0/24
  Subnetted:    192.168.1.0/26

  /26 means 26 bits for network + subnet, 6 bits for hosts

  Subnet mask:  255.255.255.192  (11111111.11111111.11111111.11000000)

  Subnets created:
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Subnet              โ”‚ Usable Host Range       โ”‚ Broadcast   โ”‚
  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
  โ”‚ 192.168.1.0/26      โ”‚ 192.168.1.1 - .62      โ”‚ 192.168.1.63โ”‚
  โ”‚ 192.168.1.64/26     โ”‚ 192.168.1.65 - .126    โ”‚ .127        โ”‚
  โ”‚ 192.168.1.128/26    โ”‚ 192.168.1.129 - .190   โ”‚ .191        โ”‚
  โ”‚ 192.168.1.192/26    โ”‚ 192.168.1.193 - .254   โ”‚ .255        โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

We went from 1 network with 254 hosts to 4 subnets with 62 hosts each.

CIDR Notation

CIDR (Classless Inter-Domain Routing) uses a slash followed by the number of network bits:


  192.168.1.0/24    โ†’  24 network bits, 8 host bits   โ†’ 254 hosts
  192.168.1.0/25    โ†’  25 network bits, 7 host bits   โ†’ 126 hosts
  192.168.1.0/26    โ†’  26 network bits, 6 host bits   โ†’ 62 hosts
  192.168.1.0/27    โ†’  27 network bits, 5 host bits   โ†’ 30 hosts
  192.168.1.0/28    โ†’  28 network bits, 4 host bits   โ†’ 14 hosts
  192.168.1.0/30    โ†’  30 network bits, 2 host bits   โ†’ 2 hosts

The formula for usable hosts: 2^(host bits) - 2. We subtract 2 because the all-zeros address is the network address and the all-ones address is the broadcast address.

Subnetting Example

You have the network 10.0.0.0/8 and need to create subnets for 5 departments with 2000 hosts each. How many bits do you need to borrow?

For 2000 hosts: 2^11 = 2048, so we need 11 host bits. That means we borrow 32 - 11 = 21 bits from the host portion. But wait โ€” we only need 5 subnets, so 3 bits (2^3 = 8 subnets) would suffice.

We borrow 3 bits: 10.0.0.0/11


  Subnet 1: 10.0.0.0/11     โ†’ 10.0.0.1 - 10.31.255.254
  Subnet 2: 10.32.0.0/11    โ†’ 10.32.0.1 - 10.63.255.254
  Subnet 3: 10.64.0.0/11    โ†’ 10.64.0.1 - 10.95.255.254
  Subnet 4: 10.96.0.0/11    โ†’ 10.96.0.1 - 10.127.255.254
  Subnet 5: 10.128.0.0/11   โ†’ 10.128.0.1 - 10.159.255.254

Each subnet has over 2 million addresses โ€” more than enough for 2000 hosts.

๐Ÿงช Quick Quiz

How many usable hosts does a /26 subnet provide?