Computer Networks Essentials / Network Layer

IPv4 Addressing

🤔 What is IPv4 Addressing? (Basic Idea)

To communicate over a network, every device must have an address.

📌 At the Network Layer, this address is called an IP address.

👉 IPv4 (Internet Protocol version 4) is the most widely used addressing scheme on the Internet and local networks.


🧠 Simple Definition

📌 IPv4 addressing is a method of identifying devices on a network using 32-bit logical addresses written in dotted decimal format.


🔢 Structure of an IPv4 Address

🔹 Key Points

  • Length: 32 bits

  • Divided into 4 parts (octets)

  • Each octet = 8 bits

  • Total values per octet: 0–255

📌 Written as:

A.B.C.D

👉 Example:

192.168.1.10


🧠 Binary Representation

IP Address: 192.168.1.10

  • 192 → 11000000

  • 168 → 10101000

  • 1 → 00000001

  • 10 → 00001010

📌 Total = 32 bits


🧩 Two Parts of an IPv4 Address

An IPv4 address is divided into:

1️⃣ Network ID

2️⃣ Host ID


🌍 Network ID

  • Identifies the network

  • Same for all devices in that network

🖥️ Host ID

  • Identifies the specific device

  • Unique within the network

📌 Routers use Network ID to forward packets.


🧠 Why Divide IP Address Like This?

Think of a postal address 📮:

  • Country + City + Area → Network ID

  • House Number → Host ID

👉 Same logic is used in IPv4 addressing.


🏷️ Classful IPv4 Addressing

IPv4 addresses are traditionally divided into five classes:

  • Class A

  • Class B

  • Class C

  • Class D

  • Class E

📌 This classification is based on first octet value.


📊 IPv4 Address Classes (Overview Table)

Class

Range (1st Octet)

Network Bits

Host Bits

Usage

A

1 – 126

8

24

Very large networks

B

128 – 191

16

16

Medium networks

C

192 – 223

24

8

Small networks

D

224 – 239

–

–

Multicast

E

240 – 255

–

–

Experimental


🅰️ Class A Addressing

🔹 Characteristics

  • First octet: 1–126

  • Format: N.H.H.H

  • Network bits: 8

  • Host bits: 24

📌 Example:

10.20.30.40

🧠 Capacity

  • Networks: 126

  • Hosts per network: 16,777,214

📌 Used by large organizations.


🅱️ Class B Addressing

🔹 Characteristics

  • First octet: 128–191

  • Format: N.N.H.H

  • Network bits: 16

  • Host bits: 16

📌 Example:

172.16.5.10

🧠 Capacity

  • Networks: 16,384

  • Hosts per network: 65,534

📌 Used by universities & mid-size companies.


🅲 Class C Addressing

🔹 Characteristics

  • First octet: 192–223

  • Format: N.N.N.H

  • Network bits: 24

  • Host bits: 8

📌 Example:

192.168.1.10

🧠 Capacity

  • Networks: 2,097,152

  • Hosts per network: 254

📌 Most common in LANs.


🅳 Class D Addressing (Multicast)

🔹 Characteristics

  • Range: 224–239

  • Used for multicast communication

  • No network/host division

📌 Example:

  • Video streaming

  • Online broadcasting


🅴 Class E Addressing (Experimental)

🔹 Characteristics

  • Range: 240–255

  • Reserved for research & experiments

  • Not used publicly


🚫 Special IPv4 Addresses

🔹 Loopback Address

  • 127.0.0.1

  • Refers to your own system

📌 Used for testing.

🔹 Network Address

  • Host bits all 0

  • Identifies the network

🔹 Broadcast Address

  • Host bits all 1

  • Sends data to all devices in network


🔐 Private IPv4 Address Ranges

Class

Private Range

A

10.0.0.0 – 10.255.255.255

B

172.16.0.0 – 172.31.255.255

C

192.168.0.0 – 192.168.255.255

📌 Used inside LANs

📌 Not routable on Internet


🌍 Public IPv4 Addresses

  • Globally unique

  • Assigned by ISP

  • Used for Internet communication


⚠️ Limitation of IPv4

  • Total addresses ≈ 4.3 billion

  • Internet growth exhausted addresses ❌

  • Led to creation of IPv6

📌 Still, IPv4 is widely used today.


⭐ One-Line Summary

🔹 IPv4 addressing uses 32-bit logical addresses divided into classes to uniquely identify devices and enable routing across networks.