Aug 02, 2011

What's the difference between a layer 3 switch and a router?

I've been getting a lot of bull from a sales rep who is pushing me to make some infrastructure upgrades. What's the difference between a layer 3 switch and a router?

Shashank Juyal

well ,not much actually.

A layer 3 switch is essentially a router that can route and was designed primarily for large LAN networks.Layer 3 switches helps in facilitating faster switching between inter vlans.You can use a Layer 3 switch if you do not want to use a router for inter vlan switching.But remember, a layer 3 switch does not has a WAN port.

                             During data communication the fist packet is always routed using up the routing table just as in the case of a normal router however the switching capabilities help the L3 switch to remember the source and destination MAC addr. hence from thereon the other packets are simplly switched.


The differences between Layer 3 switches and routers are spelled out pretty clearly here:






A Layer 3 switch is both a switch and a router.  Let's have some definitions to help understand this.  A router uses IP addresses -- ISO Layer 3 addresses -- to determine which of typically a few attached interfaces a packet should be routed to.  A switch uses Ethernet MAC address -- ISO Layer 2 addresses -- to "learn" which devices are attached to a port, and route packets to that port.  A router is a device used to connect different networks, while a switch is the backbone of a network.  


A "Layer 3" or "routing" switch is simply a switch that has the added ability to do Layer 3 routing, typically by partitioning sets of ports into separate virtual LANs and routing between them.  Even very small switches, like the one built into commercial home routers and wireless access point/routers, work this exact way: assign one port to the "internet" group, perhaps one port to a DMZ group, and the rest of the ethernet ports to a LAN group.  The wireless routers typically "bridge" the WLAN and LAN, so they appear as a single network.


Here's how it works.  Let's say your computer and your printer are both attached to switch ports on your routing switch.  When your computer and your printer are turned on, they start sending packets asking for the IP address, etc.  The switch "learns" the MAC address of your computer and that it's on port 2, the printer on port 4, etc.  When you try to print something, since the printer is on your local network, your computer sends out packets with the destination set to the printer's MAC address.  The switch sends these packets directly to port 4, and the return packets with your computers MAC address directly to port 2, without ever involving the computer that does the routing.


When you send an email to your email server up in the cloud, your computer doesn't know the MAC address of the email server, because it's not on your LAN.  Your computer instead sends the packets to the MAC address of your router, which is probably a "virtual" port inside the router box.  These packets go into the TCP/IP stack in the router, which looks up where to send them in a routing table, and then sends them out the port connected to your Cable Modem or whatever your upstream link is. 


As is mentioned above, switches typically use very fast hardware, a special type of memory chip known as "Content Addressable Memory" or CAMs, to store and lookup which port a particular MAC address is assigned to.  Early switches used discrete CAM chips, while 2nd generation and later switches incorporate the CAM directly into their switching chips. High-speed routers have replaced much of the software path with hardware as well, but the idea holds the same, Layer 2 switching addresses a single LAN, Layer 3 routing routes packets between LANs.



Source: Once upon a time, I wrote the code running on CPUs embedded inside a 2nd generation switch ASIC to offload Layer 3 routing into the switching backplane, for a company called Xylan.  In this example, the very first packet you sent to your email server would bubble up to the control CPU and go through software routing, which would place the route into a special CAM, from that point on the CPUs on the backplane would route the packet before it reached the control CPU.


Nowadays since manufacturers separated the control and data planes not a lot. Thye both use ASICS's or network processiors for forwarding and should be able to forward traffic based on layer 2 or layer 3 information at line rate in all packet sizes.


From a marketing perspective a "switch" probably has more ports and a "router" has more routing table scalability.


If you look at kit like the Juniper MX or Cisco ASR there is no difference at all. 

Networking Nerd

The primary difference between switches and routers at layer 3 is the CPU and hardware/software performance.  Routers have historically used more general-purpose CPUs to provide raw horsepower.  All of their functions must be performed in software, since their processors aren't specialized.  This is why they can do more complex things like QoS policies.  Routers also have expansion slots and cards that allow them to use different media types, like serial connections for T1 and T3 circuits.


Layer 3 swtiches, on the other hand, use Application-Specific Integrated Circuits (ASICs) to perform their tasks.  These purpose-built chips are very fast at their jobs, but they are also very specific to their role.  An ASIC designed do packet forwarding really can't do QoS, for example.  ASICs allow layer 3 switches to forward packets very quickly, but at the cost of not providing some advanced services that must be done in software.  Layer 3 switches are usually Ethernet connection type only.


In the end, look at what your network design looks like.  If all you need is "dumb" device at the edge to forward packets back and forth with no real intelligence, a layer 3 switch will provide you with great performance.  But if you want to start adding in additional value to the edge, like Quality of Service, you're going to need to stick with a router.  As well, if your edge devices are T1 or T3 circuits, you will likely need to stay with a router for the time being.


Hi ,


As a few points of summary of what i read about layer 3 switch and router difference iare


1.they dont have wan ports.,

2.they dont perform some advance router-rich operation like QOS, NETFLOW 


Correct me if am wrong , i usually worked with cisco products alone.,so just went through cat 6k specifications which is layer3switch which happen to perform QOS , NEtFLOW , other router-rich functions., 

so still the above two arguments or difference holds good ?

Thanks in advance


Traditionally, switches are faster than routers because routers have the ability to filter traffic - that's how come we see so many firewalls and NAT used with routers. Switches traditionally only function at Layer 2 of the 7 layer OSI model. But Layer 3 switches have the ability to route traffic from network 1 to network 2, so they can function similarly to routers.

Answer this
ASK a question