🌐

IPv4 Network Protocol Learning Simulator

Moraine Valley Community College — Cybersecurity & Networking Education

🌐

IPv4 Protocol Overview

Internet Protocol version 4 — the foundation of modern networking

32
Address Bits
4.3B
Total Addresses
1981
RFC 791 Year
4
Octets (Bytes)
TTL
Header Field
20
Min Header Bytes

📋 What is IPv4?

IPv4 (Internet Protocol version 4) is the fourth version of the Internet Protocol and the first version deployed for production on ARPANET in 1983. It is a connectionless protocol for use on packet-switched networks and operates as a best-effort delivery model.

IPv4 uses 32-bit addresses, limiting the address space to 4,294,967,296 (2³²) unique addresses. Due to growing demand, address exhaustion led to the development of techniques like NAT and CIDR, and eventually IPv6.

📦 IPv4 Header Structure

Version4b
IHL4b
DSCP/ECN8b
Total Length16b
Identification16b
Flags3b
Fragment Offset13b
TTL8b
Protocol8b
Header Checksum16b
Source IP Address32 bits
Destination IP Address32 bits
Options (if IHL > 5) + Data Payload

⚙️ Key Header Fields

FieldSizePurpose
Version4bAlways 4 for IPv4
IHL4bHeader length in 32-bit words
Total Length16bEntire packet size (max 65535)
TTL8bHop count before discard
Protocol8bTCP=6, UDP=17, ICMP=1
Checksum16bHeader error detection
Src IP32bSender's IP address
Dst IP32bReceiver's IP address

🔑 Core Concepts for Network Administrators

  • IP Addressing: Every device on a network must have a unique IP address to communicate.
  • Subnetting: Divides large networks into smaller, manageable subnetworks to improve performance and security.
  • Subnet Mask: Determines which portion of an IP address identifies the network vs. the host.
  • Default Gateway: The router address used when a packet's destination is not on the local subnet.
  • CIDR: Classless Inter-Domain Routing replaces classful addressing for flexible prefix lengths.
  • NAT: Network Address Translation allows private addresses to communicate through public internet.
  • Broadcast: Packets sent to all devices on a network segment simultaneously.
  • Loopback (127.0.0.1): Used to test the local IP stack without sending packets over the network.
🔢

IPv4 Address Structure

Understanding 32-bit addressing, octets, and binary representation

📐 Address Anatomy

An IPv4 address is a 32-bit number written in dotted-decimal notation as four octets (8-bit groups), each ranging from 0–255.

192Network
.
168Network
.
1Subnet
.
100Host
Decimal
192 . 168 . 1 . 100
Binary

🔄 Interactive Binary Converter

🎯 Special IPv4 Addresses

AddressPurpose
0.0.0.0This host (used in DHCP)
127.0.0.1Loopback / localhost
169.254.x.xAPIPA (link-local)
10.x.x.xPrivate Class A
172.16–31.x.xPrivate Class B
192.168.x.xPrivate Class C
255.255.255.255Limited broadcast
224.0.0.0–239.xMulticast range

📏 Octet Value Weights

Each bit position in an octet carries a specific positional value (power of 2):

1
128
1
64
0
32
0
16
0
8
0
4
0
2
0
1
Example: 11000000 = 128 + 64 = 192
📊

Network Classes

Classful addressing: the original IPv4 organization scheme

Tip: The first octet of an IPv4 address is all you need to determine its class. Memorize the boundary values: 1–126 = A, 128–191 = B, 192–223 = C, 224–239 = D, 240–255 = E.

📏 IPv4 Class Range Ruler (First Octet 0–255)

1–126
127
128–191
192–223
224–239
240–255
064128192224240255
A

Class A — Large Networks

Leading bit pattern: 0xxxxxxx. Network portion: first octet only. Host portion: last 3 octets.

1.0.0.0 – 126.255.255.255 127.x.x.x (Loopback — reserved)
Default MaskNetworksHosts/Network1st Octet Range
255.0.0.0 (/8)12616,777,2141 – 126
B

Class B — Medium Networks

Leading bit pattern: 10xxxxxx. Network portion: first two octets. Host portion: last 2 octets.

128.0.0.0 – 191.255.255.255
Default MaskNetworksHosts/Network1st Octet Range
255.255.0.0 (/16)16,38465,534128 – 191
C

Class C — Small Networks

Leading bit pattern: 110xxxxx. Network portion: first three octets. Host portion: last octet only.

192.0.0.0 – 223.255.255.255
Default MaskNetworksHosts/Network1st Octet Range
255.255.255.0 (/24)2,097,152254192 – 223
D

Class D — Multicast

Leading bit pattern: 1110xxxx. Reserved for multicast groups. Not assigned to individual hosts.

224.0.0.0 – 239.255.255.255
E

Class E — Experimental

Leading bit pattern: 1111xxxx. Reserved by IANA for research. Not routed on public internet.

240.0.0.0 – 255.255.255.254

🌳 Class Identification Decision Tree

Look at the FIRST OCTET value:
├─ 1–126    → Class A  (default mask /8)
├─ 127      → Loopback  (reserved, not routed)
├─ 128–191Class B  (default mask /16)
├─ 192–223Class C  (default mask /24)
├─ 224–239Class D  (multicast)
└─ 240–255Class E  (experimental)

🎯 Class Identification Challenge

A random IPv4 address will be displayed. Identify its class by clicking the correct button. The first octet is your key clue!

0
Correct
0
Incorrect
0
Streak 🔥
Accuracy
What class is this IPv4 address?
—.—.—.—

📋 Answer History 0 questions

Your answer history will appear here.

RFC 1918 defines three blocks of address space for private internets. These addresses are not routed on the public internet and require NAT to communicate externally.

🔒 Private Address Ranges (RFC 1918)

ClassRangeCIDRTotal HostsTypical Use
Class A10.0.0.0 – 10.255.255.25510.0.0.0/816,777,214Large enterprise / ISP backbone
Class B172.16.0.0 – 172.31.255.255172.16.0.0/121,048,574Mid-size corporate networks
Class C192.168.0.0 – 192.168.255.255192.168.0.0/1665,534Home / SOHO networks

🚫 Other Reserved Ranges

RangePurpose
0.0.0.0/8This network (DHCP source)
100.64.0.0/10Shared address space (CGN)
127.0.0.0/8Loopback (localhost)
169.254.0.0/16APIPA (link-local)
192.0.0.0/24IETF Protocol Assignments
192.0.2.0/24TEST-NET-1 (documentation)
198.51.100.0/24TEST-NET-2 (documentation)
203.0.113.0/24TEST-NET-3 (documentation)
224.0.0.0/4Multicast (Class D)
240.0.0.0/4Reserved/Experimental (Class E)
255.255.255.255/32Limited broadcast

💡 Why Private Addresses?

  • IPv4 Exhaustion: Only ~4.3 billion public IPs exist; private ranges allow billions of internal devices to share a small pool of public IPs via NAT.
  • Security: Private addresses are not reachable from the internet by default, adding a layer of isolation.
  • Cost: Organizations don't need to purchase public IP addresses for every internal device.
  • Flexibility: Internal addressing can be freely designed without coordination with IANA.
  • RFC 1918 was published in 1996 and remains the standard today.
🧮

Subnet Mask Calculator

Calculate network addresses, host ranges, and broadcast addresses

⚙️ Interactive Subnet Calculator

/24
Network (24)
Host (8)

📋 Subnet Mask Reference Table

CIDRSubnet MaskWildcardAddressesUsable HostsClass Equiv.
📡

Broadcast Addresses

Understanding directed, limited, and subnet broadcasts

📡 What is a Broadcast Address?

A broadcast address is a special address that allows data to be sent to all devices on a network simultaneously. It is always the last address in a subnet — all host bits are set to 1.

Formula: Broadcast = Network Address OR (NOT Subnet Mask)

📤 Types of Broadcasts

TypeAddressScope
Limited Broadcast255.255.255.255Local subnet only (not routed)
Directed BroadcastNetwork + all-1s hostSpecific remote subnet
Subnet BroadcastLast address in subnetAll hosts in subnet
Network Broadcast192.168.1.255 (/24)All hosts in /24

🧮 Broadcast Calculator

🔢 Broadcast Calculation Walk-through

Enter a network address above and click Calculate to see the step-by-step binary walk-through.

💻

Host Addresses

Understanding usable host ranges and address allocation

💻 Host Address Rules

Usable Hosts = 2ⁿ − 2 where n = number of host bits. We subtract 2 for the network address (all 0s) and broadcast address (all 1s).

First host: Network address + 1 (host bits = ...0001)

Last host: Broadcast address − 1 (host bits = ...1110)

Example: 192.168.1.0/24
Network: 192.168.1.0
First Host: 192.168.1.1
Last Host: 192.168.1.254
Broadcast: 192.168.1.255
Usable: 2⁸ - 2 = 254 hosts

🔢 Host Range Calculator

📊 Hosts per Prefix Reference

CIDRHost BitsTotalUsableCommon Use
/30242Point-to-point links
/29386Small office
/2841614Small department
/2753230Department/VLAN
/2666462Medium VLAN
/257128126Large department
/248256254Standard LAN
/239512510Large LAN
/22101,0241,022Campus segment
/161665,53665,534Class B default
/82416.7M16,777,214Class A default
🔄

Network Address Translation (NAT)

Conserving IPv4 addresses by mapping private to public IPs

🔄 How NAT Works

NAT (RFC 3022) translates private IP addresses in packet headers as packets pass through a router. This allows multiple internal hosts to share a single public IP address.

🖥️ Host A
192.168.1.10
🖥️ Host B
192.168.1.11
🖥️ Host C
192.168.1.12
Private
→ Router
🔄 NAT Router
Inside: 192.168.1.1
Outside: 203.0.113.5
Public
→ Internet
🌐 Internet
Sees: 203.0.113.5

📋 Types of NAT 3 Types

TypeMappingUse Case
Static NAT1:1 permanentServers needing fixed public IP
Dynamic NAT1:1 from poolLarge orgs with IP pool
PAT/NAT OverloadMany:1 (ports)Home/SOHO — most common

✅ NAT Advantages & ⚠️ Limitations

AdvantageLimitation
Conserves public IPsBreaks end-to-end connectivity
Hides internal topologyComplicates some protocols (SIP, FTP)
Security through obscurityAdds translation overhead
Easy internal renumberingComplicates troubleshooting

🔌 PAT (Port Address Translation) — How It Works

PAT, also called NAT Overload, uses port numbers to track multiple simultaneous connections from different internal hosts through a single public IP address.

Internal IP : PortExternal IP : PortDestination
192.168.1.10:1024203.0.113.5:100018.8.8.8:80
192.168.1.11:1025203.0.113.5:100028.8.8.8:80
192.168.1.12:1026203.0.113.5:1000393.184.216.34:443
The router maintains a NAT translation table mapping each internal {IP:Port} to a unique external {IP:Port} to correctly route return packets.
🗂️

CIDR — Classless Inter-Domain Routing

Flexible prefix-based addressing that replaced classful networking

📖 What is CIDR?

Introduced in 1993 (RFC 1519/4632), CIDR replaced classful addressing to slow IPv4 exhaustion. Instead of fixed class boundaries, CIDR uses a variable-length subnet mask (VLSM) denoted by a slash notation (e.g., /20).

CIDR Notation: 192.168.10.0/24 — The /24 means 24 bits are the network prefix, leaving 8 bits for hosts.

🔢 CIDR Aggregation (Supernetting)

CIDR enables route summarization — combining multiple contiguous networks into one route entry to reduce routing table size.

Aggregating four /24s into one /22:
192.168.0.0/24
192.168.1.0/24
192.168.2.0/24
192.168.3.0/24
= 192.168.0.0/22 (4 × /24 summarized)

✂️ VLSM — Variable Length Subnet Masking

VLSM lets you allocate differently-sized subnets from the same address space — allocating exactly what each segment needs.

From 10.1.0.0/16:
🏢 HQ LAN: 10.1.0.0/22 → 1022 hosts
🏬 Branch: 10.1.4.0/24 → 254 hosts
🔗 WAN Link: 10.1.5.0/30 → 2 hosts
🖥️ Server: 10.1.5.4/29 → 6 hosts

📊 Complete CIDR Reference Chart

CIDRSubnet MaskWildcard MaskTotal IPsUsable HostsClass Note

🧮 CIDR Notation Converter

Test Your Knowledge

20 questions covering all IPv4 topics

0
Correct
0
Answered
0%
Score