IPv4 subnetting made simple: two formulas and one worked example

By Prof. Bhagyashri Thorat · Assistant Professor, E&TC, I²IT Pune

Subnetting worries many students, but it comes down to two formulas and one trick. This lesson follows the same steps as her CCNA in Marathi playlist.

Why subnetting matters

Subnetting splits one large network into smaller ones. Smaller networks keep broadcast traffic local, make security rules easier to apply and avoid wasting addresses. It is part of the CCNA 200-301 Network Fundamentals topics and of IPv4 addressing in SPPU Computer Networks.

एक मोठा plot घ्या आणि त्याचे छोटे plots करा: हेच subnetting.

IPv4 address refresher

An IPv4 address has 32 bits written as four octets, each from 0 to 255, for example 192.168.1.10. One part identifies the network (the street) and the rest identifies the host (the house number). The subnet mask, or a prefix length such as /24, tells you where that split is.

  • Classful first-octet ranges: Class A 1–126, Class B 128–191, Class C 192–223 (127 is reserved for loopback).
  • Private ranges: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.

The only two formulas you need

Subnets = 2n, where n is the number of bits borrowed from the host part

Usable hosts per subnet = 2h − 2, where h is the number of host bits left

We subtract 2 because the first address in every subnet is the network ID and the last is the broadcast address. Neither can be assigned to a device.

Worked example: 192.168.1.0/26

  1. The default mask for this Class C network is /24, so the bits borrowed are n = 26 − 24 = 2. Subnets = 2² = 4.
  2. Host bits left: h = 32 − 26 = 6. Usable hosts = 2⁶ − 2 = 62 per subnet.
  3. The last octet of the mask is 11000000 in binary, which is 192, so the mask is 255.255.255.192.
  4. Block size = 256 − 192 = 64. Count up in 64s to get the network IDs: .0, .64, .128 and .192.
Subnets of 192.168.1.0/26
SubnetNetwork IDFirst hostLast hostBroadcast
1192.168.1.0192.168.1.1192.168.1.62192.168.1.63
2192.168.1.64192.168.1.65192.168.1.126192.168.1.127
3192.168.1.128192.168.1.129192.168.1.190192.168.1.191
4192.168.1.192192.168.1.193192.168.1.254192.168.1.255

The block-size trick

Once you know the mask value in the interesting octet, the block size is 256 minus that value. The network IDs are multiples of the block size, each broadcast address is one less than the next network ID, and the usable hosts sit between them. In an exam this is usually faster than converting every address to binary.

Cheat table for the last octet

Prefix lengths /24 to /30
PrefixSubnet maskBlock sizeUsable 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

Practise it

Try 192.168.10.0/27 yourself: you should get 8 subnets of 30 usable hosts each, with a block size of 32. Then build it in Cisco Packet Tracer: give two PCs addresses from two different subnets and see why they need a router to talk to each other.

Her Marathi lessons on binary to IP address conversion and IPv4 problems, routing and the default gateway are good next steps.

Watch next