Skip to main content

IPv4 Addressing

Internet Protocol version 4 (IPv4) is the most widely deployed network protocol used to identify devices on a network.

Structure of an IPv4 Address

An IPv4 address is a 32-bit numeric address written as four numbers separated by periods. This is called "dotted-decimal notation."

Example: 192.168.1.10

Each number in the address is called an octet because it represents 8 bits.

  • Minimum value of an octet: 0 (Binary: 00000000)
  • Maximum value of an octet: 255 (Binary: 11111111)

Because it is 32 bits long, IPv4 can provide approximately 4.3 billion unique addresses ($2^32$).

Network vs. Host Portions

Every IP address is divided into two parts:

  1. Network Portion: Identifies the specific network the device belongs to.
  2. Host Portion: Identifies the specific device (host) on that network.

The Subnet Mask is what determines where the network portion ends and the host portion begins.

Subnet Masks

A subnet mask also consists of four octets. Example: 255.255.255.0

When you overlay the mask on the IP address:

  • 255 indicates that the corresponding octet in the IP address belongs to the Network portion.
  • 0 indicates that it belongs to the Host portion.

For IP 192.168.1.10 with mask 255.255.255.0:

  • Network: 192.168.1
  • Host: 10

IPv4 Classes (Historical Context)

Historically, IPv4 addresses were divided into classes. While modern networks use CIDR (Classless Inter-Domain Routing), understanding classes is still fundamental.

  • Class A:
    • Range: 1.0.0.0 to 126.255.255.255
    • Default Mask: 255.0.0.0
    • Use: Massive networks (millions of hosts).
  • Class B:
    • Range: 128.0.0.0 to 191.255.255.255
    • Default Mask: 255.255.0.0
    • Use: Medium-sized networks.
  • Class C:
    • Range: 192.0.0.0 to 223.255.255.255
    • Default Mask: 255.255.255.0
    • Use: Small networks (max 254 hosts).

(Note: 127.x.x.x is reserved for loopback/localhost).

Special IPv4 Addresses

  • Network Address: The first address in a subnet (e.g., 192.168.1.0). Identifies the network itself. Cannot be assigned to a device.
  • Broadcast Address: The last address in a subnet (e.g., 192.168.1.255). Used to send data to all devices on that network simultaneously.
  • Loopback Address: 127.0.0.1 refers to the local machine. Used for testing internal network stacks.