Switches vs Routers: Layer 2 and Layer 3 Device Comparison
When to Use Each: The Strategic Decision Framework
Read aloud is unavailable in this browser.
The Network Architect's Decision
With deep understanding of both switch and router operation, we now face the practical question that network architects answer daily: When should I use a switch, and when should I use a router?
This isn't a simple binary choice. Modern networks employ both devices strategically, with the boundary between Layer 2 (switching) and Layer 3 (routing) domains being one of the most consequential design decisions. The right placement of this boundary affects:
- Performance — Latency, throughput, and jitter
- Scalability — How the network grows without redesign
- Resilience — How failures propagate and are contained
- Security — Where and how policies can be enforced
- Operational complexity — Management and troubleshooting burden
This page provides the decision framework professional network engineers use to make these choices.
By completing this page, you will have a systematic approach to choosing between switches and routers. You'll understand the scenarios that favor each device type, the tradeoffs involved in every decision, and how modern network designs strategically combine both technologies.
The Fundamental Tradeoffs
Before examining specific scenarios, we must understand the core tradeoffs between Layer 2 switching and Layer 3 routing. Every network design decision involves balancing these factors.
Layer 2 (Switching) Tradeoffs:
- •Lower latency — Hardware-based forwarding with minimal processing per frame
- •Simpler configuration — No IP addressing required for basic operation
- •Transparent bridging — Devices unaware of switch presence; works automatically
- •Lower cost per port — Less processing power required
- •Host mobility — Devices can move within VLAN without IP reconfiguration
- •Limited scalability — Broadcast domains must stay small
- •Loop vulnerability — Requires STP (slow convergence) or alternatives
- •No traffic filtering — Can't filter by IP (without L3 features)
- •Broadcast flooding — All broadcasts reach all hosts
- •Flat addressing — No route aggregation possible
Layer 3 (Routing) Tradeoffs:
- •Broadcast containment — Each interface is a separate broadcast domain
- •Scalability — Hierarchical addressing enables internet-scale networks
- •Security filtering — ACLs filter traffic by IP, port, protocol
- •Policy enforcement — QoS, NAT, VPN all operate at Layer 3
- •Path diversity — Multiple equal-cost paths (ECMP) improve redundancy
- •Higher latency — More processing per packet (though modern ASICs minimize this)
- •Complex configuration — IP addressing, subnetting, routing protocols required
- •Host mobility friction — Moving between subnets requires IP change
- •Higher cost per port — More sophisticated hardware
- •Configuration dependencies — DHCP, DNS, routing all must work correctly
Switching optimizes for simplicity and speed within trust boundaries. Routing optimizes for control and scalability across trust boundaries. The question is: where do your trust boundaries fall, and how much control do you need?
Use a Switch When...
Switches are the right choice in specific scenarios. Here's when Layer 2 switching should be your primary approach:
Scenario 1: Connecting Devices Within a Single Department/Function
Devices that share a common purpose and trust level belong on the same switch/VLAN:
┌─────────────────────────────────────────────────────────────────────────────┐
│ WORKGROUP SWITCHING │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ Engineering Team - VLAN 10 (192.168.10.0/24) │
│ │
│ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ │
│ │Dev 1│ │Dev 2│ │Dev 3│ │Dev 4│ │Dev 5│ │
│ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ │
│ └────────┴────────┴────────┴────────┘ │
│ │ │
│ ┌───────┴───────┐ │
│ │ SWITCH │ ◄── Layer 2 connectivity │
│ │ (48 ports) │ All in same broadcast domain │
│ └───────┬───────┘ Direct communication at wire speed │
│ │ │
│ Uplink to distribution/core │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Why Switch: These devices need to communicate frequently, share resources, and have similar trust levels. Layer 2 provides lowest latency and simplest management.
Scenario 2: High-Performance Computing Clusters
HPC environments prioritize latency above all else:
┌─────────────────────────────────────────────────────────────────────────────┐
│ HPC CLUSTER CONNECTIVITY │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ Compute Nodes: All within single Layer 2 domain │
│ ┌──────────────────────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ │ │
│ │ │Node1│ │Node2│ │Node3│ │Node4│ │Node5│ │Node6│ │Node7│ │Node8│ │ │
│ │ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ │ │
│ │ └───────┴───────┼───────┴───────┴───────┼───────┴───────┘ │ │
│ │ │ │ │ │
│ │ ┌──────┴───────┐ ┌──────┴───────┐ │ │
│ │ │ Low-Latency │ │ Low-Latency │ │ │
│ │ │ Switch │────────│ Switch │ │ │
│ │ └──────────────┘ └──────────────┘ │ │
│ │ │ │
│ │ Requirements: Sub-microsecond latency, no hops, minimal jitter │ │
│ │ Solution: Cut-through switching, flat Layer 2 topology │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Why Switch: Every router hop adds latency. MPI and other HPC protocols need sub-microsecond response times. Layer 2 cut-through switching minimizes latency.
Scenario 3: VM Clusters Requiring Live Migration
Live migration (vMotion, Live Migration) traditionally requires Layer 2 adjacency:
┌─────────────────────────────────────────────────────────────────────────────┐
│ VM LIVE MIGRATION │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ VM moves from Host A to Host B while running │
│ - VM keeps same IP address │
│ - Active TCP connections preserved │
│ - Requires same Layer 2 domain (or overlay) │
│ │
│ ┌────────────────┐ ┌────────────────┐ │
│ │ Host A │ migrate │ Host B │ │
│ │ ┌──────────┐ │ ═══════► │ ┌──────────┐ │ │
│ │ │ VM │──┼──────────────┼──│ VM │ │ │
│ │ │192.168.1.X│ │ │ │192.168.1.X│ │ │
│ │ └──────────┘ │ │ └──────────┘ │ │
│ └───────┬────────┘ └───────┬────────┘ │
│ │ │ │
│ └───────────┬───────────────────┘ │
│ │ │
│ ┌───────┴───────┐ │
│ │ SWITCH │ ◄── Same VLAN, same broadcast domain │
│ │ (Layer 2) │ VM's ARP cache/MAC remains valid │
│ └───────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Why Switch: Traditional live migration requires the VM to keep its IP and MAC. If hosts were on different subnets, the IP would need to change mid-migration.
(Note: Modern solutions like VXLAN create Layer 2 overlays across Layer 3 networks, but the VM still sees Layer 2 adjacency.)
- •Small groups of devices — Under 200-500 hosts that communicate frequently
- •Latency-sensitive applications — HPC, trading, real-time systems
- •Workgroup connectivity — Departments with high intra-group traffic
- •Virtualization clusters — When live migration is required
- •Legacy applications — Software that assumes all hosts on same subnet
Use a Router When...
Routers are essential in scenarios requiring isolation, control, or scale. Here's when Layer 3 routing should be your approach:
Scenario 1: Connecting Different Security Zones
Traffic between zones must traverse a security boundary:
┌─────────────────────────────────────────────────────────────────────────────┐
│ SECURITY ZONE SEPARATION │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
│ │ User Network │ │ Server Network │ │ DMZ │ │
│ │ VLAN 10 │ │ VLAN 20 │ │ VLAN 30 │ │
│ │ 192.168.10.0/24 │ │ 192.168.20.0/24 │ │ 192.168.30.0/24 │ │
│ └────────┬─────────┘ └────────┬──────────┘ └────────┬─────────┘ │
│ │ │ │ │
│ └────────────────────────┼────────────────────────┘ │
│ │ │
│ ┌────────────┴────────────┐ │
│ │ ROUTER / FIREWALL │ │
│ │ │ │
│ │ - ACLs per interface │ │
│ │ - Stateful inspection │ │
│ │ - Logging/auditing │ │
│ │ - NAT if needed │ │
│ └─────────────────────────┘ │
│ │
│ Policy: Users can access servers on port 80/443 only │
│ DMZ can receive external traffic on port 443 │
│ Servers cannot initiate connections to users │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Why Router: Security policies are enforced at the routed boundary. ACLs, firewalls, and IDS/IPS operate most effectively at Layer 3. Broadcast isolation also prevents cross-zone attacks.
Scenario 2: WAN Connectivity and Internet Edge
All WAN and internet connections require routing:
┌─────────────────────────────────────────────────────────────────────────────┐
│ WAN AND INTERNET EDGE │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ Enterprise Campus WAN / Internet │
│ │
│ ┌──────────────────────────────┐ ┌──────────────────────────┐ │
│ │ │ │ │ │
│ │ ┌─────────┐ ┌─────────┐ │ │ ┌─────────────────────┐ │ │
│ │ │ VLAN │ │ VLAN │ │ ▲ │ │ ISP A (Primary) │ │ │
│ │ │ 10 │ │ 20 │ │ │ │ │ BGP AS 65001 │ │ │
│ │ └────┬────┘ └────┬────┘ │ │ │ └──────────┬──────────┘ │ │
│ │ │ │ │ │ │ │ │ │
│ │ ┌────┴────────────┴────┐ │ │ │ ┌──────────┴──────────┐ │ │
│ │ │ Core Switch │ │ ───── │ │ ISP B (Backup) │ │ │
│ │ └──────────┬───────────┘ │ │ │ BGP AS 65002 │ │ │
│ │ │ │ │ └──────────┬──────────┘ │ │
│ │ ┌──────────┴───────────┐ │ │ │ │ │
│ │ │ EDGE ROUTER │────┼─────────┼─────────────┘ │ │
│ │ │ - BGP to ISPs │ │ │ │ │
│ │ │ - NAT (private→pub) │ │ │ │ │
│ │ │ - Policy routing │ │ │ │ │
│ │ └──────────────────────┘ │ │ │ │
│ │ │ └──────────────────────────┘ │
│ └──────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Why Router: WAN links use different Layer 2 technologies (MPLS, MetroE, internet). Routing protocols (BGP, OSPF) handle path selection, failover, and traffic engineering. NAT translates private addresses for internet access.
Scenario 3: Large Campus or Multi-Building Networks
Scale demands routing for broadcast control and failure isolation:
┌─────────────────────────────────────────────────────────────────────────────┐
│ LARGE CAMPUS DESIGN │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ Building A Building B Building C │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Switches │ │ Switches │ │ Switches │ │
│ │ VL10-12 │ │ VL20-22 │ │ VL30-32 │ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
│ │ │ │ │
│ ┌──────┴───────┐ ┌──────┴───────┐ ┌──────┴───────┐ │
│ │ DISTRIBUTION │ │ DISTRIBUTION │ │ DISTRIBUTION │ │
│ │ ROUTER │ │ ROUTER │ │ ROUTER │ │
│ │ (L3 boundary)│ │ (L3 boundary)│ │ (L3 boundary)│ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
│ │ │ │ │
│ └────────────────────┼────────────────────┘ │
│ │ │
│ ┌────────┴────────┐ │
│ │ CORE ROUTERS │ │
│ │ (OSPF/IS-IS) │ │
│ └─────────────────┘ │
│ │
│ Design: Layer 2 ONLY within each building │
│ Layer 3 between buildings │
│ Each building is isolated failure domain │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Why Router: With thousands of devices, a single broadcast domain would be unmanageable. Routing at distribution layer contains failures, enables summarization, and provides ECMP for redundancy.
- •Security boundaries — Any point where traffic filtering is needed
- •WAN/Internet connections — All external connectivity requires routing
- •Large networks — More than 500-1000 hosts per broadcast domain
- •Multi-site connectivity — Connecting geographically separated locations
- •Failure isolation — Containing failures to specific network segments
- •Traffic engineering — When you need control over path selection
The Decision Framework
Use this systematic framework to decide where Layer 2 ends and Layer 3 begins:
Decision Matrix:
| Question | If Yes → Switch (L2) | If Yes → Router (L3) |
|---|---|---|
| Do these devices trust each other completely? | ✓ Same broadcast domain OK | ✗ Isolate with routing |
| Is ultra-low latency critical? | ✓ Cut-through switching | ✗ Each hop adds latency |
| Are there more than 500 devices? | ✗ Too many broadcasts | ✓ Summarize/aggregate |
| Do you need traffic filtering? | ✗ Can't filter by IP | ✓ ACLs at every boundary |
| Is this crossing security zones? | ✗ Needs inspection | ✓ Firewall/policy point |
| Is this a WAN connection? | ✗ Different technologies | ✓ Routing required |
| Do VMs need live migration? | ✓ Keep L2 adjacency | ✗ Would break migration |
| Need to contain failures? | ✗ Broadcast storms spread | ✓ Failure stays in subnet |
The Flow Chart:
┌─────────────────────────────────────────────────────────────────────────────┐
│ SWITCH vs ROUTER DECISION FLOW │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────────────┐ │
│ │ Start: Connecting │ │
│ │ devices A and B │ │
│ └──────────┬───────────┘ │
│ │ │
│ ┌──────────▼───────────┐ │
│ │ Are A and B on │ │
│ │ different physical │──Yes──► ROUTER required │
│ │ sites (WAN)? │ (different L2 tech) │
│ └──────────┬───────────┘ │
│ │ No │
│ ┌──────────▼───────────┐ │
│ │ Do A and B need │ │
│ │ different security │──Yes──► ROUTER preferred │
│ │ policies? │ (ACLs/firewall) │
│ └──────────┬───────────┘ │
│ │ No │
│ ┌──────────▼───────────┐ │
│ │ Combined total │ │
│ │ devices > 500? │──Yes──► Consider ROUTING │
│ │ │ (broadcast control) │
│ └──────────┬───────────┘ │
│ │ No │
│ ┌──────────▼───────────┐ │
│ │ Need sub-μs │ │
│ │ latency? │──Yes──► SWITCH strongly │
│ │ │ preferred │
│ └──────────┬───────────┘ │
│ │ No │
│ ┌──────────▼───────────┐ │
│ │ Live VM migration │ │
│ │ needed between │──Yes──► SWITCH (same L2 │
│ │ devices? │ domain required)* │
│ └──────────┬───────────┘ │
│ │ No │
│ ┌──────────▼───────────┐ │
│ │ EITHER WORKS │ │
│ │ Use organizational │ │
│ │ design pattern │ │
│ └──────────────────────┘ │
│ │
│ * Or use overlay networks (VXLAN) to provide L2 over L3 │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Modern best practice favors routing (Layer 3) over switching (Layer 2) at distribution and core layers. The advantages of broadcast containment, failure isolation, and security filtering typically outweigh the slight latency increase. "Route if you can, switch if you must."
Common Design Patterns
Professional network designs follow established patterns. Understanding these patterns helps you apply the switch/router decision in real architectures.
Pattern 1: Collapsed Core (Small Networks)
For small networks (<500 users), combine distribution and core layers:
┌─────────────────────────────────────────────────────────────────────────────┐
│ COLLAPSED CORE / DISTRIBUTION │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ ACCESS LAYER (Switches) │ │
│ │ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ │ │
│ │ │ SW1 │ │ SW2 │ │ SW3 │ │ SW4 │ │ SW5 │ │ SW6 │ │ │
│ │ └──┬───┘ └──┬───┘ └──┬───┘ └──┬───┘ └──┬───┘ └──┬───┘ │ │
│ └──────┼─────────┼─────────┼─────────┼─────────┼─────────┼────────────┘ │
│ └─────────┴─────────┼─────────┴─────────┴─────────┘ │
│ │ │
│ ┌──────────────────────────┴───────────────────────────────────────────┐ │
│ │ COLLAPSED CORE/DISTRIBUTION (Multilayer Switches) │ │
│ │ ┌─────────────────────────────────────────────────────────────┐ │ │
│ │ │ MLS-1 ◄──► MLS-2 │ │ │
│ │ │ (Layer 3 SVIs for all VLANs) │ │ │
│ │ │ (OSPF/EIGRP between them) │ │ │
│ │ └─────────────────────────────────────────────────────────────┘ │ │
│ └──────────────────────────────────────────────────────────────────────┘ │
│ │
│ - Access switches: Pure Layer 2 (VLANs) │
│ - Core/Distribution: Layer 3 (inter-VLAN routing) │
│ - All VLANs terminate at core │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Pattern 2: Traditional Three-Tier (Campus)
For larger networks, separate access, distribution, and core:
┌─────────────────────────────────────────────────────────────────────────────┐
│ THREE-TIER CAMPUS DESIGN │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ACCESS LAYER (Layer 2 Switches): │
│ - Connect end devices │
│ - VLAN assignment │
│ - Port security, 802.1X │
│ ┌────────────────────────────────────────────────────────────────────────┐│
│ │ [ ][ ][ ][ ] [ ][ ][ ][ ] [ ][ ][ ][ ] [ ][ ][ ][ ] ││
│ └────┬──────────┬────┬──────────┬────┬──────────┬────┬──────────┬────────┘│
│ │ │ │ │ │ │ │ │ │
│ DISTRIBUTION LAYER (Layer 3 Routers/MLS): │
│ - VLAN termination │
│ - Route summarization │
│ - Policy enforcement (ACLs) │
│ ┌────┴──────────┴────┴──────────┴────┴──────────┴────┴──────────┴────────┐│
│ │ [DIST-1]◄────────────────────────────────────►[DIST-2] ││
│ └────────────┬───────────────────────────────────────────────┬───────────┘│
│ │ │ │
│ CORE LAYER (Layer 3 High-Speed Routers): │
│ - Fast routing between distribution blocks │
│ - No ACLs (speed priority) │
│ - ECMP for redundancy │
│ ┌────────────┴───────────────────────────────────────────────┴───────────┐│
│ │ [CORE-1] ◄═══════════════════════► [CORE-2] ││
│ └────────────────────────────────────────────────────────────────────────┘│
│ │
│ - Layer 2: Access → Distribution uplinks │
│ - Layer 3: Distribution → Core, between Distribution pairs │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Pattern 3: Modern Spine-Leaf (Data Center)
Data centers increasingly use routed spine-leaf topology:
┌─────────────────────────────────────────────────────────────────────────────┐
│ SPINE-LEAF DATA CENTER │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ SPINE LAYER (Layer 3): │
│ - Pure routing, no servers attached │
│ - ECMP to all leaves │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ [SPINE-1] [SPINE-2] [SPINE-3] [SPINE-4] │ │
│ │ │ │ │ │ │ │
│ │ │ ╲ ╱ │ ╲ ╱ │ ╲ ╱ │ │ │
│ │ │ ╲╱ │ ╲╱ │ ╲╱ │ │ │
│ │ │ ╱╲ │ ╱╲ │ ╱╲ │ │ │
│ │ │ ╱ ╲ │ ╱ ╲ │ ╱ ╲ │ │ │
│ │ │ │ │ │ │ │
│ │ [LEAF-1] [LEAF-2] [LEAF-3] [LEAF-4] │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │
│ LEAF LAYER (Layer 3): │
│ - Servers connect here │
│ - Each rack is its own subnet │
│ - VXLAN for L2 extension when needed │
│ │
│ Key characteristics: │
│ - EVERY link is Layer 3 (routed) │
│ - ECMP provides full bandwidth utilization │
│ - No STP, no blocked links │
│ - Any-to-any with consistent 2 hops (leaf-spine-leaf) │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Notice how modern designs push Layer 3 closer to the edge. Traditional designs had large Layer 2 domains; modern designs use Layer 3 almost everywhere, with overlays (VXLAN) providing Layer 2 connectivity only where absolutely required (like VM migration).
Cost and Operational Considerations
Beyond technical factors, practical considerations often influence the switch/router decision.
Capital Costs (CapEx):
| Factor | Layer 2 Switch | Layer 3 Router/MLS |
|---|---|---|
| Per-port hardware cost | Lower (simpler ASIC) | Higher (routing engine) |
| Port density | Higher (48-port common) | Lower for traditional routers |
| Memory requirements | Lower (MAC table) | Higher (routing table, ACLs) |
| Power consumption | Lower | Higher per port |
| Rack space | More efficient | Less efficient (varies) |
Operational Costs (OpEx):
| Factor | Layer 2 Heavy | Layer 3 Heavy |
|---|---|---|
| Configuration complexity | Lower (VLANs simple) | Higher (IP planning, routing protocols) |
| Troubleshooting difficulty | Higher (L2 issues hard to trace) | Lower (traceroute, routing tables) |
| Change management | Simpler moves | IP reconfiguration needed |
| Monitoring complexity | Lower | Higher (more metrics) |
| Staff expertise required | Basic networking | CCNP/expert level |
The Troubleshooting Reality:
One often-overlooked factor: Layer 3 issues are easier to troubleshoot than Layer 2 issues.
┌─────────────────────────────────────────────────────────────────────────────┐
│ TROUBLESHOOTING COMPARISON │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ LAYER 2 PROBLEM: │
│ - Packet disappears somewhere in network │
│ - No visibility after the switch forwards │
│ - Must check MAC tables on every switch │
│ - STP issues can be very hard to diagnose │
│ - Duplicate MAC addresses cause mysterious failures │
│ │
│ LAYER 3 PROBLEM: │
│ - traceroute shows exactly where packet stopped │
│ - show ip route reveals forwarding decision at each hop │
│ - ping tests reachability at each segment │
│ - Routing table and log analysis pinpoints issues │
│ - Path is deterministic and visible │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
While Layer 2 appears simpler, large Layer 2 domains often create higher troubleshooting costs. A single broadcast storm or STP misconfiguration can consume days of engineer time. The upfront complexity of Layer 3 often saves money in long-term operations.
Hybrid Approaches: Getting the Best of Both
Modern networks rarely use pure Layer 2 or pure Layer 3 approaches. Hybrid strategies combine the benefits of both.
Multilayer Switches (MLS):
Multilayer switches combine switching and routing in one device:
- Ports can be configured as Layer 2 (switchports) or Layer 3 (routed ports)
- SVIs (Switch Virtual Interfaces) provide Layer 3 interfaces for VLANs
- Single device handles both intra-VLAN switching and inter-VLAN routing
- Wire-speed routing using hardware ASICs
Overlay Networks (VXLAN):
VXLAN creates Layer 2 segments over Layer 3 infrastructure:
┌─────────────────────────────────────────────────────────────────────────────┐
│ VXLAN OVERLAY │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ OVERLAY (Virtual Layer 2): │
│ ┌──────────────────────────────────────────────────────────────────────┐ │
│ │ VM-A ◄───────────── VXLAN Tunnel ───────────────► VM-B │ │
│ │ (VLAN 100) Appears as L2 (VLAN 100) │ │
│ │ 192.168.1.10 same broadcast domain 192.168.1.11 │ │
│ └──────────────────────────────────────────────────────────────────────┘ │
│ │
│ UNDERLAY (Physical Layer 3): │
│ ┌──────────────────────────────────────────────────────────────────────┐ │
│ │ VTEP-A ────► [Spine Switches, IP Routed] ────► VTEP-B │ │
│ │ 10.0.0.1 Full ECMP routing 10.0.0.2 │ │
│ └──────────────────────────────────────────────────────────────────────┘ │
│ │
│ Benefits: │
│ - Virtual Layer 2 connectivity without physical L2 limitations │
│ - Underlay uses IP routing (scalable, ECMP, no STP) │
│ - L2 segments can span data centers │
│ - VM migration works across routed infrastructure │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Routed Access Layer:
The most modern approach: push Layer 3 all the way to access switches:
┌─────────────────────────────────────────────────────────────────────────────┐
│ ROUTED ACCESS │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ Traditional (L2 to Distribution): │
│ ┌────────────────────────────────────────────────────────────────────────┐│
│ │ Access SW ──[VLAN trunks, STP]──► Distribution ──[L3]──► Core ││
│ │ (L2) (L3) (L3) ││
│ └────────────────────────────────────────────────────────────────────────┘│
│ │
│ Routed Access: │
│ ┌────────────────────────────────────────────────────────────────────────┐│
│ │ Access SW ──────[IP routing]────────► Aggregation ──────► Core ││
│ │ (L3!) (L3) (L3) (L3) ││
│ │ ││
│ │ Each access switch: ││
│ │ - Runs routing protocol (OSPF/BGP) ││
│ │ - Has its own /24 or /23 subnet ││
│ │ - Advertises connected networks ││
│ │ - Provides default gateway locally ││
│ └────────────────────────────────────────────────────────────────────────┘│
│ │
│ Advantages: │
│ - No STP anywhere in the network │
│ - ECMP from every switch to core │
│ - Default gateway is always local (lower latency) │
│ - Failure isolated to single switch/subnet │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
The industry trend is toward routed access with VXLAN overlays: physical infrastructure is fully routed (no STP, full ECMP), while VXLAN provides virtual Layer 2 connectivity only for specific workloads that require it. This gives maximum scalability with flexibility where needed.
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.