5.2Subnetting and CIDR
The idea
Subnetting borrows host bits to make smaller networks. A prefix /n means n network bits. CIDR drops classes and allows any n. Two addresses are in the same subnet when they have the same network address.
Think of it like this: The postcode: how many digits you compare decides how big an area counts as "the same place".
Why it exists
Subnet membership, usable host counts and broadcast addresses are in the paper almost every year.
How it works
- Mask from /n: n ones then zeros (/30 = 255.255.255.252).
- Network = IP AND mask. Broadcast = network with all host bits 1.
- Usable hosts = 232 − n − 2. Block size = 232 − n.
- Blocks start at multiples of their size.
Worked example: 100.10.5.2, 100.10.5.5 and 100.10.5.6 with mask 255.255.255.252.
Blocks of 4: .2 is in 100.10.5.0/30, but .5 and .6 are both in 100.10.5.4/30, so only N and P share a subnet (GATE 2019).
Now play with it
- →Enter 192.168.10.77 and /26: network .64, broadcast .127.
- →Change /26 to /27 and see the block halve.
Network bits (26) and host bits (6)
Network address = address AND mask. Broadcast = network with all host bits set to 1. Usable hosts = 232 − n − 2.
Check yourself
A /27 subnet has how many usable host addresses?
Exam notes (the dense version)
A prefix /n keeps n network bits and 32 − n host bits; the block has 2^(32 − n) addresses and 2^(32 − n) − 2 usable hosts. Network address = IP AND mask; broadcast = network with all host bits set. Two hosts are in the same subnet if they have the same network address under the mask. Masks: /24 = 255.255.255.0, /26 = 255.255.255.192, /30 = 255.255.255.252. A block must start at a multiple of its size (84.0/21 is not a valid block; 80.0/21 is).
Previous year questions: IP Addressing & Network Layer (26)
PYQs are grouped by topic, so this is the full set for IP Addressing & Network Layer; try the ones that match this subtopic. Open all 26 on the topic page.