The TCP/IP Model: The Internet's Architectural Blueprint
Internet Layer
Read aloud is unavailable in this browser.
The Layer That Makes the Internet 'Inter'
The Internet Layer is where the 'inter' in 'Internet' comes from. While the Network Interface Layer handles communication within a single network segment, the Internet Layer enables communication across multiple, heterogeneous networks. It provides the logical addressing and routing mechanisms that allow a packet to travel from a smartphone in Tokyo, through dozens of routers, across undersea cables, and arrive at a server in Virginia—all within milliseconds.
This layer is dominated by a single, remarkably successful protocol: the Internet Protocol (IP). Originally designed in the 1970s for a research network of a few hundred hosts, IP now addresses billions of devices and handles exabytes of traffic daily. Understanding the Internet Layer is understanding the core of how the global Internet functions.
By the end of this page, you will master IP addressing for both IPv4 and IPv6, understand IP packet structure and fragmentation, comprehend how routers make forwarding decisions, explore ICMP and network diagnostics, and appreciate the design principles that enable Internet-scale routing.
Internet Layer Responsibilities
The Internet Layer's primary mission is host-to-host delivery across network boundaries. Unlike the Network Interface Layer, which only handles local delivery, the Internet Layer provides an abstraction that spans the entire global Internet. Any device with an IP address can (theoretically) communicate with any other device, regardless of the physical networks between them.
- •Logical Addressing — Provides a uniform addressing scheme (IP addresses) that uniquely identifies hosts across all networks, independent of physical hardware addresses
- •Routing — Determines the path packets take through the network, making forwarding decisions at each hop based on destination addresses and routing tables
- •Packet Forwarding — Moves packets from source to destination, potentially across many intermediate routers and diverse network technologies
- •Fragmentation and Reassembly — Handles differences in maximum packet sizes across network paths, splitting large packets when necessary
- •Error Reporting — Provides feedback about delivery problems through ICMP (Internet Control Message Protocol)
The Critical Abstraction
The Internet Layer's genius lies in its abstraction: from the Transport layer's perspective, the network between source and destination is a 'black box' that accepts packets and (usually) delivers them. The Transport layer doesn't need to know:
- How many networks are between source and destination
- What physical technologies those networks use
- What routing protocols routers are running
- Whether packets take different paths for each transmission
This abstraction enables the remarkable flexibility of the Internet: new networks can be added, old technologies can be replaced, and routing can change dynamically—all without applications being aware.
IP provides 'best-effort' delivery—packets may be lost, duplicated, delayed, or delivered out of order. The Transport layer (TCP or application protocols) handles reliability. This design choice keeps the network core simple and fast, pushing complexity to the edges where it can be tailored to application needs.
IPv4 Addressing: The 32-Bit Foundation
IPv4, specified in RFC 791 (1981), uses 32-bit addresses, providing approximately 4.3 billion unique addresses. While this seemed vast in 1981, address exhaustion became critical by the 2010s, driving the transition to IPv6. Despite this, IPv4 remains the dominant protocol on the Internet today.
Address Notation
IPv4 addresses are written in dotted-decimal notation: four decimal numbers (0-255) separated by dots, each representing one byte of the 32-bit address.
Binary: 11000000.10101000.00000001.00001010
Decimal: 192 .168 .1 .10
Network and Host Portions
Every IP address is divided into two parts:
- Network portion: Identifies the network (shared by all hosts on that network)
- Host portion: Identifies the specific host within that network
The boundary between these portions is defined by the subnet mask (or prefix length in CIDR notation).
| CIDR | Subnet Mask | Network Bits | Host Bits | Addresses |
|---|---|---|---|---|
| /24 | 255.255.255.0 | 24 | 8 | 256 (254 usable) |
| /16 | 255.255.0.0 | 16 | 16 | 65,536 (65,534 usable) |
| /8 | 255.0.0.0 | 8 | 24 | 16,777,216 |
| /25 | 255.255.255.128 | 25 | 7 | 128 (126 usable) |
| /30 | 255.255.255.252 | 30 | 2 | 4 (2 usable) |
| /32 | 255.255.255.255 | 32 | 0 | 1 (host route) |
Special IPv4 Addresses
| Address/Range | Purpose |
|---|---|
0.0.0.0/8 | This network (default route, DHCP requests) |
10.0.0.0/8 | Private addresses (RFC 1918) |
127.0.0.0/8 | Loopback (localhost) |
169.254.0.0/16 | Link-local (APIPA) |
172.16.0.0/12 | Private addresses (RFC 1918) |
192.168.0.0/16 | Private addresses (RFC 1918) |
224.0.0.0/4 | Multicast |
255.255.255.255 | Limited broadcast |
Private vs. Public Addresses
The RFC 1918 private address ranges (10.x.x.x, 172.16-31.x.x, 192.168.x.x) are not globally routable. They're used within organizations, with Network Address Translation (NAT) providing access to the public Internet. This dramatically extends IPv4's usable lifetime by allowing billions of private devices to share limited public addresses.
For quick subnet calculations: each additional prefix bit halves the address space. /24 = 256 addresses; /25 = 128; /26 = 64; /27 = 32; /28 = 16; /29 = 8; /30 = 4; /31 = 2 (point-to-point links); /32 = 1 (host route). Subtract 2 for network and broadcast addresses where applicable.
IPv6 Addressing: The 128-Bit Future
IPv6, standardized in RFC 2460 (1998) and updated in RFC 8200 (2017), uses 128-bit addresses—providing 340 undecillion (3.4 × 10³⁸) addresses. This is enough to assign trillions of addresses to every human on Earth, eliminating the address exhaustion problem and enabling end-to-end connectivity without NAT.
Address Notation
IPv6 addresses are written as eight groups of four hexadecimal digits, separated by colons:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Simplification Rules:
-
Leading zeros can be omitted in each group:
2001:db8:85a3:0:0:8a2e:370:7334 -
One sequence of consecutive all-zero groups can be replaced with
:::2001:db8:85a3::8a2e:370:7334 -
:: can only appear once to avoid ambiguity
Examples:
- Loopback:
::1(full:0000:0000:0000:0000:0000:0000:0000:0001) - IPv4-mapped:
::ffff:192.168.1.1 - Link-local:
fe80::1(automatically configured on every interface)
| Prefix | Address Type | Description |
|---|---|---|
| ::1/128 | Loopback | Equivalent to 127.0.0.1 in IPv4 |
| fe80::/10 | Link-local | Automatically configured, not routable |
| fc00::/7 | Unique Local | Private addresses (like RFC 1918) |
| 2000::/3 | Global Unicast | Globally routable addresses |
| ff00::/8 | Multicast | One-to-many delivery |
| ::ffff:0:0/96 | IPv4-mapped | IPv4 addresses embedded in IPv6 |
IPv6 Address Structure (Global Unicast)
A typical global unicast address (2000::/3) is structured:
| Bits | Component | Description |
|---|---|---|
| 48 | Global Routing Prefix | Assigned by ISP |
| 16 | Subnet ID | Organization's internal subnets |
| 64 | Interface ID | Host identifier (often EUI-64 or random) |
The 64-bit Interface ID is often derived from the MAC address using the EUI-64 method (inserting FF:FE in the middle and flipping the 7th bit), or generated randomly for privacy.
Key IPv6 Features
- No broadcast: Replaced by multicast
- No ARP: Replaced by Neighbor Discovery Protocol (NDP)
- Stateless autoconfiguration (SLAAC): Hosts can configure addresses automatically without DHCP
- Simplified header: Fixed 40-byte header, extension headers for options
- No fragmentation by routers: End hosts must use Path MTU Discovery
As of 2024, IPv6 handles approximately 40%+ of traffic for major providers like Google. Adoption varies by region—Belgium leads with 70%+, while others lag. Dual-stack (running both IPv4 and IPv6) remains the common transition mechanism, though IPv6-only networks are increasingly viable.
IP Packet Structure
The IP packet (or datagram) is the fundamental unit of communication at the Internet layer. Understanding its structure is essential for packet analysis, troubleshooting, and understanding protocol behavior.
Key IPv4 Header Fields
Version (4 bits): IP version (4 for IPv4, 6 for IPv6)
IHL (4 bits): Internet Header Length in 32-bit words. Minimum 5 (20 bytes), maximum 15 (60 bytes with options)
DSCP/ECN (8 bits): Differentiated Services and Explicit Congestion Notification for QoS
Total Length (16 bits): Entire packet size including header and data. Maximum 65,535 bytes
Identification (16 bits): Unique ID for fragmentation/reassembly
Flags (3 bits): Control fragmentation. DF (Don't Fragment) and MF (More Fragments)
Fragment Offset (13 bits): Position of this fragment within the original packet
TTL (8 bits): Time To Live. Decremented by each router; packet discarded when reaching 0 (prevents infinite loops)
Protocol (8 bits): Upper-layer protocol. 1=ICMP, 6=TCP, 17=UDP
Header Checksum (16 bits): Error detection for header only (not payload)
Source/Destination IP (32 bits each): Sender and receiver IP addresses
IPv6 Header Simplification
IPv6's header is a fixed 40 bytes—simpler despite larger addresses:
| Field | Bits | Description |
|---|---|---|
| Version | 4 | Always 6 |
| Traffic Class | 8 | QoS marking |
| Flow Label | 20 | Mark packets belonging to same flow |
| Payload Length | 16 | Size of data (not header) |
| Next Header | 8 | Next header type (TCP, UDP, extension) |
| Hop Limit | 8 | Same as IPv4 TTL |
| Source Address | 128 | Sender's IPv6 address |
| Destination Address | 128 | Receiver's IPv6 address |
Notice what's removed: fragmentation fields (handled by extension headers), header checksum (upper layers and link layer provide this), IHL (fixed header size), and options (replaced by extension headers).
Different operating systems use different default TTL values: Linux uses 64, Windows uses 128, and some network devices use 255. When analyzing packets, TTL can hint at the source OS and the number of hops traversed. 'TTL exceeded' ICMP messages indicate routing loops or unexpectedly long paths.
Routing Fundamentals
Routing is the process of selecting paths for packets to travel from source to destination across interconnected networks. Routers—devices that operate at the Internet layer—examine each packet's destination address and forward it toward its destination based on their routing tables.
- •Routing Table — A data structure that maps destination networks to next-hop routers or local interfaces. Every router maintains one.
- •Longest Prefix Match — When multiple routes match, the most specific (longest prefix) wins. /24 beats /16 beats /0.
- •Default Route — 0.0.0.0/0 (IPv4) or ::/0 (IPv6). Used when no more specific route exists. Typically points toward the Internet.
- •Next Hop — The IP address of the next router on the path to the destination. The packet is forwarded there using Layer 2.
- •Administrative Distance / Preference — When multiple protocols provide routes to the same destination, this determines which is trusted.
Routing Table Essentials
A routing table entry typically contains:
Destination Gateway Genmask Iface
192.168.1.0 0.0.0.0 255.255.255.0 eth0 # Directly connected
10.0.0.0 192.168.1.1 255.0.0.0 eth0 # Via gateway
0.0.0.0 192.168.1.254 0.0.0.0 eth0 # Default route
Routing Process:
- Packet arrives with destination IP 10.5.3.7
- Router checks routing table for longest match
- 10.0.0.0/8 matches (10.5.3.7 begins with 10)
- Next hop is 192.168.1.1
- Router looks up 192.168.1.1's MAC address (ARP)
- Packet is encapsulated in a new Ethernet frame and sent to next hop
- Process repeats at each router until packet reaches destination network
- •Routes manually configured by admin
- •Simple and predictable
- •No protocol overhead
- •Doesn't adapt to failures
- •Best for small, stable networks
- •Routes learned from protocols (OSPF, BGP, etc.)
- •Automatically adapts to changes
- •Requires CPU/memory/bandwidth
- •Convergence time during failures
- •Essential for large, complex networks
Interior Gateway Protocols (IGPs) like OSPF and EIGRP route within an organization (autonomous system). Exterior Gateway Protocols (EGPs)—specifically BGP—route between autonomous systems on the global Internet. BGP is what makes the Internet a network of networks.
ICMP: The Internet's Diagnostic Protocol
The Internet Control Message Protocol (ICMP), defined in RFC 792, provides error reporting and diagnostic capabilities for IP networks. ICMP messages are carried within IP packets (protocol number 1 for IPv4, 58 for ICMPv6) but are considered part of the Internet layer, not an upper-layer protocol.
| Type | Name | Description |
|---|---|---|
| 0 | Echo Reply | Response to ping request |
| 3 | Destination Unreachable | Packet couldn't be delivered (various codes) |
| 4 | Source Quench | Congestion control (deprecated) |
| 5 | Redirect | Router suggesting a better route |
| 8 | Echo Request | The 'ping' request |
| 11 | Time Exceeded | TTL expired (used by traceroute) |
Destination Unreachable Codes
The Type 3 (Destination Unreachable) message includes a code specifying why:
| Code | Meaning |
|---|---|
| 0 | Network unreachable |
| 1 | Host unreachable |
| 2 | Protocol unreachable |
| 3 | Port unreachable |
| 4 | Fragmentation needed but DF set |
| 13 | Communication administratively prohibited |
Ping: Echo Request/Reply
The ping utility sends ICMP Echo Request messages and measures the time until Echo Reply returns. This verifies:
- IP connectivity between two hosts
- Round-trip time (latency)
- Packet loss (when replies don't return)
$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=117 time=14.2 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=13.8 ms
Traceroute: Mapping the Path
Traceroute exploits ICMP Time Exceeded messages to discover the path to a destination:
- Send packet with TTL=1 → First router decrements to 0, sends Time Exceeded
- Send packet with TTL=2 → Second router sends Time Exceeded
- Continue incrementing TTL until destination responds with Echo Reply
Each Time Exceeded reveals a router along the path:
$ traceroute google.com
1 192.168.1.1 (192.168.1.1) 1.234 ms
2 10.20.30.1 (10.20.30.1) 5.678 ms
3 core-rtr.isp.com (198.51.100.1) 12.345 ms
4 ....
Note: Some routers drop ICMP or deprioritize it, causing timeouts (* * *) in traceroute output.
ICMP can be used for reconnaissance (mapping networks with ping sweeps) and attacks (ping floods, ICMP redirect attacks). Many firewalls block some ICMP types. However, blocking all ICMP breaks Path MTU Discovery and essential diagnostics. Security policy should be nuanced, not simply 'block all ICMP.'
IP Fragmentation and Path MTU Discovery
Different link-layer technologies have different maximum frame sizes. Ethernet's MTU is typically 1500 bytes, but some WAN links may be smaller. When an IP packet is larger than the outgoing link's MTU, it must be fragmented into smaller pieces that can traverse the link.
IPv4 Fragmentation
In IPv4, any router along the path can fragment packets:
- Router receives 4000-byte packet
- Outgoing link has 1500-byte MTU
- Router splits packet into fragments:
- Fragment 1: bytes 0-1479, MF=1, Offset=0
- Fragment 2: bytes 1480-2959, MF=1, Offset=185 (1480/8)
- Fragment 3: bytes 2960-3999, MF=0, Offset=370
All fragments share the same Identification field. The destination host reassembles them.
Fragmentation Header Fields:
- Identification: Same value for all fragments of one packet
- MF (More Fragments) flag: 1 if more fragments follow, 0 for last
- Fragment Offset: Position in original packet (in 8-byte units)
Problems with Fragmentation:
- If any fragment is lost, entire packet must be retransmitted
- Reassembly requires memory at the destination
- Fragments can arrive out of order
- Security devices may have trouble inspecting fragmented packets
Path MTU Discovery (PMTUD)
To avoid fragmentation, hosts can discover the path's minimum MTU:
- Source sends packets with DF (Don't Fragment) flag set
- If a router can't forward without fragmenting, it drops the packet and sends ICMP 'Fragmentation Needed'
- Source reduces packet size and retries
- Process continues until packets reach destination
This discovers the path MTU without relying on router fragmentation.
IPv6 Changes:
IPv6 takes a stricter approach:
- Routers never fragment packets
- Only the source can fragment using extension headers
- PMTUD is required for IPv6
- Minimum link MTU is 1280 bytes (guaranteed to work everywhere)
If ICMP is blocked, PMTUD fails silently—large packets disappear without error messages. This creates 'black holes' where small packets work but large ones fail mysteriously. Common symptoms: SSH login works but large file transfers hang. Fix: ensure ICMP Type 3 Code 4 is allowed through firewalls.
KEEP LEARNING
There’s more to understand.
You’re reading the introduction. Create a free account to read the complete lesson, save notes and keep track of your progress.