In the course of their studies, many newbie networkers get hung up on the differences between a router and a switch, so I wanted to take a moment to offer modern definitions for the two terms.
Traditionally - I'm talking about a decade ago - a router was a device which made forwarding decisions at layer three and was software-based, whereas a switch was hardware-based and forwarded traffic based on layer two addresses. The two classifications have grown toward one another in recent years, with terms like "integrated bridging" and "multilayer switch" resulting in a significant amount of terminology overlap.
Helping to perpetuate the confusion are small office/home office (SOHO) devices which typically embed a switch within a router as is illustrated below. A similar design is found in enterprise routers employing Ethernet switch modules.
My advice to newbies is this: rather than relying on traditional definitions, a network device should be classified on its actual function in a network. The following are some of the major differentiating characteristics of routers and switches in modern networks.
- Forward packets based on information at layer 3 and above
- Establish network address translation (NAT) boundaries
- Terminate virtual circuits (VPNs)
- Encrypt and decrypt traffic
- Implement complex filters (stateful inspection, routing policy, etc.)
- Support modular physical interfaces of several types
- Forward packets (frames, if you prefer) primarily at layer 2
- Aggregate many connections into a few higher-bandwidth links
- Provide a much higher-throughput backplane
- Include mostly fixed copper or fiber Ethernet interfaces
You might have noticed that I did not include routing protocols on the routers list. This because often even edge switches will run a routing protocol if configured with routed interfaces.
Generally speaking, a device marketed as a router is always deployed as such. The confusion regarding device classification stems from multilayer switches (those with interfaces which can be configured to operate at layer two or at layer three). Again, classification should be made only considering the device's ultimate implementation.
As an example, consider an access edge device which aggregates a few dozen workstations to one or two routed distribution links through a VLAN interface (SVI). Though technically a router, the device can be readily recognized as fulfilling the duties of a switch.
A second example: suppose a multilayer switch such as the Cisco Catalyst 3560 is employed as a low-cost CPE device to terminate a Metro Ethernet link at the WAN edge. The switch serves only two or three routed links. Although designed as a switch, the device's role in this instance is primarily as a router.
In reality, terminology is never perfect, and it doesn't need to be. Avoid getting hung up on ambiguous labels and learn to classify devices by the roles they fill.