IP Subnetting: A Network Engineer’s Secret Weapon

Araiz Naqvi
3 min readNov 5, 2024

--

NetSec by Araiz Naqvi

Breaking Down Complex Networks into Manageable Chunks

Ever tried to organize a massive house party and realized you need different rooms for different groups? Well, that’s essentially what IP subnetting is in the networking world! Let’s break down this crucial networking concept with real, practical examples you can follow along.

The Binary Method: Your Swiss Army Knife for Subnet Calculations

Think of subnetting like dividing a large mansion into smaller apartments. Each apartment (subnet) needs its own address range. The Binary Method is your trusty calculator for figuring out these ranges.

The Four Golden Rules of Subnet Calculation ⭐

Remember these rules like you remember your morning coffee routine:

  1. Network Address/Subnet = Fill Host portion with all 0's
  2. Broadcast Address = Fill Host portion with all 1's
  3. First Address = Fill Host Portion with 0’s except keep the last bit 1
  4. Last Address = Fill Host Portion with 1’s except keep the last bit 0

Let’s Work Through a Real Example 🔍

Let’s say you have a PC with IP of 172.16.35.123/20. Here’s how to break it down:

  1. First, identify Network and Host portions:
  • Network: 172.16.0010
  • Host: 0011.0111 1011
  1. Now apply our rules:
Subnet: 172.16.0010 0000.0000 0000 => 172.16.32.0 
First Address: 172.16.0010 0000.0000 0001 => 172.16.32.1
Last Address: 172.16.0010 1111.1111 1110 => 172.16.47.254
Broadcast Address: 172.16.0010 1111.1111 1111 => 172.16.47.255

This is how network engineers do it in the real world — bit by bit, literally!

Subnet Division: When One Network Isn’t Enough 🌐

Sometimes you need to break networks down into smaller groups. There are two main scenarios:

  1. You need to support a specific number of hosts
  2. You need a specific number of subnets

The Magic Formulas ✨

Remember these formulas — they’re your best friends in subnetting:

  • Available Hosts = 2^n — 2 (count Host bits from RHS to LHS)
  • Available Networks/Subnets = 2^n (count Network bits from LHS to RHS)

Real-World Example: Host-Based Subdivision 📝

Let’s work through a practical example:

ABC Ltd. has been allocated subnet 10.1.1.0/24 for their London office. The network admin needs subnets that can each support 14 machines. Here’s how to solve this:

  1. Calculate required host bits:
2^n - 2 = 14 2^n = 16 Therefore, n = 4 (we need 4 host bits)

2. Apply this to our subnet:

10.1.1.0000|0000 (/28) (The bold 4 bits are taken from right)

3. This gives us our subnets:

1st: 10.1.1.0000|0000 => 10.1.1.0/28 
2nd: 10.1.1.0001|0000 => 10.1.1.16/28
3rd: 10.1.1.0010|0000 => 10.1.1.32/28
4th: 10.1.1.0100|0000 => 10.1.1.64/28
...and so on until...
Last: 10.1.1.1111|0000 => 10.1.1.240/28

Pro Tips for Network Engineers 💡

  1. ⚠️ Never exceed 254 hosts on a subnet unless you want your network performance to crash and burn.
  2. 🔄 Subnetting is about stealing bits from the host portion and giving them to the network portion — like Robin Hood, but for networks!
  3. Always double-check your binary calculations. One wrong bit can send your packets to the wrong neighborhood.
  4. 🎯 Practice these examples until you can do them in your sleep. Network troubleshooting often requires quick subnet calculations.

Conclusion

IP subnetting might look like binary soup at first, but with these practical examples and regular practice, you’ll be slicing and dicing networks like a pro. Remember: every expert network engineer started by working through these same examples.

Want to practice? Try working through these examples with different IP addresses. The more you practice, the more natural it becomes.

--

--