Network Layer Overview
Logical Addressing
Read aloud is unavailable in this browser.
Naming the Billions
Consider the scale of addressing on today's Internet: billions of devices, each requiring a unique identifier, spread across every continent, connected by networks owned by thousands of different organizations, using dozens of different physical transmission technologies.
How do you create an addressing scheme that:
- Uniquely identifies billions of devices?
- Enables efficient routing through millions of routers?
- Works regardless of whether the device is connected via Ethernet, Wi-Fi, cellular, or satellite?
- Allows networks to be added, split, or reorganized without global reconfiguration?
- Permits devices to move between networks and obtain new addresses automatically?
The answer is logical addressing—a software-defined addressing scheme that operates independently of physical network hardware. Where MAC addresses are burned into network interface cards and identify the hardware, IP addresses are assigned by software and identify a device's location in the network topology.
This distinction—hardware-independent, topology-aware addressing—is what makes the global Internet possible.
By the end of this page, you will understand why logical addressing is essential for internetworking, the key properties of IP addresses (hierarchy, uniqueness, assignability), how logical addresses contrast with physical addresses, and the foundational concepts that prepare you for deep dives into IPv4 and IPv6 addressing in subsequent chapters.
Physical vs. Logical Addressing
To appreciate logical addressing, we must first understand what it replaces and why physical addressing alone is insufficient for global networking.
Physical Addresses (MAC Addresses):
The Data Link Layer uses Media Access Control (MAC) addresses to identify devices. These addresses have specific characteristics:
- •Length: 48 bits (6 bytes), written as 12 hexadecimal digits (e.g.,
00:1A:2B:3C:4D:5E) - •Assignment: Burned into hardware by manufacturer (though can be spoofed in software)
- •Structure: First 24 bits = OUI (Organizationally Unique Identifier), Last 24 bits = device-specific
- •Scope: Locally significant within a single broadcast domain
- •Flat Namespace: No hierarchy—any address could be anywhere in the world
- •Persistence: Remains constant regardless of where device connects
Why MAC Addresses Fail for Global Routing:
Imagine trying to build a global postal system where every address is a random 48-bit number with no relationship to geographic location. To deliver mail, every post office would need a list of every address in the world and which direction to send it. This is clearly unworkable.
MAC addresses have the same problem:
-
No Location Information: MAC
00:1A:2B:3C:4D:5Etells you nothing about where that device is. It could be in Tokyo, Texas, or the International Space Station. -
No Aggregation: You cannot summarize MAC addresses. A router cannot say "all addresses starting with 00:1A go left" because devices with similar MAC prefixes are scattered globally.
-
Flat Routing Tables: Without aggregation, routing tables would need an entry for every device on the Internet—billions of entries, updated in real-time. This is computationally impossible.
-
Hardware Dependence: If you replace your network interface card, your identifier changes. Persistent system identification becomes impossible.
If the Internet used MAC addresses for routing, the global routing table would need ~50 billion entries (one per device). At roughly 100 bytes per entry, that's 5 terabytes just for the routing table—updated continuously. Modern routers cannot handle this; they work with ~900,000 prefixes (IP aggregations), not billions of individual addresses.
Properties of Logical Addresses
Logical addresses (IP addresses) solve the problems of physical addressing through several key properties:
1. Hierarchical Structure
IP addresses embed location information through a hierarchical structure:
An IP address consists of two conceptual parts:
- Network Portion: Identifies the network or subnet the host belongs to
- Host Portion: Identifies the specific host within that network
The division point is defined by a subnet mask (or prefix length). This hierarchy enables:
- Route Aggregation: A single routing table entry can cover thousands of hosts
- Hierarchical Delegation: IANA → Regional Registries → ISPs → Organizations → end users
- Locality: Addresses in the same network share a prefix, simplifying routing
2. Software Assignability
Unlike MAC addresses, IP addresses are assigned by software and can change:
- Static Assignment: Administrator manually configures IP address
- Dynamic Assignment: DHCP server automatically assigns addresses
- Self-Assignment: Link-local addresses (169.254.x.x, fe80::) when no DHCP available
This flexibility enables:
- Devices to move between networks and receive contextually appropriate addresses
- Network renumbering without replacing hardware
- Efficient address utilization through dynamic allocation
3. Global Uniqueness (for public addresses)
Public IP addresses are globally unique—no two devices on the public Internet have the same address (at the same time). This is enforced through a hierarchical allocation system managed by IANA and Regional Internet Registries (RIRs).
4. Scope Awareness
IP addresses have defined scopes:
- Global: Routable anywhere on the Internet (public addresses)
- Private: Valid only within an organization's network (10.x.x.x, 172.16-31.x.x, 192.168.x.x)
- Link-Local: Valid only on a single link/subnet (169.254.x.x for IPv4, fe80::/10 for IPv6)
- Loopback: Refers to the local host itself (127.0.0.1, ::1)
IP addresses work like telephone numbers: the country code identifies the nation, the area code identifies the region, the exchange identifies the local hub, and the subscriber number identifies the individual line. Just as you can route a call through increasingly local switches using these hierarchical prefixes, routers can forward packets using increasingly specific IP prefixes.
Logical Addressing in IPv4
IPv4, the fourth version of the Internet Protocol, has been the dominant network layer protocol since the 1980s. Its addressing scheme, while showing its age, illustrates the core concepts of logical addressing.
IPv4 Address Structure:
| Property | Value | Details |
|---|---|---|
| Length | 32 bits (4 bytes) | Provides ~4.3 billion unique addresses |
| Notation | Dotted decimal | Four decimal numbers 0-255 separated by dots: 192.168.1.100 |
| Binary | 32 binary digits | 11000000.10101000.00000001.01100100 |
| Hexadecimal | 8 hex digits (uncommon) | C0.A8.01.64 |
| Address Space | 0.0.0.0 - 255.255.255.255 | Total 2^32 = 4,294,967,296 addresses |
Network and Host Division:
Every IPv4 address is conceptually divided into a network portion and a host portion. The subnet mask defines where this division occurs:
IP Address: 192.168.1.100 = 11000000.10101000.00000001.01100100
Subnet Mask: 255.255.255.0 = 11111111.11111111.11111111.00000000
|------- Network -------| |--Host--|
Network ID: 192.168.1.0 (IP AND Mask)
Broadcast: 192.168.1.255 (IP OR NOT Mask)
Host Range: 192.168.1.1 - 192.168.1.254
CIDR Notation:
Modern notation uses CIDR (Classless Inter-Domain Routing) prefix notation:
192.168.1.0/24means the first 24 bits are the network portion- Equivalent to subnet mask 255.255.255.0
- The
/24is called the "prefix length"
IPv4 Address Types:
IPv4 Address Categories
- •Unicast: Identifies a single interface. Packets addressed to a unicast address are delivered to one specific host. Example: 192.168.1.100
- •Broadcast: Delivered to all hosts on a network. Two types:
- Limited Broadcast: 255.255.255.255 (never routed, local network only)
- Directed Broadcast: Network ID with all host bits set (e.g., 192.168.1.255 for /24)
- •Multicast: Delivered to all hosts that have joined a multicast group. Range: 224.0.0.0 - 239.255.255.255. Example: 224.0.0.1 (all hosts on local segment)
- •Private Addresses: Reserved for internal use, not routed on public Internet:
- 10.0.0.0/8 (~16.7 million addresses)
- 172.16.0.0/12 (~1 million addresses)
- 192.168.0.0/16 (~65,000 addresses)
- •Special Addresses:
- 127.0.0.0/8: Loopback (127.0.0.1 most common)
- 0.0.0.0: "This network" (used in DHCP, etc.)
- 169.254.0.0/16: Link-local (APIPA/self-assigned)
With only 4.3 billion addresses and billions more devices, IPv4 addresses have been exhausted. IANA allocated its last blocks in 2011, and most RIRs have run out. Techniques like NAT (Network Address Translation) and eventually IPv6 migration address this crisis.
Logical Addressing in IPv6
IPv6 was designed to solve IPv4's address exhaustion with a massively larger address space, while incorporating lessons learned from decades of IPv4 operation.
IPv6 Address Structure:
| Property | Value | Details |
|---|---|---|
| Length | 128 bits (16 bytes) | Provides ~340 undecillion addresses |
| Notation | Colon hexadecimal | Eight groups of 4 hex digits: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 |
| Abbreviated | Zero suppression | 2001:db8:85a3::8a2e:370:7334 |
| Address Space | Enormous | 2^128 ≈ 3.4 × 10^38 addresses |
| Prefix Length | /64 typical for LANs | Network prefix commonly 48-64 bits |
Scale of IPv6 Address Space:
To appreciate how large 2^128 is:
- If you assigned 1 billion addresses every second since the Big Bang, you'd have used less than 0.00000001% of IPv6 addresses.
- There are enough addresses to assign 100 addresses to every atom on Earth's surface.
- Standard practice allocates a /64 subnet (2^64 = 18 quintillion addresses) to every end-user LAN.
IPv6 Address Abbreviation Rules:
- Leading zeros in each group can be omitted:
2001:0db8→2001:db8 - One sequence of all-zero groups can be replaced with
:::2001:db8:0:0:0:0:0:1→2001:db8::1 - The
::can only appear once (to avoid ambiguity)
IPv6 Address Types:
IPv6 Address Categories
- •Global Unicast: Globally routable addresses (similar to IPv4 public addresses). Begin with 2000::/3. Example: 2001:db8:1234::1
- •Link-Local: Automatically configured, valid only on a single link. Always fe80::/10. Required on every IPv6 interface.
- •Unique Local: Similar to IPv4 private addresses, for internal use. Prefix fc00::/7 (commonly fd00::/8 used).
- •Multicast: Replaces IPv4 broadcast. Prefix ff00::/8. Examples: ff02::1 (all nodes), ff02::2 (all routers).
- •Anycast: Same address assigned to multiple interfaces; packet goes to nearest one. Used for load balancing and redundancy.
- •Special Addresses:
- ::1 (loopback)
- :: (unspecified address)
- ::ffff:0:0/96 (IPv4-mapped IPv6 addresses)
IPv6 eliminates broadcast addresses entirely! Instead, multicast replaces broadcast functionality. For example, the IPv6 equivalent of "all hosts on this subnet" is the ff02::1 multicast address. This reduces unnecessary traffic and improves efficiency.
Address Assignment Mechanisms
A fundamental advantage of logical addressing is that addresses can be assigned dynamically by software. This section explores the mechanisms that assign IP addresses to hosts.
Static Assignment:
The simplest method—an administrator manually configures each device:
# Linux example
ip addr add 192.168.1.100/24 dev eth0
ip route add default via 192.168.1.1
# Windows example (in Network Adapter Settings)
IP Address: 192.168.1.100
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1
DNS Server: 8.8.8.8
When to use static assignment:
- Servers that need stable, known addresses
- Network infrastructure devices (routers, switches)
- Printers, IoT devices in managed environments
- Systems where DHCP might not be available
Dynamic Host Configuration Protocol (DHCP):
DHCP automates address assignment through a four-step process:
DHCP Provides:
- IP address
- Subnet mask
- Default gateway
- DNS server addresses
- Lease duration (address is borrowed, not permanently assigned)
IPv6 Address Configuration:
IPv6 offers additional configuration methods:
-
SLAAC (Stateless Address Autoconfiguration): Hosts generate their own addresses using:
- Network prefix learned from router advertisements
- Interface ID derived from MAC address (EUI-64) or randomly generated (privacy extensions)
- No DHCP server required for basic connectivity
-
DHCPv6 (Stateful): Similar to DHCPv4, server assigns complete addresses
-
DHCPv6 (Stateless): SLAAC for address, DHCPv6 only for additional info (DNS servers, etc.)
Link-Local Addressing:
When no configuration is available:
- IPv4: APIPA assigns addresses in 169.254.0.0/16
- IPv6: Link-local addresses (fe80::/10) are always automatically configured
These allow local communication even without infrastructure.
Global IP address assignment follows a strict hierarchy: IANA → Regional Internet Registries (ARIN, RIPE, APNIC, LACNIC, AFRINIC) → Local Internet Registries / ISPs → End users. This ensures global uniqueness and enables route aggregation. You can't just pick a public IP—it must be allocated through this system.
Address Resolution: Bridging Logical and Physical
Logical addresses enable global routing, but actual data transmission occurs over physical links using physical addresses. The network layer must translate between these two addressing schemes—a process called address resolution.
The Resolution Challenge:
When Host A (192.168.1.10) wants to send a packet to Host B (192.168.1.20):
- A knows B's IP address
- A needs B's MAC address to construct the Layer 2 frame
- There's no formula to derive MAC from IP—they're independent
- Solution: Ask on the network
Address Resolution Protocol (ARP) for IPv4:
ARP uses a simple request/reply mechanism:
ARP Cache:
Resolving addresses for every packet would be prohibitively slow. Hosts maintain an ARP cache (or ARP table) that stores recent mappings:
$ arp -a
? (192.168.1.1) at d4:e2:5a:1f:3c:88 [ether] on eth0
? (192.168.1.20) at bb:bb:bb:bb:bb:bb [ether] on eth0
Cached entries have a timeout (typically 20 minutes to 4 hours) and are refreshed when needed.
Neighbor Discovery Protocol (NDP) for IPv6:
IPv6 replaces ARP with ICMPv6 Neighbor Discovery:
- Neighbor Solicitation (NS): "What's your link-layer address?" (sent to solicited-node multicast, not broadcast)
- Neighbor Advertisement (NA): "Here's my link-layer address"
NDP advantages over ARP:
- Uses multicast instead of broadcast (more efficient)
- Integrated with ICMPv6 (one less protocol)
- Supports address conflict detection
- Enables router discovery and prefix learning
- •Separate Layer 2.5 protocol
- •Uses broadcast requests
- •Susceptible to ARP spoofing
- •No router/prefix discovery
- •Simple and widely deployed
- •Part of ICMPv6
- •Uses multicast (efficient)
- •Supports SEND (secure version)
- •Includes router and prefix discovery
- •More complex but more capable
ARP has no authentication—any device can claim any IP-to-MAC mapping. ARP spoofing/poisoning attacks exploit this to intercept traffic (man-in-the-middle) or cause denial of service. Mitigations include Dynamic ARP Inspection (DAI) on switches, static ARP entries for critical systems, and monitoring tools.
Logical Addressing Enables Routing
The true power of logical addressing becomes apparent when we examine how it enables efficient routing. The hierarchical structure of IP addresses is specifically designed to support scalable routing across the global Internet.
Prefix-Based Routing:
Routers don't store entries for every individual host—they match destination addresses against network prefixes:
Routing Table Entry:
Destination: 192.168.1.0/24
Next Hop: 10.0.0.2
Interface: eth1
Meaning: "Any address matching 192.168.1.x should be sent to 10.0.0.2 via eth1"
This single entry covers 254 possible hosts. A /16 prefix covers 65,534 hosts. Aggregation continues upward:
Route Aggregation Example:
| Level | Prefix | Coverage | Example Router |
|---|---|---|---|
| Host | 192.168.1.100/32 | 1 host | Host's own routing to self |
| Subnet | 192.168.1.0/24 | 254 hosts | LAN router |
| Organization | 192.168.0.0/16 | 65,534 hosts | Campus router |
| ISP Customer | 192.160.0.0/12 | ~1 million hosts | Regional ISP |
| RIR Allocation | 192.0.0.0/8 | ~16.7 million hosts | Backbone router |
Longest Prefix Matching:
When a packet arrives, the router may have multiple matching routes. It selects the most specific match (longest prefix):
Routing Table:
10.0.0.0/8 → Next hop A (matches 16.7M addresses)
10.45.0.0/16 → Next hop B (matches 65K addresses)
10.45.99.0/24 → Next hop C (matches 254 addresses)
0.0.0.0/0 → Default gateway (matches everything)
Destination: 10.45.99.50
Matches 10.0.0.0/8 (/8 prefix)
Matches 10.45.0.0/16 (/16 prefix)
Matches 10.45.99.0/24 (/24 prefix) ← SELECTED (longest match)
Matches 0.0.0.0/0 (/0 prefix)
Packet forwarded to Next hop C
Why Hierarchy Matters:
-
Scalability: The global Internet routing table has ~900,000 prefixes, not ~50 billion hosts. This is only possible because addresses aggregate hierarchically.
-
Stability: Changes in individual host addresses don't require global routing updates. Only prefix-level changes propagate.
-
Locality: Traffic destined for the same organization follows the same path until it reaches that organization's network.
-
Policy Enforcement: Network policies can be applied at prefix boundaries (entire organizations, regions, countries).
Before CIDR (1993), routing was based on Class A/B/C address classes, wasting enormous address space and preventing flexible aggregation. CIDR introduced variable-length subnet masks, enabling arbitrary prefix lengths and the aggregation that saved both IPv4 address space and routing table sizes from explosion.
KEEP LEARNING
Keep learning for free.
Read the complete lesson, save your notes and pick up where you left off with a free account. No card needed.