Comparing Layer 3 and Layer 2 Switches (2024)

  1. Last updated
  2. Save as PDF

This article outlinesthe difference between layer 2 and layer 3 switches and the appropriate use cases for each.

Learn more with this free online training course on the Meraki Learning Hub:

Sign in with your Cisco SSO or create a free account to start training.

Traditional switching operates at layer 2 of the Open Systems Interconnection (OSI) model, where packets are sent to a specific switch port based on destination MAC addresses. Routing operates at layer 3, where packets are sent to a specific next-hop IP addressbased on the destination IP address. Devices in the same layer 2 segment do not need routing to reach local peers. However, the destination MAC address is needed. It can be resolved through the Address Resolution Protocol (ARP) as illustrated below:
Comparing Layer 3 and Layer 2 Switches (1)

In the diagram above, PC A wants to send traffic to PC B at IP address 192.168.1.6. It does not know the unique MAC address until it discovers it through an ARP, which is broadcasted throughout the layer 2 segment.
Comparing Layer 3 and Layer 2 Switches (2)

Then, it sends the packet to the appropriate destination MAC address. After that, the switch will forward out the correct port based on its MAC-Address-Table.

Within a layer 2 switch environment exists a broadcast domain. Any broadcast traffic on a switch will be forwarded out to all ports except for the port the broadcast packet arrived on. Broadcasts are contained in the same layer 2 segment, as they do not traverse past a layer 3 boundary.

Large layer 2 broadcast domains can be susceptible to problems, like broadcast storms, which can cause network outages. Also, for security and policy reasons, it is best to separate certain clients into different broadcast domains. This is when it becomes useful to configure VLANs. In turn, the switch ports are in different layer 3 subnets and different broadcast domains. VLANs allow for greater flexibility by allowing different layer 3 networks to be sharing the same layer 2 infrastructure. The image below shows an example of a multi-VLAN environment on a layer 2 switch:

Comparing Layer 3 and Layer 2 Switches (3)

Since VLANs exist in their own layer 3 subnet, routing will need to occur for traffic to flow in between VLANs. This is where a layer 3 switch can be utilized. A Layer 3 switch is basically a switch that can perform routing functions in addition to switching. A client computer requires a default gateway for layer 3 connectivity to remote subnets. When the computer sends traffic to another subnet, the destination MAC address in the packet is for the default gateway. Then, the gateway will accept the packet at layer 2 and proceed to route the traffic to the destination based on its routing table.

The diagram below shows an example of a layer 3 switchrouting between VLANs through its two VLAN interfaces. As before, the layer 3 device will still need to resolve the MAC address of PC B through an ARP request broadcasted out to VLAN 20. It then rewrites the appropriate destination MAC address and forwards the packet back out the layer 2 segment:
Comparing Layer 3 and Layer 2 Switches (4)

Additional Resources

MS Layer 3 Switching and Routing: An overview of how to configure layer 3 routing on Cisco Meraki switches

Layer 3 Switch Example: A configuration example using layer 3 routing on Cisco Meraki switches

Fundamentals of802.1QVLANTagging:Information regarding the appropriate use of VLAN tags

Comparing Layer 3 and Layer 2 Switches (2024)
Top Articles
Latest Posts
Article information

Author: Kimberely Baumbach CPA

Last Updated:

Views: 6360

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Kimberely Baumbach CPA

Birthday: 1996-01-14

Address: 8381 Boyce Course, Imeldachester, ND 74681

Phone: +3571286597580

Job: Product Banking Analyst

Hobby: Cosplaying, Inline skating, Amateur radio, Baton twirling, Mountaineering, Flying, Archery

Introduction: My name is Kimberely Baumbach CPA, I am a gorgeous, bright, charming, encouraging, zealous, lively, good person who loves writing and wants to share my knowledge and understanding with you.