IPv4 Addressing - Classful Addressing ======================================= .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What is Classful addressing?** Classful addressing is an IP addressing method that divides the IP address space into fixed classes (A, B, C, D, and E), each with a predefined range and default subnet mask. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Why is Classful addressing useful?** Classful addressing provided a simple and structured way to allocate IP addresses in the early days of the internet. It helped standardize IP address assignment. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **How it works?** IP addresses are divided into five classes based on their first few bits. Each class has a default subnet mask and a predefined range of network and host bits. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Where is Classful addressing used?** Classful addressing was used in early IP networks before the introduction of CIDR. It is now largely obsolete but still appears in legacy systems and educational contexts. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Which OSI layer does this protocol belong to?** Classful addressing operates at the Network Layer (Layer 3), as it deals with IP addressing and routing. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Is Classful addressing Windows specific?** No, Classful addressing is not Windows specific. It is a general IP addressing concept applicable to any system implementing IP. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Is Classful addressing Linux specific?** No, Classful addressing is not Linux specific. It is supported on all operating systems that use the IP protocol, although it is now outdated. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Which Transport Protocol is used by Classful addressing?** Classful addressing is not tied to any transport protocol. It is used with IP and can work with both TCP and UDP. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Which Port is used by Classful addressing?** Classful addressing does not use any specific port. It defines IP address structure, not application-layer communication. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Is Classful addressing using client-server model?** No, Classful addressing is an addressing method and not a communication protocol. It does not follow the client-server model. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What are the different classes in Classful addressing?** The classes are A, B, C, D, and E, each defined by a range of IP addresses and default subnet masks. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What is the default subnet mask for Class A?** The default subnet mask for Class A is 255.0.0.0 or /8. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What is the default subnet mask for Class B?** The default subnet mask for Class B is 255.255.0.0 or /16. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What is the default subnet mask for Class C?** The default subnet mask for Class C is 255.255.255.0 or /24. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What is Class D used for?** Class D addresses are reserved for multicast groups. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What is Class E used for?** Class E addresses are reserved for experimental and future use. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Why is Classful addressing considered inefficient?** It leads to wasted IP addresses because networks must use predefined sizes regardless of actual need. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **How does Classful addressing determine network and host portions?** The class of the IP address defines which bits represent the network and which represent hosts. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What is the address range of Class A?** Class A addresses range from 1.0.0.0 to 126.255.255.255. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What is the address range of Class B?** Class B addresses range from 128.0.0.0 to 191.255.255.255. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What is the address range of Class C?** Class C addresses range from 192.0.0.0 to 223.255.255.255. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Are Classful addresses still in use?** They are mostly obsolete but sometimes seen in legacy systems and older networking concepts. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What are the limitations of Classful addressing?** Fixed class sizes limit flexibility and contribute to IP address exhaustion. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **How did CIDR improve on Classful addressing?** CIDR introduced variable-length subnet masks allowing more flexible and efficient IP allocation. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What role do network bits play in Classful addressing?** Network bits identify the network segment to which the IP address belongs. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What role do host bits play in Classful addressing?** Host bits identify individual devices within a network. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Can Classful addressing be subnetted?** Yes, subnetting can be applied to classful networks to create smaller network segments. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What tools help analyze Classful addressing?** Tools like IP calculators and subnet calculators help visualize classful IP ranges and subnetting. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow Topics in this section, * :ref:`Learnings in this section ` * :ref:`Terminology ` * :ref:`Version Info ` * :ref:`Classful_Addressing Version&IEEE Details ` * :ref:`Classful_Addressing Basic Setup on Ubuntu using IPv4 ` * :ref:`Classful_Addressing Protocol Packet Details ` * :ref:`Classful_Addressing Usecases ` * :ref:`Classful_Addressing Basic Features ` * :ref:`Reference links ` .. _Classful_Addressing_step1: .. tab-set:: .. tab-item:: Learnings in this section * In this section, you are going to learn .. _Classful_Addressing_step2: .. tab-set:: .. tab-item:: Terminology * Terminology .. _Classful_Addressing_step3: .. tab-set:: .. tab-item:: Version Info * Version Info .. _Classful_Addressing_step5: .. tab-set:: .. tab-item:: Classful_Addressing Version&RFC Details * rfc details .. _Classful_Addressing_step18: .. tab-set:: .. tab-item:: Classful Addressing **Test Objective** This test confirms the historic division of IPv4 addresses into classes and verifies that the ``ipcalc`` utility correctly interprets Class A, B, and C addresses using their fixed-length subnet masks. **IPv4 Address Classes** * Class A: ``1.0.0.0 – 126.255.255.255`` (/8) * Class B: ``128.0.0.0 – 191.255.255.255`` (/16) * Class C: ``192.0.0.0 – 223.255.255.255`` (/24) .. note:: * ``ipcalc`` should output the Network, Host, and Broadcast addresses based on the classful subnet mask (e.g., /8 for Class A). * Two hosts in the same classful network should be able to communicate successfully. * Classful addressing is **deprecated** and replaced by CIDR (Classless Inter-Domain Routing). * These tests are for educational/legacy understanding only. **Test 1 — Class A Addressing** * Objective: Verify ``ipcalc`` applies a /8 subnet mask to Class A. **Laptop 1 Setup** .. code-block:: shell test:~$ sudo ip addr add 10.10.10.1/8 dev enp0s8 test:~$ sudo ip link set enp0s8 up test:~$ ping 10.20.20.2 PING 10.20.20.2 (10.20.20.2) 56(84) bytes of data. 64 bytes from 10.20.20.2: icmp_seq=1 ttl=64 time=0.590 ms 64 bytes from 10.20.20.2: icmp_seq=2 ttl=64 time=0.517 ms 64 bytes from 10.20.20.2: icmp_seq=3 ttl=64 time=1.13 ms ^C --- 10.20.20.2 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2047ms test:~$ ipcalc 10.10.10.1 Address: 10.10.10.1 00001010.00001010.00001010.00000001 Netmask: 255.255.255.0 = 24 11111111.11111111.11111111.00000000 Wildcard: 0.0.0.255 00000000.00000000.00000000.11111111 => Network: 10.10.10.0/24 00001010.00001010.00001010.00000000 HostMin: 10.10.10.1 00001010.00001010.00001010.00000001 HostMax: 10.10.10.254 00001010.00001010.00001010.11111110 Broadcast: 10.10.10.255 00001010.00001010.00001010.11111111 Hosts/Net: 254 Class A, Private Internet **Laptop 2 Setup** .. code-block:: shell test:~$ sudo ip addr add 10.20.20.2/8 dev enp0s8 test:~$ sudo ip link set enp0s8 up test:~$ ping 10.10.10.1 test:~$ ipcalc 10.20.20.2 Address: 10.20.20.2 00001010.00010100.00010100.00000010 Netmask: 255.255.255.0 = 24 11111111.11111111.11111111.00000000 Wildcard: 0.0.0.255 00000000.00000000.00000000.11111111 => Network: 10.20.20.0/24 00001010.00010100.00010100.00000000 HostMin: 10.20.20.1 00001010.00010100.00010100.00000001 HostMax: 10.20.20.254 00001010.00010100.00010100.11111110 Broadcast: 10.20.20.255 00001010.00010100.00010100.11111111 Hosts/Net: 254 Class A, Private Internet **Capture Analysis** * ICMP Echo Request and Reply packets are exchanged between ``10.10.10.1`` and ``10.20.20.2``. * Wireshark shows: - Source: ``10.10.10.1`` → Destination: ``10.20.20.2`` - Protocol: ICMP (ping) - TTL: 64 * Reply packets show reversed addresses (confirming bidirectional communication). .. note:: * In Class A, only the **first octet** is fixed as the network ID (``10.x.x.x``). * That’s why ``10.10.10.1`` and ``10.20.20.2`` still belong to the same network. :download:`Download Wireshark Capture ` **Test 2 — Class B Addressing** * Objective: Verify ``ipcalc`` applies a /16 subnet mask to Class B. **Laptop 1 Setup** .. code-block:: shell test:~$ sudo ip addr add 172.16.10.1/16 dev enp0s8 test:~$ sudo ip link set enp0s8 up test:~$ ping 172.16.20.2 PING 172.16.20.2 (172.16.20.2) 56(84) bytes of data. 64 bytes from 172.16.20.2: icmp_seq=1 ttl=64 time=10.9 ms 64 bytes from 172.16.20.2: icmp_seq=2 ttl=64 time=0.799 ms 64 bytes from 172.16.20.2: icmp_seq=3 ttl=64 time=1.05 ms ^C --- 172.16.20.2 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2047ms test:~$ ipcalc 172.16.10.1 Address: 172.16.10.1 10101100.00010000.00001010.00000001 Netmask: 255.255.255.0 = 24 11111111.11111111.11111111.00000000 Wildcard: 0.0.0.255 00000000.00000000.00000000.11111111 => Network: 172.16.10.0/24 10101100.00010000.00001010.00000000 HostMin: 172.16.10.1 10101100.00010000.00001010.00000001 HostMax: 172.16.10.254 10101100.00010000.00001010.11111110 Broadcast: 172.16.10.255 10101100.00010000.00001010.11111111 Hosts/Net: 254 Class B, Private Internet **Laptop 2 Setup** .. code-block:: shell test:~$ sudo ip addr add 172.16.20.2/16 dev enp0s8 test:~$ sudo ip link set enp0s8 up test:~$ ping 172.16.10.1 test:~$ ipcalc 172.16.20.2 Address: 172.16.20.2 10101100.00010000.00010100.00000010 Netmask: 255.255.255.0 = 24 11111111.11111111.11111111.00000000 Wildcard: 0.0.0.255 00000000.00000000.00000000.11111111 => Network: 172.16.20.0/24 10101100.00010000.00010100.00000000 HostMin: 172.16.20.1 10101100.00010000.00010100.00000001 HostMax: 172.16.20.254 10101100.00010000.00010100.11111110 Broadcast: 172.16.20.255 10101100.00010000.00010100.11111111 Hosts/Net: 254 Class B, Private Internet **Capture Analysis** * Wireshark shows successful ICMP ping between ``172.16.10.1`` and ``172.16.20.2``. * Important details: - Source: ``172.16.10.1`` → Destination: ``172.16.20.2`` - Detected netmask: ``255.255.0.0 (/16)`` - Echo Reply confirms same Class B network. .. note:: * In Class B, the **first two octets** define the network (``172.16.x.x``). * Both ``172.16.10.1`` and ``172.16.20.2`` fall in the same network ``172.16.0.0/16``. :download:`Download Wireshark Capture ` **Test 3 — Class C Addressing** * Objective: Verify Class C uses the first three octets as the Network ID. **Laptop 1 Setup** .. code-block:: shell test:~$ sudo ip addr add 192.168.10.1/24 dev enp0s8 test:~$ sudo ip link set enp0s8 up test:~$ ping 192.168.10.2 PING 192.168.10.2 (192.168.10.2) 56(84) bytes of data. 64 bytes from 192.168.10.2: icmp_seq=1 ttl=64 time=0.989 ms 64 bytes from 192.168.10.2: icmp_seq=2 ttl=64 time=1.05 ms 64 bytes from 192.168.10.2: icmp_seq=3 ttl=64 time=1.06 ms ^C --- 192.168.10.2 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 4029ms test:~$ ipcalc 192.168.10.1 Address: 192.168.10.1 11000000.10101000.00001010.00000001 Netmask: 255.255.255.0 = 24 11111111.11111111.11111111.00000000 Wildcard: 0.0.0.255 00000000.00000000.00000000.11111111 => Network: 192.168.10.0/24 11000000.10101000.00001010.00000000 HostMin: 192.168.10.1 11000000.10101000.00001010.00000001 HostMax: 192.168.10.254 11000000.10101000.00001010.11111110 Broadcast: 192.168.10.255 11000000.10101000.00001010.11111111 Hosts/Net: 254 Class C, Private Internet **Laptop 2 Setup** .. code-block:: shell test:~$ sudo ip addr add 192.168.10.2/24 dev enp0s8 test:~$ sudo ip link set enp0s8 up test:~$ ping 192.168.10.1 PING 192.168.10.1 (192.168.10.1) 56(84) bytes of data. 64 bytes from 192.168.10.1: icmp_seq=1 ttl=64 time=0.840 ms 64 bytes from 192.168.10.1: icmp_seq=2 ttl=64 time=0.660 ms 64 bytes from 192.168.10.1: icmp_seq=3 ttl=64 time=0.731 ms ^C --- 192.168.10.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 4073ms test:~$ ipcalc 192.168.10.2 Address: 192.168.10.2 11000000.10101000.00001010.00000010 Netmask: 255.255.255.0 = 24 11111111.11111111.11111111.00000000 Wildcard: 0.0.0.255 00000000.00000000.00000000.11111111 => Network: 192.168.10.0/24 11000000.10101000.00001010.00000000 HostMin: 192.168.10.1 11000000.10101000.00001010.00000001 HostMax: 192.168.10.254 11000000.10101000.00001010.11111110 Broadcast: 192.168.10.255 11000000.10101000.00001010.11111111 Hosts/Net: 254 Class C, Private Internet **Capture Analysis** * ICMP Echo Requests from ``192.168.10.1`` to ``192.168.10.2`` are observed. * Wireshark shows: - Protocol: ICMP - Network range: ``192.168.10.0/24`` * HostMin/HostMax match ``ipcalc`` output. .. note:: * Class C networks are commonly used in LANs. * Since the **first three octets** form the network ID, both IPs must be identical up to ``192.168.10``. :download:`Download Wireshark Capture ` .. _Classful_Addressing_step6: .. tab-set:: .. tab-item:: Classful_Addressing Protocol Packet Details * packet details .. _Classful_Addressing_step7: .. tab-set:: .. tab-item:: Classful_Addressing Usecases * usecases .. _Classful_Addressing_step8: .. tab-set:: .. tab-item:: Classful_Addressing Basic Features **Classful Addressing (Legacy) - Testcases** .. csv-table:: :file: ./IPv4_Addressing_Classful_Addressing/IPv4_Feature11_Classful_Addressing_Legacy_TestCases.csv :widths: 10,10,30,20 :header-rows: 1 .. _Classful_Addressing_step17: .. tab-set:: .. tab-item:: Reference links * Reference links