Skip to Content

Understanding IPv4 Addressing

What are IPv4 Classes?"

How Does Subnetting Work in IPv4?

Subnetting Example for Class C


Subnetting example for IPv4 network design


IPv4: Classes and Subnetting

1. IPv4 Classes

IPv4 (Internet Protocol version 4) is the fourth version of the Internet Protocol (IP) and is used to identify devices on a network through an address system.

IPv4 addresses are categorized into different classes. These classes are primarily used to identify different network ranges for private and public use. An IPv4 address consists of 32 bits, which are usually written in dotted decimal format (e.g., 192.168.1.1), and divided into four octets (8 bits each).

Here are the primary IPv4 address classes:

Key Notes:

  • Class A: Supports up to 16 million hosts per network.
  • Class B: Supports up to 65,000 hosts per network.
  • Class C: Supports up to 254 hosts per network.
  • Class D: Used for multicast.
  • Class E: Reserved for future use or research.

2. Subnetting

Subnetting is the process of dividing a large network into smaller, more manageable sub-networks or subnets. This helps in efficient use of IP addresses, network management, and security.

Subnet Mask:

A subnet mask determines which part of the IP address represents the network and which part represents the host. The subnet mask is written in dotted decimal format (e.g., 255.255.255.0), where 255 corresponds to bits representing the network part, and 0 represents bits allocated to hosts.

IPv4 Class A, B, C network diagram
  • Class A default mask: 255.0.0.0 or /8
  • Class B default mask: 255.255.0.0 or /16
  • Class C default mask: 255.255.255.0 or /24

Subnetting Process:

  1. Identify the Network: First, determine the class of the IP address.
  2. Determine Required Subnets: Based on how many subnets are needed, choose the number of bits to borrow from the host part of the IP address.
  3. Calculate Subnet Mask: The borrowed bits are added to the default subnet mask, extending the network portion.
  4. Subnet Calculation: Use the new subnet mask to calculate the range of IP addresses in each subnet.

Example of Subnetting in Class C:

Suppose you are working with the IP address 192.168.1.0/24 and want to divide it into 4 subnets.

  • Step 1: Start with a /24 mask (255.255.255.0).
  • Step 2: Borrow 2 bits from the host part to create 4 subnets (2^2 = 4).
  • Step 3: New subnet mask will be /26 (255.255.255.192).
  • Step 4: The subnets are:
    • 192.168.1.0/26 → 192.168.1.0 - 192.168.1.63
    • 192.168.1.64/26 → 192.168.1.64 - 192.168.1.127
    • 192.168.1.128/26 → 192.168.1.128 - 192.168.1.191
    • 192.168.1.192/26 → 192.168.1.192 - 192.168.1.255


3. CIDR (Classless Inter-Domain Routing)

CIDR is a more flexible method for IP addressing and routing, introduced to improve the efficiency of IP address usage. CIDR notation represents an IP address followed by a slash (/) and the number of bits used for the network portion (e.g., 192.168.1.0/24).

CIDR allows for more granular control over the network size than traditional class-based subnetting, enabling the allocation of IP addresses based on the required number of hosts rather than rigid class boundaries.

Summary

  • IPv4 Classes: Class A, B, and C are for unicast, Class D for multicast, and Class E is reserved for experimental purposes.
  • Subnetting: Divides networks into smaller sub-networks to manage resources better. It involves using subnet masks to separate the network and host portions of an IP address.
  • CIDR: A flexible way of specifying IP address ranges that removes the limitations of traditional class-based addressing.