IPv4 Protocol Overview
Internet Protocol version 4 — the foundation of modern networking
📋 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
⚙️ Key Header Fields
| Field | Size | Purpose |
|---|---|---|
| Version | 4b | Always 4 for IPv4 |
| IHL | 4b | Header length in 32-bit words |
| Total Length | 16b | Entire packet size (max 65535) |
| TTL | 8b | Hop count before discard |
| Protocol | 8b | TCP=6, UDP=17, ICMP=1 |
| Checksum | 16b | Header error detection |
| Src IP | 32b | Sender's IP address |
| Dst IP | 32b | Receiver'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.
🔄 Interactive Binary Converter
🎯 Special IPv4 Addresses
| Address | Purpose |
|---|---|
| 0.0.0.0 | This host (used in DHCP) |
| 127.0.0.1 | Loopback / localhost |
| 169.254.x.x | APIPA (link-local) |
| 10.x.x.x | Private Class A |
| 172.16–31.x.x | Private Class B |
| 192.168.x.x | Private Class C |
| 255.255.255.255 | Limited broadcast |
| 224.0.0.0–239.x | Multicast range |
📏 Octet Value Weights
Each bit position in an octet carries a specific positional value (power of 2):
Network Classes
Classful addressing: the original IPv4 organization scheme
📏 IPv4 Class Range Ruler (First Octet 0–255)
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 Mask | Networks | Hosts/Network | 1st Octet Range |
|---|---|---|---|
| 255.0.0.0 (/8) | 126 | 16,777,214 | 1 – 126 |
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 Mask | Networks | Hosts/Network | 1st Octet Range |
|---|---|---|---|
| 255.255.0.0 (/16) | 16,384 | 65,534 | 128 – 191 |
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 Mask | Networks | Hosts/Network | 1st Octet Range |
|---|---|---|---|
| 255.255.255.0 (/24) | 2,097,152 | 254 | 192 – 223 |
Class D — Multicast
Leading bit pattern: 1110xxxx. Reserved for multicast groups. Not assigned to individual hosts.
224.0.0.0 – 239.255.255.255Class 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
🎯 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!
📋 Answer History 0 questions
Your answer history will appear here.
🔒 Private Address Ranges (RFC 1918)
| Class | Range | CIDR | Total Hosts | Typical Use |
|---|---|---|---|---|
| Class A | 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | 16,777,214 | Large enterprise / ISP backbone |
| Class B | 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | 1,048,574 | Mid-size corporate networks |
| Class C | 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | 65,534 | Home / SOHO networks |
🚫 Other Reserved Ranges
| Range | Purpose |
|---|---|
| 0.0.0.0/8 | This network (DHCP source) |
| 100.64.0.0/10 | Shared address space (CGN) |
| 127.0.0.0/8 | Loopback (localhost) |
| 169.254.0.0/16 | APIPA (link-local) |
| 192.0.0.0/24 | IETF Protocol Assignments |
| 192.0.2.0/24 | TEST-NET-1 (documentation) |
| 198.51.100.0/24 | TEST-NET-2 (documentation) |
| 203.0.113.0/24 | TEST-NET-3 (documentation) |
| 224.0.0.0/4 | Multicast (Class D) |
| 240.0.0.0/4 | Reserved/Experimental (Class E) |
| 255.255.255.255/32 | Limited 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
📋 Subnet Mask Reference Table
| CIDR | Subnet Mask | Wildcard | Addresses | Usable Hosts | Class 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.
📤 Types of Broadcasts
| Type | Address | Scope |
|---|---|---|
| Limited Broadcast | 255.255.255.255 | Local subnet only (not routed) |
| Directed Broadcast | Network + all-1s host | Specific remote subnet |
| Subnet Broadcast | Last address in subnet | All hosts in subnet |
| Network Broadcast | 192.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
First host: Network address + 1 (host bits = ...0001)
Last host: Broadcast address − 1 (host bits = ...1110)
🔢 Host Range Calculator
📊 Hosts per Prefix Reference
| CIDR | Host Bits | Total | Usable | Common Use |
|---|---|---|---|---|
| /30 | 2 | 4 | 2 | Point-to-point links |
| /29 | 3 | 8 | 6 | Small office |
| /28 | 4 | 16 | 14 | Small department |
| /27 | 5 | 32 | 30 | Department/VLAN |
| /26 | 6 | 64 | 62 | Medium VLAN |
| /25 | 7 | 128 | 126 | Large department |
| /24 | 8 | 256 | 254 | Standard LAN |
| /23 | 9 | 512 | 510 | Large LAN |
| /22 | 10 | 1,024 | 1,022 | Campus segment |
| /16 | 16 | 65,536 | 65,534 | Class B default |
| /8 | 24 | 16.7M | 16,777,214 | Class 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.
Outside: 203.0.113.5
📋 Types of NAT 3 Types
| Type | Mapping | Use Case |
|---|---|---|
| Static NAT | 1:1 permanent | Servers needing fixed public IP |
| Dynamic NAT | 1:1 from pool | Large orgs with IP pool |
| PAT/NAT Overload | Many:1 (ports) | Home/SOHO — most common |
✅ NAT Advantages & ⚠️ Limitations
| Advantage | Limitation |
|---|---|
| Conserves public IPs | Breaks end-to-end connectivity |
| Hides internal topology | Complicates some protocols (SIP, FTP) |
| Security through obscurity | Adds translation overhead |
| Easy internal renumbering | Complicates 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 : Port | External IP : Port | Destination |
|---|---|---|
| 192.168.1.10:1024 | 203.0.113.5:10001 | 8.8.8.8:80 |
| 192.168.1.11:1025 | 203.0.113.5:10002 | 8.8.8.8:80 |
| 192.168.1.12:1026 | 203.0.113.5:10003 | 93.184.216.34:443 |
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 Aggregation (Supernetting)
CIDR enables route summarization — combining multiple contiguous networks into one route entry to reduce routing table size.
✂️ VLSM — Variable Length Subnet Masking
VLSM lets you allocate differently-sized subnets from the same address space — allocating exactly what each segment needs.
📊 Complete CIDR Reference Chart
| CIDR | Subnet Mask | Wildcard Mask | Total IPs | Usable Hosts | Class Note |
|---|
🧮 CIDR Notation Converter
Test Your Knowledge
20 questions covering all IPv4 topics