TCP/IP Model and Layer 3 Networking (Routing)
Layer 3 of the TCP/IP model is where network-level communication happens. It is responsible for logical addressing, routing decisions, and delivering packets across different networks.
While lower layers move data locally, Layer 3 enables global connectivity — allowing packets to travel from one network to another across routers, subnets, and autonomous systems.
This article explains how Layer 3 works, how routing actually happens, and why it is foundational to modern networking.
Where Layer 3 Fits in the TCP/IP Model
In the TCP/IP model, Layer 3 is known as the Internet Layer. It sits above the Link Layer and below the Transport Layer. For a broader overview, see how the internet works.
- Link Layer — local delivery (Ethernet, ARP)
- Internet Layer (Layer 3) — routing and IP addressing
- Transport Layer — end-to-end communication (TCP, UDP)
Layer 3 does not guarantee delivery — it focuses on getting packets to the correct destination network.
IP Addressing: The Foundation of Routing
What an IP Address Represents
An IP address is a logical identifier assigned to a network interface. It identifies both the network and the host within that network.
Routers forward packets based on network prefixes — not individual devices.
IPv4 vs IPv6
- IPv4 — 32-bit addressing, limited address space
- IPv6 — 128-bit addressing, hierarchical and scalable
Learn more in our deep dives on IPv4 addressing and subnetting and IPv6 adoption. Despite IPv6 growth, routing concepts remain fundamentally the same.
How Routing Actually Works
Packet Forwarding Process
- A packet arrives at a router interface
- The destination IP is extracted
- The routing table is consulted
- The best matching route is selected
- The packet is forwarded to the next hop
This process happens independently for every packet — routing is stateless at the IP layer.
Routing Tables and Longest Prefix Match
Routing tables contain network prefixes and associated next hops. When multiple routes match, routers use longest prefix match to choose the most specific route.
More specific routes always win over broader ones.
This mechanism enables hierarchical routing and efficient aggregation of networks — a concept heavily used in BGP routing.
Static Routing vs Dynamic Routing
Static Routing
Static routes are manually configured and do not adapt automatically to network changes.
- Simple and predictable
- No protocol overhead
- Not scalable
Dynamic Routing
Dynamic routing protocols exchange routing information automatically.
- OSPF — internal routing (link-state)
- BGP — inter-network routing (path-vector)
Dynamic routing enables resilience, redundancy, and scalability. Explore a developer-friendly breakdown in this BGP guide.
Common Layer 3 Protocols
- IP — packet addressing and delivery
- ICMP — error reporting and diagnostics
- IPsec — secure IP communication
- Routing protocols — OSPF, BGP, RIP
These protocols work together to provide reachability, visibility, and control across interconnected networks.
Common Layer 3 Problems
- Incorrect subnetting
- Missing or incorrect routes
- Asymmetric routing
- Routing loops
- Misconfigured gateways
Many connectivity issues also stem from misconfigured NAT setups or routing inconsistencies between networks.
Why Layer 3 Still Matters
Even in cloud-native and software-defined environments, Layer 3 routing remains essential.
VPC routing, Kubernetes networking, VPNs, and the public internet all rely on the same core IP routing principles that underpin global connectivity.
Final Thoughts
Layer 3 is the heart of networking. It enables global connectivity by moving packets across networks in a scalable and resilient way.
For engineers, a strong understanding of IP routing is non-negotiable — it is the foundation on which all higher-level networking depends. Pair this knowledge with broader networking fundamentals to fully understand how modern distributed systems communicate.
Frequently Asked Questions
What is Layer 3 in the TCP/IP model?
Layer 3, also known as the Internet Layer in the TCP/IP model, is responsible for logical addressing and packet routing between networks. It uses IP addresses to identify devices and determines the best path for data to travel across interconnected networks.
How does routing work at Layer 3?
Routing works by using routing tables and protocols like OSPF or BGP to determine the optimal path for IP packets. Routers analyze the destination IP address and forward packets to the next hop until they reach their final destination.
What is the difference between routing and switching?
Routing operates at Layer 3 and directs traffic between different networks using IP addresses, while switching operates at Layer 2 and forwards data within the same local network using MAC addresses.