Compare

Side-by-side on the decisions that recur: TCP vs UDP, HTTP/2 vs HTTP/3, flow vs congestion control, L4 vs L7, forward vs reverse proxy, IPv4 vs IPv6 — with when to choose each.

SwitchRouter
Forwards byDestination MAC address (layer 2)Destination IP address, longest-prefix match (layer 3)
Learns fromSource MACs of frames it sees — a MAC table per portConfigured routes and routing protocols (OSPF, BGP)
ScopeOne broadcast domain / LANBetween networks; broadcasts stop here
Unknown destinationFloods the frame out every portUses the default route or drops with ICMP unreachable
Changes the packetNothing — the frame passes throughRewrites source/destination MAC, decrements TTL
Typical failureLoops (spanning tree), MAC table overflow, wrong VLANMissing route, black hole, asymmetric path
Choose this whenConnecting hosts inside one network segment — the office floor, a rack, a VLAN.Connecting one network to another — the office to the internet, one subnet to the next, or any hop in between.