2.2 Network Layer & IP Addressing

Key Takeaways

  • IPv4 uses 32-bit addresses formatted into 4 decimal octets separated by dots, split into network and host portions by a subnet mask.
  • RFC 1918 defines three private IP address spaces (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16) that are non-routable across the public Internet and require NAT/PAT for outbound traversal.
  • APIPA assigns an address in the 169.254.0.0/16 range when a client fails to obtain a DHCP lease, while 127.0.0.1 (127.0.0.0/8) is reserved for local loopback stack testing.
  • IPv6 expands addressing to 128 bits (8 hexadecimal hextets), eliminating broadcast traffic entirely in favor of multicast and anycast, and provides stateless address autoconfiguration (SLAAC).
Last updated: August 2026

Network Layer & IP Addressing Architecture

The Network Layer (Layer 3) is responsible for logical end-to-end addressing, packet formatting, and path determination across interconnected networks. While physical Layer 2 MAC addresses enable local frame delivery within a single broadcast segment, logical IP addresses enable packets to navigate across complex global internets spanning millions of disparate networks.


1. IPv4 Structure & Addressing Principles

An Internet Protocol Version 4 (IPv4) address is a 32-bit binary number uniquely identifying a host interface on a network. For human readability, IPv4 addresses are written in dotted-decimal notation, consisting of four 8-bit integers (octets) separated by periods, where each octet ranges in value from 0 to 255 (256 possible values per octet, since 2^8 = 256).

+-----------------------------------------------------------------------------------------+
|                            IPV4 BINARY STRUCTURE & OCTETS                               |
|                                                                                         |
|   Dotted Decimal:          192    .     168    .      10     .      45                  |
|   Binary Representation: 11000000 .  10101000  .   00001010  .   00101101               |
|   Bit Count:              8 bits  +    8 bits  +    8 bits   +    8 bits = 32 Bits      |
|                                                                                         |
|   Subnet Mask (/24):     255.255.255.0 (11111111.11111111.11111111.00000000)            |
|   [ <-------- Network ID (24 bits) --------> ] [ <-- Host ID (8 bits) --> ]             |
+-----------------------------------------------------------------------------------------+

Network Portion vs. Host Portion

Every IP address contains two distinct logical parts:

  1. Network ID (Prefix): Identifies the specific network or subnet where the host resides. All hosts on the same physical or virtual subnet share the exact same network ID.
  2. Host ID: Identifies the unique individual device or interface on that specific subnet.

The boundary between the network ID and the host ID is determined strictly by the Subnet Mask. When a host or router prepares to forward a packet, it performs a bitwise logical AND operation between the destination IP address and its configured subnet mask. If the resulting network ID matches the local network ID, the packet is delivered locally via Layer 2 ARP; if the network IDs differ, the packet is forwarded to the Default Gateway.


2. Reserved IP Address Ranges: RFC 1918, APIPA, & Special Spaces

To prevent the rapid exhaustion of the 4.29 billion total IPv4 addresses (2^32), the Internet Engineering Task Force (IETF) established several reserved and private address blocks that are never routed across the public Internet.

+-----------------------------------------------------------------------------------------+
|                        RFC 1918 PRIVATE IP ADDRESS SPACES                               |
|                                                                                         |
|   Class   CIDR Prefix    IP Range                             Total Addresses           |
|   -----   -----------    ---------------------------------    ---------------           |
|     A      10.0.0.0/8    10.0.0.0    - 10.255.255.255         16,777,216 addresses      |
|     B      172.16.0.0/12 172.16.0.0   - 172.31.255.255         1,048,576 addresses       |
|     C      192.168.0.0/16192.168.0.0  - 192.168.255.255        65,536 addresses          |
+-----------------------------------------------------------------------------------------+

RFC 1918 Private IP Address Spaces

Private IP addresses are intended for internal Local Area Networks (LANs). Enterprise routers and Internet Service Providers (ISPs) drop any packets containing private RFC 1918 destination addresses on public interfaces. Internal hosts communicate with the public Internet using Network Address Translation (NAT):

  1. 10.0.0.0 /8 (Class A Private): Provides 1 contiguous Class A block (10.0.0.0 to 10.255.255.255), offering over 16.7 million usable addresses. Standard in large enterprise networks and cloud virtual networks (e.g., AWS VPCs).
  2. 172.16.0.0 /12 (Class B Private): Provides 16 contiguous Class B blocks (172.16.0.0 to 172.31.255.255), offering over 1 million usable addresses. Common in mid-sized corporate campus networks.
  3. 192.168.0.0 /16 (Class C Private): Provides 256 contiguous Class C blocks (192.168.0.0 to 192.168.255.255), offering 65,536 addresses. Standard default configuration in Small Office / Home Office (SOHO) routers (e.g., 192.168.1.0/24).

Special & Reserved IPv4 Ranges

  • APIPA (Automatic Private IP Addressing / Link-Local): 169.254.0.0/16
    • Range: 169.254.0.1 to 169.254.255.254.
    • Function: When a client is configured for dynamic DHCP addressing but receives no response from any DHCP server, the operating system self-assigns an APIPA address.
    • Troubleshooting Diagnostic: An APIPA address indicates that the host has physical network connectivity (cable connected / Wi-Fi associated) but cannot communicate with the DHCP server (e.g., DHCP pool exhausted, VLAN misconfiguration, or DHCP server offline).
  • Loopback Address: 127.0.0.1 (127.0.0.0/8 block)
    • Function: Directs packets back into the local host's internal protocol stack without transmitting onto any physical network medium. Used to test whether the local TCP/IP protocol stack is properly installed and functioning (ping 127.0.0.1).
  • Default Route / Quad-Zero: 0.0.0.0/0
    • Function: Represents "all IPv4 addresses" or an unassigned interface. In a routing table, 0.0.0.0/0 represents the Default Route (gateway of last resort).
  • Limited Broadcast Address: 255.255.255.255
    • Function: Sends a broadcast packet to every host on the local physical network segment. Routers never forward packets destined to 255.255.255.255.

3. Subnetting & CIDR (Classless Inter-Domain Routing) Math

In early networking, IP addresses were assigned strictly in rigid Classful blocks (Class A: /8, Class B: /16, Class C: /24). In 1993, Classless Inter-Domain Routing (CIDR) replaced classful addressing, allowing subnet masks of arbitrary bit-lengths denoted by a prefix slash (/n), representing the exact count of leading binary 1s in the mask.

Core Subnetting Formulas:

  1. Total IP Addresses: Total Addresses = 2^(32 - n) (where n is the CIDR prefix length, and 32 - n = h is the number of host bits).
  2. Usable Host Addresses: Usable Hosts = 2^h - 2 (subtracting 2 addresses: the Network ID with all host bits set to 0, and the Directed Broadcast Address with all host bits set to 1).
  3. Subnet Magic Number (Block Size): Block Size = 256 - [Interesting Octet Value]. Subnet boundaries always increment in multiples of this block size.

Practical CIDR Subnet Cheat Sheet (/24 to /30)

CIDR PrefixSubnet MaskMask in Binary (Last Octet)Host Bits (h)Total IPs (2^h)Usable Hosts (2^h - 2)Block SizeTypical Enterprise Application
/24255.255.255.0000000008256254256Standard department LAN / Office VLAN
/25255.255.255.128100000007128126128Medium subnet / Large server farm
/26255.255.255.192110000006646264Small department / Branch office LAN
/27255.255.255.224111000005323032Management VLAN / DMZ web farm
/28255.255.255.240111100004161416Small server subnet / Infrastructure VLAN
/29255.255.255.248111110003868Public IP blocks / Firewall clustering
/30255.255.255.252111111002424Point-to-Point router interconnection links

Step-by-Step Subnetting Example: Analyzing 192.168.10.75/26

  • CIDR Prefix: /26 -> 26 network bits, 6 host bits (32 - 26 = 6).
  • Subnet Mask: 255.255.255.192 (Binary: 11111111.11111111.11111111.11000000).
  • Block Size: 256 - 192 = 64. Subnets start at multiples of 64: 0, 64, 128, 192.
  • Subnet Determination for .75: The host .75 falls between 64 and 127.
    • Network ID: 192.168.10.64 (Cannot be assigned to a host).
    • First Usable Host: 192.168.10.65.
    • Last Usable Host: 192.168.10.126.
    • Broadcast Address: 192.168.10.127 (Cannot be assigned to a host).
    • Usable Host Capacity: 2^6 - 2 = 64 - 2 = 62 valid hosts.

4. IPv6 Architecture & Address Types

Internet Protocol Version 6 (IPv6) was created to permanently resolve IPv4 address depletion. IPv6 expands the address space from 32 bits to 128 bits, providing approximately 3.4 x 10^38 unique addresses (2^128).

+-----------------------------------------------------------------------------------------+
|                                 IPV6 ADDRESS STRUCTURE                                  |
|                                                                                         |
|   Full Form (8 Hextets):                                                                |
|   2001 : 0db8 : 85a3 : 0000 : 0000 : 8a2e : 0370 : 7334                                |
|   [-- 16b --][-- 16b --][-- 16b --][-- 16b --][-- 16b --][-- 16b --][-- 16b --][-- 16b --]|
|                                                                                         |
|   Compressed Form (Applying Compression Rules):                                         |
|   2001:db8:85a3::8a2e:370:7334                                                          |
+-----------------------------------------------------------------------------------------+

IPv6 Representation & Compression Rules

IPv6 addresses are written as eight groups of four hexadecimal digits (each 16-bit group is called a hextet), separated by colons. Two mandatory compression rules prevent unwieldy address strings:

  1. Omit Leading Zeros: Any leading zeros in a 4-digit hextet can be dropped (e.g., :0042: becomes :42:, :0000: becomes :0:).
  2. Double Colon Compression (::): A single contiguous sequence of one or more all-zero hextets can be replaced with a double colon ::. This abbreviation can be applied only once per address to prevent mathematical ambiguity.

Key IPv6 Address Classifications

  • Global Unicast Address (GUA - 2000::/3): Globally unique, publicly routable Internet addresses (equivalent to public IPv4 addresses). Typically assigned as a /48 prefix to enterprises by ISPs.
  • Unique Local Address (ULA - fc00::/7, practically fd00::/8): Intended for private internal enterprise networks; not routable on the public Internet (equivalent to RFC 1918 private IPv4).
  • Link-Local Address (fe80::/10): Automatically configured on every active IPv6 interface. Used strictly for communication across the local physical link/subnet. Routers never forward link-local traffic across subnets. (Serves the role of APIPA, but is always active simultaneously alongside global addresses).
  • Loopback Address (::1/128): The local host loopback interface (equivalent to 127.0.0.1).
  • Multicast Address (ff00::/8): Delivers packets to all interfaces subscribed to a specific multicast group (e.g., ff02::1 reaches all link-local nodes, ff02::2 reaches all link-local routers).
  • Elimination of Broadcast: IPv6 has no broadcast address type. Functions that previously relied on noisy ARP or IP broadcasts in IPv4 now utilize targeted Multicast and Neighbor Discovery Protocol (NDP) via ICMPv6.

Comprehensive IPv4 vs. IPv6 Comparison Matrix

CharacteristicIPv4 StandardIPv6 Standard
Address Length32 bits (4 bytes)128 bits (16 bytes)
Address Space2^32 = approx 4.29 Billion2^128 = approx 3.4 x 10^38 (Undecillion)
NotationDotted decimal (192.168.1.1)Hexadecimal with colons (2001:db8::1)
Header SizeVariable (20–60 bytes with options)Fixed (40 bytes baseline, extension headers chained)
Address ResolutionARP (Layer 2 broadcast queries)ICMPv6 Neighbor Discovery Protocol (NDP Multicast)
Configuration ModesManual Static or DHCPv4Static, DHCPv6, or SLAAC (Stateless Autoconfig)
Loopback Address127.0.0.1 (127.0.0.0/8)::1/128 (or ::1)
Link-Local Range169.254.0.0/16 (APIPA failover)fe80::/10 (Always active on all interfaces)
Private ScopeRFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16)Unique Local (fc00::/7 / fd00::/8)
Traffic Delivery TypesUnicast, Broadcast, MulticastUnicast, Multicast, Anycast (No Broadcast)

5. Routing Fundamentals & Routing Protocols

Routers forward packets across internetworks by evaluating destination IP addresses against their internal Routing Table. When multiple routes match a destination, the router selects the entry with the longest prefix match (the most specific subnet mask).

+-----------------------------------------------------------------------------------------+
|                           ROUTING PROTOCOL HIERARCHY                                    |
|                                                                                         |
|   [INTERNET / INTER-AS]  ======================> Exterior Gateway Protocols (EGP)       |
|                                                  - BGP (Border Gateway Protocol)        |
|                                                                                         |
|   [ENTERPRISE / INTRA-AS] =====================> Interior Gateway Protocols (IGP)       |
|                                                  - Link-State: OSPF, IS-IS              |
|                                                  - Distance-Vector: RIPv2, EIGRP        |
+-----------------------------------------------------------------------------------------+

Static vs. Dynamic Routing

  • Static Routing: Routes are manually entered by network administrators. Extremely secure and low-overhead (no CPU/bandwidth consumed by routing updates), but lacks fault tolerance (cannot automatically reroute around broken links).
  • Dynamic Routing: Routers run routing protocols to automatically discover neighboring routers, advertise reachable subnets, calculate optimal paths, and dynamically reroute around link failures.

Interior Gateway Protocols (IGP - Within an Autonomous System / AS)

  • Distance-Vector Protocols (e.g., RIP - Routing Information Protocol): Routers broadcast their entire routing table to directly connected neighbors at fixed intervals. Uses Hop Count as its sole metric (maximum 15 hops; 16 hops is unreachable). Slow convergence and prone to routing loops.
  • Link-State Protocols (e.g., OSPF - Open Shortest Path First): Routers build a complete topological map of the entire network by exchanging Link-State Advertisements (LSAs). Uses Dijkstra's Shortest Path First (SPF) algorithm with Cost (based on interface bandwidth) as its metric. Supports fast convergence, hierarchical multi-area design, and large enterprise scale.

Exterior Gateway Protocols (EGP - Between Autonomous Systems)

  • Path-Vector Protocols (e.g., BGP - Border Gateway Protocol): The standard routing protocol of the global Internet. BGP connects independent Autonomous Systems (ASNs) managed by different ISPs, tech conglomerates, and governments. BGP makes routing decisions based on network policies, path attributes (AS-Path), and rule sets rather than raw technical speed.
Test Your Knowledge

A network administrator needs to divide the private network block 192.168.50.0/24 into subnets that each support at least 12 usable host devices for different physical security cameras. If the administrator uses a /28 subnet mask, what is the maximum number of usable host IP addresses available on each individual /28 subnet?

A
B
C
D
Test Your Knowledge

Which of the following IP address blocks is designated as a private, non-routable address range under RFC 1918?

A
B
C
D
Test Your Knowledge

An IT support specialist is troubleshooting a workstation that cannot access local file shares or the Internet. Running 'ipconfig' on Windows displays an IPv4 address of 169.254.88.14 and a subnet mask of 255.255.0.0. What is the root cause indicated by this configuration?

A
B
C
D
Test Your Knowledge

Which statement accurately describes the architectural design and address classifications of IPv6 compared to IPv4?

A
B
C
D