1. IP Addressing: IPv4, Subnets, Public and Private IPs
1.5 Subnetting Basics (Worked Example)
Also in the AWS course: this lesson is the same as 1.4 IPv4 in detail in the AWS course, which is the main version of this page.
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
When subnetting, many students also count the network address and the broadcast address as "usable hosts". In every subnet the first and last addresses are reserved (in AWS, as many as 5). After writing your answer, always check it with ipcalc – your manual calculation and the tool's answer should match.
Ravindra Bagale's Tip – मराठी
Subnetting करताना बरेच students network address आणि broadcast address ला पण "usable host" म्हणून मोजतात. प्रत्येक subnet मध्ये पहिला आणि शेवटचा address reserved असतो (AWS मध्ये तर 5). उत्तर लिहिल्यावर ipcalc ने नक्की check करा – हाताने केलेलं calculation आणि tool चं उत्तर जुळायला हवं.
Ravindra Bagale's Tip – हिंदी
Subnetting करते समय बहुत से students network address और broadcast address को भी "usable host" गिन लेते हैं. हर subnet में पहला और आख़िरी address reserved होता है (AWS में तो 5). जवाब लिखने के बाद ipcalc से ज़रूर check करो – हाथ से किया calculation और tool का जवाब मेल खाना चाहिए.
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).