What is the difference between a layer 3 switch and a router?
Show the answer
Say this first
Both route IP. A layer 3 switch routes in ASICs at line rate across many Ethernet ports at a low cost per port, but with limited route and ACL tables, small buffers and a narrow feature set. A router forwards in software or a network processor and is built for the edge: WAN interfaces, full BGP tables, NAT and IPsec at scale, deep buffers and per-flow shaping. In a campus the layer 3 switch routes between VLANs; the router or firewall sits at the WAN and internet edge.
Go deeper
| Layer 3 switch | Router | |
|---|---|---|
| Forwarding | Fixed-function ASIC | CPU or programmable network processor |
| Ports | Dense Ethernet | Fewer, mixed: Ethernet, LTE, serial, SFP |
| Route scale | Bounded by TCAM | Large, full internet tables on edge routers |
| Features | ACLs, basic QoS, some NAT and MPLS on newer models | NAT, IPsec, zone firewall, hierarchical shaping, SD-WAN |
| Buffers | Shallow | Deeper |
| Cost per port | Low | High |
The line is blurring. Campus switches now do VXLAN and some MPLS, data center switches hold large tables, and routers carry switch modules. The useful question is: what must this box do, at what scale, with which features in the forwarding path?
They will ask next
Why not take a full internet routing table on a campus core switch?
The full IPv4 table is around a million prefixes, far beyond what campus switch hardware tables hold. At the edge you take a default route or a partial table on the switch, or put a real router there.
Traps
- Saying a layer 3 switch cannot run routing protocols. It runs OSPF, EIGRP and BGP; the limits are scale and features.