Overview
A switch connects devices within a single network by forwarding traffic based on MAC addresses, while a router connects separate networks together by forwarding traffic based on IP addresses. Plugging a device into the wrong one is a common source of confusion — one expands a LAN, the other bridges LANs to each other or to the internet.
Comparison Diagram
Comparison Table
| Aspect | Switch | Router |
|---|---|---|
| OSI layer | Layer 2 (Data Link) | Layer 3 (Network) |
| Addressing used | MAC addresses | IP addresses |
| Forwarding table | MAC address table (CAM table), learned automatically | Routing table, built via static routes or routing protocols |
| Broadcast domain | Devices share one broadcast domain (unless VLANs are configured) | Separates traffic into distinct broadcast domains per interface |
| Typical placement | Connects devices within a single LAN segment | Connects different networks together, e.g. LAN to LAN or LAN to WAN |
| Unknown-destination handling | Floods frame to all ports in the VLAN when MAC is unknown | Drops or rejects packets with no matching route |
| Built-in services | Basic switching only, plus optional VLANs/QoS on managed models | Often includes NAT, DHCP, firewall, and VPN functions |
| Typical device | Cisco Catalyst switch in a wiring closet | Home router or edge router linking a LAN to an ISP |
Key Differences
- Switches forward traffic using MAC addresses at Layer 2, while routers forward using IP addresses at Layer 3.
- A switch keeps connected devices in one broadcast domain; a router splits traffic into separate domains.
- Switches flood frames to unknown destinations within a VLAN; routers simply drop packets they can’t route.
- Routers commonly bundle NAT and firewall features that switches don’t provide.
- Switches scale port count for a single network; routers scale the number of distinct networks a device can reach.
When to Use Each
Switch
- Connecting Local Devices: Use a switch to link PCs, printers, and servers within the same LAN for fast, low-latency communication.
- Expanding Port Capacity: A switch adds more physical ports to an existing network segment without changing its addressing.
- VLAN Segmentation: Managed switches can logically separate traffic into VLANs without deploying separate physical networks.
Router
- Connecting Different Networks: A router is required to pass traffic between separate subnets or between a LAN and the internet.
- Providing Internet Access: Home and office routers route traffic from the local network to the ISP’s network.
- NAT and Firewall Needs: Routers translate private addresses to public ones and enforce access rules between networks.