Switch vs Router: What’s the Difference?
Does your application need a router? Is a switch with routing protocols sufficient? What’s the difference between a “router” and an “L3 switch”? What is a “multi-layer switch”? As networking products have become more complex, the definitions of “switch” and “router” have evolved. Understanding what distinguishes between these different roles is key to selecting the right networking solution.
In the past, the distinction between switches and routers was simple – it was all about “layers” as defined by the OSI model, which breaks down end-to-end communication into various roles (see more information). Switches forward using the “Layer 2” (data link) address, whereas routers forward using the “Layer 3” (network) address. For example, an Ethernet switch would forward based on the destination address in the header of the Ethernet frame; a router would forward using the destination IP address in the IP packet header. This sounds like a small difference, and indeed it is. In both cases, the switch or router must look up the destination address in a data structure to figure out which interface to use for the next hop. In practice, however, the nature of Layer 2 and Layer 3 addressing schemes made the process substantially different.
An Ethernet switch forwards traffic based on learning which MAC address is connected to which interface. Then, any time it receives a frame, it looks up that address to determine what to do. The key is that Ethernet switches are designed to operate on a local-area network, which has a limited number of hosts (usually less than 2,000, even for large campus networks). Because of this limitation, Ethernet switches can be designed using hardware optimized for fast lookups in a small table (typically using content addressable memory, known as CAM). As long as the number of hosts on the network is limited, switches can typically do lookups in hardware and forward at line-rate.
Login to download this resource