Ravindra BagaleCourses & study guides

1. IP Addressing: IPv4, Subnets, Public and Private IPs

1.5 Subnetting Basics (Worked Example)

Subnetting mhanje ek motha network chhote chhote tukde karne. Dhyan dya – he fakt vachun yet nahi, haatane karave lagte.

Chala, aata ek example karuya together — take a pen and paper, don't just read.

Problem: Your institute lab is given the network 192.168.10.0/24. Divide it into 4 equal subnets for four labs. Find each subnet's network address, usable range and broadcast address.

Step 1 — borrow bits. 4 subnets need 2 extra bits (2² = 4). New prefix = 24 + 2 = /26.

Step 2 — block size. Addresses per subnet = 2^(32−26) = 64. Mask = 255.255.255.192.

Step 3 — list subnets (increase the last octet in steps of 64):

Subnet Network address First usable Last usable Broadcast Usable hosts
Lab 1 192.168.10.0/26 192.168.10.1 192.168.10.62 192.168.10.63 62
Lab 2 192.168.10.64/26 192.168.10.65 192.168.10.126 192.168.10.127 62
Lab 3 192.168.10.128/26 192.168.10.129 192.168.10.190 192.168.10.191 62
Lab 4 192.168.10.192/26 192.168.10.193 192.168.10.254 192.168.10.255 62

Step 4 — check with binary. Host 192.168.10.100: last octet 100 = 01100100. The first two bits (01) are the subnet bits → subnet 1 (counting from 0) → it belongs to Lab 2 (192.168.10.64/26).

Quick trick for block size

Block size = 256 − (last non-255 octet of the mask). For /26 the mask is 255.255.255.192, so block = 256 − 192 = 64. Subnets start at 0, 64, 128, 192.

AWS example: A VPC 10.0.0.0/16 is commonly split into subnets 10.0.1.0/24 (public, AZ-a), 10.0.2.0/24 (public, AZ-b), 10.0.11.0/24 (private, AZ-a) and 10.0.12.0/24 (private, AZ-b).

You can check subnet maths on Linux with the ipcalc tool (package ipcalc):

ipcalc 192.168.10.64/26

Why this matters for security

Subnetting is the basis of network segmentation (नेटवर्कचे विभाजन). Web servers sit in a public subnet, databases in a private subnet with no route from the internet. If an attacker compromises one web server, segmentation limits how far they can move (lateral movement).

Ravindra Bagale's Tip

Subnetting kartana khup students network address aani broadcast address la pan "usable host" mhanun mojtat. Pratyek subnet madhe pahila aani shevatcha address reserved asto (AWS madhe tar 5). Answer lihilyavar ipcalc ne nakki check kara – haatane kelela calculation aani tool che uttar match zala pahije.

Practice task

Split 172.16.0.0/22 into 8 equal subnets. Write the new prefix, block size and the range of the 3rd subnet. Verify with ipcalc (install with sudo apt install -y ipcalc on Ubuntu).