IPv4 Addressing & Classes

Nerd Cafe

16,384 (2¹⁴)1. Introduction to IPv4

IPv4 (Internet Protocol version 4) is the fourth version of the Internet Protocol, and it is the most widely used protocol for identifying devices on a network. IPv4 uses a 32-bit address, which is expressed as four octets (8-bit values) separated by dots (.).

Example of an IPv4 Address:

192.168.1.1

Each octet is represented in decimal form and ranges from 0 to 255 (since 8-bit binary numbers range from 00000000 to 11111111 in binary, which equals 0 to 255 in decimal).

2. IPv4 Addressing Format

An IPv4 address consists of two parts:

  1. Network Portion – Identifies the network to which the device belongs.

  2. Host Portion – Identifies a specific device (host) within the network.

The separation between the network and host portions depends on the subnet mask.

3. IPv4 Address Classes

IPv4 addresses are divided into five classes (A, B, C, D, E) based on their first octet. Each class has different network and host allocations.

Class
First Octet Range
Default Subnet Mask
Networks Available
Hosts per Network
Purpose

A

1 - 126

255.0.0.0

128 (2⁷ - 2)

16,777,214 (2²⁴ - 2)

Large networks (e.g., ISPs, big enterprises)

B

128 - 191

255.255.0.0

16,384 (2¹⁴)

65,534 (2¹⁶ - 2)

Medium-sized businesses and organizations

C

192 - 223

255.255.255.0

2,097,152 (2²¹)

254 (2⁸ - 2)

Small businesses and local networks

D

224 - 239

N/A

N/A

N/A

Multicast groups (not used for host addressing)

E

240 - 255

N/A

N/A

N/A

Experimental use (Reserved by IETF)

Note:

  • The first octet range 127 is reserved for loopback addresses (e.g., 127.0.0.1 is used for local testing).

  • The subnet mask helps define the boundary between the network and host portions.

4. Binary Representation of IPv4 Addresses

Each octet in an IPv4 address is an 8-bit binary number.

Example: Convert 192.168.1.1 into Binary:

  1. Convert each octet into an 8-bit binary format:

    • 19211000000

    • 16810101000

    • 100000001

    • 100000001

Thus,

This binary format is useful for subnetting, CIDR notation, and routing decisions.

5. Private vs Public IPv4 Addresses

IPv4 addresses are categorized into public and private ranges.

Private IPv4 Address Ranges (RFC 1918)

Class
Private IP Range
CIDR Notation
Total IPs

A

10.0.0.0 – 10.255.255.255

10.0.0.0/8

16,777,216

B

172.16.0.0 – 172.31.255.255

172.16.0.0/12

1,048,576

C

192.168.0.0 – 192.168.255.255

192.168.0.0/16

65,536

  • Private IPs are used inside organizations and home networks and are not routable on the public internet.

  • Public IPs are assigned by ISPs and used to connect to the internet.

6. IPv4 Addressing Practical Lab

Let’s perform a practical IPv4 addressing scenario.

Scenario:

You are given the network 192.168.10.0/24. You need to assign IPv4 addresses to 5 devices.

Topology

Steps:

  1. Identify Network Address: 192.168.10.0

  2. Identify Subnet Mask: 255.255.255.0

  3. Find Usable Host IP Range: 192.168.10.1 – 192.168.10.254

  4. Assign IPs to Devices:

    • Router: 192.168.10.1

    • PC1: 192.168.10.10

    • PC2: 192.168.10.20

    • Server: 192.168.10.30

    • Printer: 192.168.10.40

  5. Broadcast Address: 192.168.10.255

  6. Validation: Use the ping command to test connectivity.

R1 Configuration

PC1 Configuration

PC2 Configuration

Server Configiration

Printer Configuration

Connectivity Tests

7. Configuring IPv4 Address in Windows/Linux

Windows:

  • Open Command Prompt (cmd).

  • Type:

This shows current IP settings.

  • To set an IPv4 address manually:

  • 192.168.10.10 → IP Address

  • 255.255.255.0 → Subnet Mask

  • 192.168.10.1 → Default Gateway

Linux:

  1. Open Terminal.

  2. Check current IP:

or

  • Assign an IPv4 address manually:

or

8. Summary

  • IPv4 uses a 32-bit address and is represented in decimal form.

  • It is divided into five classes (A, B, C, D, E).

  • Private IPv4 addresses are used for internal networks.

  • Subnet masks determine the network/host boundary.

  • IPv4 can be configured using Windows (netsh) or Linux (ifconfig/ip).

  • Practical IPv4 addressing is essential for networking professionals.

Keywords

IPv4 addressing, IP classes, subnet mask, network portion, host portion, Class A, Class B, Class C, Class D, Class E, private IP, public IP, CIDR notation, binary representation, loopback address, default gateway, IP configuration, DHCP, static IP, IP routing, نتورک پلاس

Last updated