What is the Difference Between Switches and Routers?
Today I received an email from an INE customer who is studying for their CCNA and they posed this question to me. I believe that many learners who are new to networking have the same question so I thought I'd share the answer I gave him...with you, in the hopes that others may also benefit.
If you had asked me this question about thirty years ago it would have been an easy answer. I would have told you:
1. Switch - A device that has a single lookup table (called a MAC Address-Table) that has a mapping of MAC Addresses-to-port numbers/interfaces. This device can only look at the destination MAC address of a Layer-2 Ethernet frame to make a forwarding decision.
2. Router - A device that has an IPv4 (and/or IPv6) Routing Table that is a mapping of IP prefixes (i.e. "routes"), the next-hop IP address of a neighboring router to reach that route, and the egress interface on which to transmit outbound packets. A router primarily looks at the destination Layer-3 IPv4/IPv6 address to make forwarding decisions.
The problem is...for the past twenty years or so, many switches now incorporate routing functionality as well...so the line has blurred between routers and switches. So today, there are other distinguishing factors that one has to look at:
- Today's switches generally have a lot more ports/interfaces than routers do. While a typical router might provide 4-8 interfaces, a typical switch will start at 24-interfaces and go up in quantity from there.
- Most switches are Ethernet-only...meaning all of their interfaces are designed to work only with 802.3 (Ethernet) protocols (i.e. Ethernet, FastEthernet, GigabitEthernet and higher). However routers typically provide more flexibility giving you not only Ethernet interfaces but also other types (such as WAN interfaces) for connecting different types of networks together.
- Many switches are "hardware-based" meaning that when an Ethernet frame is received, all lookups and processing of that frame are done using specialized ASICs and memory. In this type of architecture, the CPU (i.e. the "brain" of the switch) rarely actually sees or interacts with user data frames. However routers often have many of their features implemented in their CPU (these are called, "software-based features") and don't have the same type of specialized ASICs and memory that switches do.
- Routers typically offer you more flexibility via features and options that you can enable-and-disable (software-based features) than switches do. And for features that some routers and switches have in common, (like IP Routing) routers will typically provide you with more options and tweaks for fine-tuning those features.
I hope that helps!
Keith
Network en Firewall Engineer bij Previder - CCNA - Meraki - Cens - CCNP Encor / onderweg naar ENARSI
3yGreat Stuff Keith, currently listening to your SD-Access Architecture Network Layer Enhancements course! Your explanations are always so clear! Thanks for being such a great tutor!
Network Engineer Team Lead at Yandex Cloud
3yAnd many switches based on single chip, but routers not (many PFE on LC, etc); most of switches with shared memory and not a deep buffer, but routers vice versa (HQoS, etc).