Computer Network & Network Security System — Network Layer, NEC licence examination syllabus (Nepal Engineering Council).
Addressing: how every device on Earth gets a unique number
4.3 billion possible addresses sounded like plenty in 1981. It very much wasn't.
An IPv4 address is a 32-bit number, usually written as four decimal numbers (like 192.168.1.1) — each address is split into a network part (identifies which network) and a host part (identifies which device on that network).
🏷️ Classful Addressing
Class A1.0.0.0 – 126.255.255.255. First bit 0. Huge networks, few of them (governments, huge ISPs).
Class B128.0.0.0 – 191.255.255.255. First bits 10. Medium networks (universities, large companies).
Class C192.0.0.0 – 223.255.255.255. First bits 110. Small networks — most home/office networks fall here.
Class D224.0.0.0 – 239.255.255.255. First bits 1110. Reserved for multicasting.
Class E240.0.0.0 – 255.255.255.255. First bits 1111. Reserved for experimental use.
Quick trick to identify class from the first octet:
0–126 → Class A
128–191 → Class B
192–223 → Class C
224–239 → Class D
240–255 → Class E
(127 is reserved for loopback — not a "real" address)
💡 Guaranteed one-liner: "Identify the class of 172.16.5.4" → first octet 172 falls in 128–191 → Class B. Practice a handful of these until instant.
The arithmetic that killed classful addressing
The class table looks like tidy administration. Working out what each class actually holds shows why the scheme had to be abandoned.
Class Net bits Networks Host bits Hosts per network
─────────────────────────────────────────────────────────────────
A 7 128 24 16,777,214
B 14 16,384 16 65,534
C 21 2,097,152 8 254
(hosts = 2^bits − 2: the all-zeros address names the network
itself and the all-ones address is the broadcast address)
Look at the gap between B and C. An organisation with 300 computers is too big for a Class C's 254 and gets a Class B — receiving 65,534 addresses and wasting over 65,000 of them. There is nothing in between, and that single cliff wasted an enormous fraction of the address space.
Worse, at the top end:
126 usable Class A networks × 16,777,216 addresses
= 2,113,929,216 addresses
= 49.2% of the ENTIRE IPv4 space (4,294,967,296)
Half the internet's addresses were allocated to 126 organisations.
💡 That is the answer to "why was classful addressing replaced by CIDR?" — not that it was inelegant, but that fixed 8/16/24-bit boundaries allowed only three network sizes, so almost every allocation was far too large or slightly too small. CIDR allows a prefix of any length, so a network can be sized to what is actually needed.
Why two addresses are always unusable
🚫 The two reserved values
All host bits 0Names the network itself — what appears in a routing table, not something a device can be.
All host bits 1The broadcast address for that network — everything on it receives the packet.
💡 This is why a /30 subnet — 4 addresses — provides only 2 usable hosts, which is exactly right for a point-to-point link between two routers and nothing else. Subnetting questions almost always hinge on remembering to subtract those two.
The address ranges worth recognising
🏠 Special-purpose blocks
Private10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 — never routed on the public internet, reusable by everyone, and what NAT translates.
Loopback127.0.0.0/8 — the machine itself. Note the whole /8 is reserved for it, 16 million addresses for one purpose.
MulticastClass D, 224.0.0.0/4 — one packet delivered to many subscribers.
💡 Private addressing plus NAT is the main reason IPv4 survived far past the point its address space was exhausted: a single public address can front thousands of private ones. It is a workaround rather than a fix, and its cost is the loss of end-to-end addressability — which is why AH breaks through NAT, as covered in the IPsec topic.
Syllabus points
IPv4 address structure (network + host)
Classful addressing: Class A–E and ranges
Identifying class from an address
Create a free account to tick topics off, take notes as you read, watch the video lessons and get a day-by-day study plan built around your exam date.