Facebook Pixel

Introduction to IP Addressing

Every device on a network requires a unique logical address to send and receive data. In IPv4, this is a 32 bit number.

To make it readable for humans, we use dotted decimal notation where the 32 bits are split into four 8 bit groups called octets, separated by dots. For example, the binary sequence 11000000.10101000.00000001.00001010 is written as 192.168.1.10.

Part A: Classful Addressing

Classful addressing was the original architecture used to allocate IP addresses. The entire global pool of addresses was rigidly divided into five fixed categories: Class A, B, C, D, and E.

The specific class of an IP address dictated exactly how many bits were reserved for identifying the Network and how many were reserved for identifying the Host.

The Five Address Classes

  • Class A: Designed for gigantic networks. The first bit is always 0. It uses 8 bits for the network ID and 24 bits for the host ID, allowing over 16 million hosts per network. Range: 0 to 127. Example: 10.0.0.1
  • Class B: Designed for medium to large networks. The first two bits are 10. It uses 16 bits for the network ID and 16 bits for the host ID, allowing 65,534 hosts. Range: 128 to 191. Example: 172.16.5.4
  • Class C: Designed for small networks. The first three bits are 110. It uses 24 bits for the network ID and 8 bits for the host ID, allowing only 254 hosts. Range: 192 to 223. Example: 192.168.1.5
  • Class D: Reserved strictly for Multicast groups where data is sent to multiple subscribers simultaneously. Range: 224 to 239.
  • Class E: Reserved strictly for experimental and research purposes. Range: 240 to 255.

Important Addressing Rules

  • Host ID Rules: A host ID consisting of all 0s represents the network itself and cannot be assigned to a device. A host ID of all 1s is reserved for the broadcast address.
  • Special IP Ranges: The range 127.0.0.0 is strictly reserved for loopback testing to check if the local network stack is functioning. The address 0.0.0.0 represents the current network during device initialization.

Problems with Classful Addressing

While simple, classful addressing caused a massive global shortage of IP addresses. If an organization needed exactly 300 IP addresses, a Class C block (254 hosts) was too small. They were forced to acquire a Class B block (65,534 hosts), wasting over 65,000 addresses entirely.

Furthermore, because every fixed class required its own separate routing entry, core internet routers suffered from dangerously massive routing tables.

Part B: Classless Addressing (CIDR)

To solve the wastage crisis, Classless Inter Domain Routing (CIDR) was introduced. It completely destroyed the rigid class boundaries. Instead of fixed blocks, IP addresses are allocated in variable sizes based precisely on actual requirements.

The Prefix Length Notation

In classless addressing, an IP address is accompanied by a prefix length indicated by a forward slash. For example, in the address 192.168.1.0/28, the /28 dictates that exactly the first 28 bits belong to the network portion, leaving precisely 4 bits for the host portion.

Subnetting and Masks

Subnetting is the practice of splitting a large IP block into smaller, highly efficient sub networks. This relies on a Subnet Mask, which is a 32 bit value where continuous 1s represent the network bits and 0s represent the host bits.

When a router performs a mathematical bitwise AND operation between an IP address and its subnet mask, the result perfectly extracts the Network Address.

Subnetting Example Calculation

  • Scenario: We are given the block 192.168.1.0/28.
  • Find Subnet Mask: 28 network bits and 4 host bits yields a binary mask of twenty eight 1s and four 0s. In decimal, this translates directly to 255.255.255.240.
  • Find Usable Hosts: With 4 host bits, we calculate 2 to the power of 4, minus 2 (for network and broadcast). This gives exactly 14 usable hosts per subnet.
  • Find Broadcast Address: By changing all 4 host bits to 1, we calculate the broadcast address as 192.168.1.15.

Classful vs Classless Addressing

FeatureClassful AddressingClassless Addressing (CIDR)
FlexibilityRigid and entirely inflexible.Highly flexible variable sizes.
Address WastageMassive wastage due to fixed blocks.Extremely minimal wastage.
Subnet MaskStrictly fixed per Class (A, B, or C).Variable based entirely on the prefix slash notation.
Routing TablesMassive and highly inefficient.Smaller due to route aggregation and supernetting.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.