What's the difference between a Layer 2 & Layer 3 switch?

I've always wondered and never needed to know until now.

link|improve this question

See the related question (serverfault.com/questions/2219/…) – Zoredache Mar 18 '10 at 6:31
feedback

3 Answers

up vote 9 down vote accepted

I will complete Zoredache's answer.

A L2 switch does switching only. This means that it uses MAC addresses to switch the packets from a port to the destination port (and only the destination port). It therefore maintains a MAC address table so that it can remember which ports have which MAC address associated.

A L3 switch also does switching exactly like a L2 switch. The L3 means that it has an identity from the L3 layer. Practically this means that a L3 switch is capable of having IP addresses and doing routing. For intra-VLAN communication, it uses the MAC address table. For extra-VLAN communication, it uses the IP routing table.

This is simple but you could say "Hey but my Cisco 2960 is a L2 switch and it has a VLAN interface with an IP !". You are perfectly right but that VLAN interface cannot be used for IP routing since the switch does not maintain an IP routing table.

link|improve this answer
So if a L3 switch had two hosts on separate VLANs it could route between them rather than going through a router? – Jon Rhoades Mar 18 '10 at 7:49
Possibly. Most with routing can. heck, my extreme networks summit supports all major dynamic routing protocols AND can be "split" into multiple logical routers if needed. Routing between VLAN's is the smallest part - and works REALLY nice. The bad side is th ecost of such a beast ;) – TomTom Mar 18 '10 at 8:01
2  
If you've got a lot of L2 vlans, which overlay L3 subnets, then you needed something called a one armed router aka router on a stick. Thus, if you had a lot of intra vlan traffic then this would be come the bottle neck. L3 switches can fulfil this job. cisco-tips.com/cisco-router-on-a-stick-with-switch now, you can think of the layer 3 engine being integrated into the switch itself. – The Unix Janitor Mar 18 '10 at 15:18
feedback

The layer 3 vs 2 refers to the OSI model. A layer 3 switch supports routing. A layer 2 switch only knows ethernet, you may be able to setup VLANs.

link|improve this answer
Adding to that a layer 2 switch normally does hardware routing. It basically sets up a hardware switch module based on bytes in the ethernet packet for "switching the packets according to route". So it is / can be a LOT more efficient than a normal software based router implementation. Some of those get pretty powerfull (looking at the direction of Extreme Networks). – TomTom Mar 18 '10 at 6:34
feedback

Layer 2 is generally hardware i.e. mac address "routing" or mac tables. Layer 3 has to do with ip's. Layer 3 devices are usually managed and they can create and route between vlans.

link|improve this answer
This isn't all necessarily true and has already been covered by previous answers. – Chris S Feb 7 at 16:16
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.