Switch vs Router: Layer 2 Switching vs Layer 3 Routing
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 SwitchRouterSingle broadcast domainSwitchPC1PC2PC3Forwards by MAC address10.0.1.0/24PCPCInternetWANRouterForwards by IP address, links networks 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 ...