Introduction to IPv4

Nerd Cafe | نرد کافه

1. What is IPv4?

  • IPv4 addresses are 32 bits long, normally written as 4 octets in dotted decimal: a.b.c.d (each octet 0–255).

  • Example: 192.168.1.10 = four 8-bit numbers.

2. IPv4 Address Classes

To organize networks efficiently, IPv4 addresses were historically divided into classes. These classes help define the network portion and host portion of the address. Here’s a breakdown:

Class
First Octet Range
Default Mask
Host Bits
Hosts per Network
Special Use

A

0 – 127

255.0.0.0

N=8, H=24

~16.7 million

Very large networks

B

128 – 191

255.255.0.0

N=16, H=16

65,534

Medium networks

C

192 – 223

255.255.255.0

N=24, H=8

254

Small networks

D

224 – 239

N/A

Reserved

-

Multicast traffic

E

240 – 255

N/A

Reserved

-

Experimental / research

3. Binary Refresher (Bit Weights)

Each octet has 8 bit positions with weights:

128 64 32 16 8 4 2 1 (left to right).

To convert a decimal octet to binary: subtract the largest weight that fits, mark a 1, continue.

Example: Convert 192 to binary (digit-by-digit):

  • Start with 192.

  • 192 ≥ 128 → take 128. remainder = 192 − 128 = 64 → bit1 = 1.

  • 64 ≥ 64 → take 64. remainder = 64 − 64 = 0 → bit2 = 1.

  • Remaining weights (32,16,8,4,2,1) are all > 0 remainder → bits = 0.

  • So binary = 11000000.

4. The Network vs Host Concept

IPv4 addresses are divided into:

  1. Network portion – identifies the network.

  2. Host portion – identifies the device (host) on that network.

Which bits are network and which are host depends on the subnet mask. Subnet masks look like this:

Or in binary:

  • The 1s cover the network bits.

  • The 0s cover the host bits.

💖 Support Our Work

If you find this post helpful and would like to support my work, you can send a donation via TRC-20 (USDT). Your contributions help us keep creating and sharing more valuable content.

Thank you for your generosity! 🙏

Keywords

Network IP , Broadcast IP , First IP (usable) , Last IP (usable) , Number of available IPs (hosts) , Subnet mask , Nerd Cafe , نرد کافه

Channel Overview

🌐 Website: www.nerd-cafe.ir

📺 YouTube: @nerd-cafe

🎥 Aparat: nerd_cafe

📌 Pinterest: nerd_cafe

📱 Telegram: @nerd_cafe

📝 Blog: Nerd Café on Virgool

💻 GitHub: nerd-cafe

Last updated