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)

Example: 192.168.1.0/24 → divide into 4 subnets:

  • 192.168.1.0/26
  • 192.168.1.64/26
  • 192.168.1.128/26
  • 192.168.1.192/26

5. Supernetting (Combining Networks)

  • Opposite of subnetting → combine small networks.
    Example:
  • 192.168.0.0/24 + 192.168.1.0/24192.168.0.0/23.

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