NextGen Sarkari

Study material for government exam preparation across Punjab and India.

Home/Study Material/Networking & Technical/IPv4 Addressing and Subnetting
Fundamentals study guide

IPv4 Addressing and Subnetting

Master IPv4 masks and prefixes using a repeatable calculation method, worked examples and practical network-design cautions.

FundamentalsBeginner28 min readUpdated 2026-08-06

IPv4 prefix basics

An IPv4 prefix divides the 32-bit address into network and host portions. A /24 means the first 24 bits identify the network and the remaining 8 bits identify addresses inside that prefix.

PrefixMaskAddressesTraditional usable hosts
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.2542Point-to-point use under RFC 3021
/32255.255.255.2551Single host route

Fast subnetting method

  1. Convert the prefix to a mask or identify the interesting octet.
  2. Calculate block size as 256 minus the mask value in that octet.
  3. Find the multiple of the block size that contains the IP.
  4. That multiple is the network boundary.
  5. The next boundary minus one is the broadcast address.
  6. Traditional usable range lies between them, except special /31 and /32 cases.
Example: 192.168.10.77/26. Mask is 255.255.255.192, block size is 64. Boundaries are 0, 64, 128 and 192. Therefore network = 192.168.10.64, broadcast = 192.168.10.127 and traditional host range = .65 to .126.

Address and host formulas

Total addresses = 2host bits. Traditional usable hosts = 2host bits − 2 because network and broadcast addresses are reserved. Do not blindly apply “minus two” to /31 point-to-point links or /32 host routes.

VLSM planning example

RequirementSmallest suitable prefixCapacity
100 hosts/25126 traditional usable
50 hosts/2662
25 hosts/2730
10 hosts/2814
Point-to-point/312 endpoints

Allocate the largest requirement first, keep boundaries aligned and document reserved growth space. VLSM improves address utilisation but requires accurate routing and summarisation planning.

Worked practice

1. Find the network for 10.20.30.200/27.
Answer: /27 block size is 32. Boundaries include 192 and 224, so network is 10.20.30.192 and broadcast is 10.20.30.223.
2. How many traditional usable hosts are in /28?
Answer: 14.
3. Which prefix gives at least 60 traditional usable hosts?
Answer: /26 gives 62.
4. What is the mask for /22?
Answer: 255.255.252.0.
5. Are 192.168.1.63/26 and 192.168.1.64/26 in the same subnet?
Answer: No. .63 is the broadcast of 192.168.1.0/26; .64 begins the next subnet.

Subnetting mistakes that cause outages

  • Different masks on devices in the same intended segment.
  • Gateway outside the host’s local prefix.
  • Overlapping routes or VPN encryption domains.
  • Using a network or broadcast address as a host under traditional subnetting.
  • Forgetting route summarisation boundaries.
  • Assuming a cloud platform reserves the same addresses as a physical LAN; provider rules differ.

Frequently asked questions

1. How many hosts are in a /24?
Answer: There are 256 addresses and traditionally 254 usable host addresses.
2. Why is /31 special?
Answer: RFC 3021 allows both addresses on a point-to-point link, avoiding network/broadcast waste.
3. What is CIDR?
Answer: Classless Inter-Domain Routing represents prefixes with a slash length and allows aggregation beyond old class boundaries.

Standards and further reading

Editorial note: Vendor commands and best-path tie-breakers can differ by platform and software release. Always verify production configuration against the device vendor documentation.

Continue learning