Classful and Classless addressing (CIDR)

1. Classful Addressing

  • Old system (before 1993).
  • IPs are divided into predefined classes (A–E).
  • Fixed subnet mask per class.
ClassRangeDefault MaskPurpose
A1.0.0.0 – 126.255.255.255255.0.0.0 (/8)Large networks
B128.0.0.0 – 191.255.255.255255.255.0.0 (/16)Medium
C192.0.0.0 – 223.255.255.255255.255.255.0 (/24)Small
D224.0.0.0 – 239.255.255.255N/AMulticast
E240.0.0.0 – 255.255.255.255N/AExperimental

⚠️ Problem: Wastes IPs (e.g., Class A gives ~16M addresses even if only a few are needed).


2. Classless Addressing (CIDR – Classless Inter-Domain Routing)

  • Introduced in 1993 to replace Classful.
  • Uses Variable-Length Subnet Masks (VLSM).
  • CIDR Notation: IP/prefix → e.g., 192.168.1.0/26.

👉 /26 = first 26 bits for network, rest for hosts.
👉 Hosts = 2(32−prefix)−22^{(32-prefix)} – 22(32−prefix)−2.


3. CIDR Table (Must Memorise)

PrefixSubnet MaskHosts
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/27255.255.255.22430
/28255.255.255.24014
/29255.255.255.2486
/30255.255.255.2522

4. Subnetting (Breaking a Network)

Subnetting means dividing a big network into smaller networks.

👉 Like cutting a big cake into smaller pieces so more people can get their own piece.

Why do we subnet?

ReasonSimple Meaning
Save IP addressesAvoid wasting IPs
Improve securitySeparate departments or devices
Reduce trafficEach subnet has fewer devices
Better managementEasy to control networks

Key idea

In subnetting, we borrow bits from the host part of an IP to create more networks.

Example with a /24 network:

  • Original network: 192.168.1.0/24
  • Usable hosts: 254 hosts (big network)

If we subnet (example /26):

  • New mask: 255.255.255.192 (/26)
  • Each subnet has 64 total addresses
  • Usable hosts = 62 per subnet
  • We get 4 smaller subnets

Simple Formula

Hosts per subnet = 2^(Host bits) – 2

Super Simple Example

You have a class with 50 students but the room capacity is 200.

  • Big room = /24
  • Instead you divide students into 4 rooms with 50 each = /26

In one line

👉 Subnetting = splitting one large network into many smaller networks by changing the subnet mask.

Quick Memory Trick

CIDRMaskHosts
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/27255.255.255.22430
/28255.255.255.24014

Ultra-short answer (2 lines)

Subnetting is dividing a large IP network into smaller logical networks.
It improves security, reduces traffic, and saves IP addresses.


5. Supernetting (Combining Networks)

Supernetting means combining multiple small networks into one bigger network.

👉 Opposite of subnetting
(Subnetting = divide | Supernetting = combine)

Why do we use Supernetting?

ReasonSimple Meaning
Reduce routing tablesFewer entries = faster routing
Improve routing efficiencySaves memory & CPU in routers
Aggregate networksCombine many networks into one summarized route
Simplify managementEasy to handle routing

Example

Suppose we have 4 Class C networks:

192.168.0.0/24
192.168.1.0/24
192.168.2.0/24
192.168.3.0/24

Instead of writing 4 separate routes, we combine them:

Supernet: 192.168.0.0/22

So router needs only one entry instead of four.

Real-Life Example

Imagine you have four small notebooks for subjects; carrying all is difficult.
So you combine them into one big notebook → easier to carry.

In One Line

👉 Supernetting = merging multiple networks into one bigger summarized network to reduce routing entries.

Key Points

TermMeaning
Route AggregationAnother name for supernetting
CIDRClassless inter-domain routing (used for supernetting)
Done onPublic networks / ISPs mostly
Opposite ofSubnetting

Quick difference

SubnettingSupernetting
Divide a networkCombine networks
Smaller networksLarger network
Adds routing entriesReduces routing entries

Ultra-short answer (for exams)

Supernetting is the process of combining multiple contiguous networks into a single larger network using CIDR to reduce routing table size.


6. Key Terms

  • VLSM: Different masks for different subnets.
  • Aggregation: Combine networks → reduces routing entries.
  • Formula for Hosts: 2(32−prefix)−22^{(32 – \text{prefix})} – 22(32−prefix)−2.

7. Quick Comparison Table

AspectClassfulClassless (CIDR)
Subnet MaskFixed (A, B, C)Variable (VLSM)
EfficiencyWastes IPsEfficient
RoutingComplexEasier (aggregation)
Usage TodayObsoleteWidely used

Exam Tips:

  • If they ask about default masks → A = /8, B = /16, C = /24.
  • If they ask about hosts in /26 → Formula → 2(32−26)−2=622^{(32-26)}-2 = 622(32−26)−2=62.
  • CIDR = flexible, efficient, modern.


MCQ


1. In classful addressing, how many bits are used for the network portion in a Class A address?

  • A. 8 bits
  • B. 16 bits
  • C. 24 bits
  • D. 32 bits
    Answer: A

2. What is the default subnet mask for a Class B IP address?

  • A. 255.0.0.0
  • B. 255.255.0.0
  • C. 255.255.255.0
  • D. 255.255.255.255
    Answer: B

3. What is the purpose of CIDR (Classless Inter-Domain Routing)?

  • A. To eliminate private IP addresses
  • B. To enable more efficient use of IP address space
  • C. To support only IPv6 addressing
  • D. To simplify subnetting in IPv4
    Answer: B

4. Which of the following CIDR notations represents the largest possible subnet?

  • A. /30
  • B. /24
  • C. /8
  • D. /32
    Answer: C

5. Which address range is assigned to Class C in classful addressing?

  • A. 0.0.0.0 to 127.255.255.255
  • B. 128.0.0.0 to 191.255.255.255
  • C. 192.0.0.0 to 223.255.255.255
  • D. 224.0.0.0 to 239.255.255.255
    Answer: C

6. In classful addressing, what is the maximum number of hosts that can be assigned to a Class A network?

  • A. 254
  • B. 65,534
  • C. 16,777,214
  • D. 2,097,152
    Answer: C

7. What is the subnet mask for the CIDR notation 192.168.1.0/27?

  • A. 255.255.255.128
  • B. 255.255.255.224
  • C. 255.255.255.0
  • D. 255.255.255.252
    Answer: B

8. Which of the following is true about Classless Addressing (CIDR)?

  • A. It uses fixed subnet masks.
  • B. It allows flexible and efficient address allocation.
  • C. It is only applicable for IPv6.
  • D. It uses classes to define IP address ranges.
    Answer: B

9. What does the notation 192.168.1.0/24 represent?

  • A. A network with 24 hosts
  • B. A network with 256 hosts, and 254 usable IPs
  • C. A Class B network
  • D. A network with 16 bits allocated for hosts
    Answer: B

10. In CIDR notation, what does the “/24” represent?

  • A. 24 bits for the host portion
  • B. 24 bits for the network portion
  • C. The number of subnets in the network
  • D. The number of possible IP addresses in the subnet
    Answer: B

11. What is the subnet mask for a Class B network in classful addressing?

  • A. 255.255.255.0
  • B. 255.0.0.0
  • C. 255.255.0.0
  • D. 255.255.255.255
    Answer: C

12. What is the total number of IP addresses available in the network 10.0.0.0/8?

  • A. 256
  • B. 65,536
  • C. 16,777,216
  • D. 4,294,967,296
    Answer: C

13. In CIDR, what does the prefix “/16” signify?

  • A. 16 bits are used for the network portion
  • B. 16 bits are used for the host portion
  • C. The network can have 16 subnets
  • D. The network can have 16 hosts
    Answer: A

14. Which of the following represents a supernet?

  • A. Combining multiple /24 subnets into a /23 network
  • B. Dividing a /8 network into smaller /24 subnets
  • C. Using more bits for the host portion
  • D. Using the full 32 bits for an address
    Answer: A

15. Which IPv4 class is used for multicast traffic?

  • A. Class A
  • B. Class B
  • C. Class C
  • D. Class D
    Answer: D

16. What is the advantage of CIDR over classful addressing?

  • A. More predictable and easier routing
  • B. Flexible IP address allocation
  • C. Reduced need for IP address translation
  • D. Fewer subnets
    Answer: B

17. Which is the correct CIDR notation for the subnet mask 255.255.255.192?

  • A. /26
  • B. /27
  • C. /28
  • D. /29
    Answer: A

18. How many subnets are created by using a /30 CIDR in the 192.168.1.0 network?

  • A. 2
  • B. 4
  • C. 8
  • D. 16
    Answer: B

19. What is the major disadvantage of classful addressing?

  • A. It supports only IPv6.
  • B. It leads to inefficient IP address utilization.
  • C. It requires too many bits for large networks.
  • D. It allows dynamic IP address assignment.
    Answer: B

20. What is the purpose of route aggregation in CIDR?

  • A. To increase the size of routing tables
  • B. To combine multiple routes into a single route
  • C. To divide a network into smaller subnets
  • D. To assign IP addresses automatically
    Answer: B