Layer 2 vs Layer 3 Switches: A Comparison of Network Devices

A network consists of several devices that work in tandem with one another in order to process, route, and connect data packets. For instance, the local internet network that you connect to at home is likely to use a router, a switch which buffers, boosts, and error checks data, a hub where all data is routed to, and a bridge which helps filter data source and destination. In this article, we will specifically be discussing layer 2 vs layer 3 switches within networks; what they are, how they are different, and how they are used in real-life situations.

Understanding a Layer 2 Network Switch: What Is It?

A layer 2 switch is a data link layer device that traditionally operates on layer 2 of the Open System Interconnect (OSI) model. A layer 2 switch is responsible for “switching” packets from the physical port on the switch to a Media Access Control (MAC) Address. It allows for the connection of multiple devices on a local area network (LAN) but can only work with MAC addresses.

How Does a Layer 2 Switch Work?

It works by employing packet switching, packet header inspection, and collision domain reduction. Essentially, when data is sent through the network, the switch will inspect the packet header and compile a table of MAC addresses. A MAC address is simply a unique identifier that is assigned to a network interface controller and is used to address all communications within a network. These MAC addresses are then linked up to their corresponding physical port on the switch device through Address Resolution Protocol (ARP).

Table of MAC addresses and corresponding physical ports.

What Is The Address Resolution Protocol?

To put it briefly, when a layer 2 switch is sending a data packet to a host device for the first time, it is not going to know the correct MAC address. So, it sends out an “ARP” request to all physical ports on which the host devices are connected to, and when the switch gets a response back with the MAC address, it adds the MAC address to its table. Essentially, the switch learns which MAC addresses are associated with which physical ports, allowing the free-flow of data between devices on the network.

Network diagram illustration of an ARP request and response.

Routing Data With Layer 2 Switches

The switch will then use packet switching to break down the data into small “packets” of information. Rather than sending one large chunk of information across the network (which would be slow), these much smaller packets are quick and efficient to route through the network. In using packet switching, collision domain is reduced. Collision domain occurs when two or more hosts try to communicate at the same time. Network efficiency becomes diminished and the data packets/frames will collide, and they will need to be resent.

Advantages of Layer 2 Switches

  • Low cost to implement due to no routing gear needed.
  • Very low latency.
  • Excellent for LAN networks where data is sent from host to host device on the network.

Disadvantages of Layer 2 Switches

  • Susceptible to broadcast storms (Collision Domain) that decreases network efficiency and creates congestion.
  • Does not work well with multiple VLANs.
  • Not Scalable.

Layer 2 Switch Recap

To recap, a layer 2 switch is designed to only work with Media Access Control (MAC) Addresses, and uses packet switching to transfer tiny packets of data between host computers on a network. It works by connecting MAC addresses with the physical ports on the switch.

Understanding a Layer 3 Network Switch: What Is It?

A layer 3 switch operates on the network layer of the Open System Interconnect (OSI) model. It works similarly to a layer 2 switch, in that it can work with MAC addresses in the same way, however, they can also work with Internet Protocol (IP) addresses too. This means that they are not only able to transfer packets between host computers, but are also capable of connecting with devices on other networks. Layer 3 switches work faster than conventional routers and can route data packets without additional hops, leading to quicker performance and functionality. However, their extra capabilities are not always necessary and are usually only implemented if VLAN routing is needed or in small-scale industries where more support is needed (university campuses for example).

Layer 3 switching illustrated on a network

Advantages of Layer 3 Switches

  • Eliminate the need for dedicated routers.
  • Reduces number of network devices under management and maintenance.
  • Faster switching speed.
  • Infinite scalability.
  • Provides multiple routing paths for data.
  • Has highly secure paths for data exchange.

Disadvantages of Layer 3 Switches

  • Requires more power and bandwidth to operate.
  • Can be expensive to implement.
  • No additional benefits if the network is small.

What’s The OSI Model?

Now, we’ve mentioned OSI or Open Systems Interconnection Model a few times as both layer 2 and layer 3 switches belong within this conceptual framework. The OSI Model is a framework that was published back in 1984 by the International Organization for Standardization (ISO) and is used to describe the different layers of networking systems.

There are 7 layers in total in the OSI Model:

  1. Physical
  2. Data link
  3. Network
  4. Transport
  5. Session
  6. Presentation
  7. Application

Layer 2 and layer 3 switches are within the data link and network layers respectively.

7 network layers of the OSI model

Layer 2 vs Layer 3 Switches Comparison Table

Layer 2 SwitchesLayer 3 Switches
Operates on the Data Link Layer.Operates on the Network Layer.
Sends Packets/Frames via Physical Port & MAC Addresses Only.Can Route Packets via MAC & IP Addresses.
Can Only Work With MAC Addresses.Can Function as a Layer 2 or 3 Switch.
Can Reduce Traffic on Local Area Networks.Is Used in Small-Scale Industries & Where Virtual Local Area Networks Are (VLAN).
Is Extremely Fast & Efficient – Only Looks at Data Packet Header.Is Slower as Layer 3 Switches Examine Data Packets Before Sending.
Has a Single Broadcast Domain.Has Multiple Broadcast Domains.
Communications Within the Network Only.Can Communicate Within or Outside of the Network.

Use Cases of Layer 2 vs Layer 3 Switches

When it comes to recommending a layer 2 or layer 3 switch, the answer depends on the size and complexity of the network, as well as, the security requirements needed for the network to run efficiently and securely.

Typical Applications of Layer 2 Switches

While you may not know it, you are already familiar with a layer 2 switch; your computer’s Ethernet connection acts as a data link layer, connecting your computer with the network via MAC addresses.

Another application of layer 2 switches is with software companies that have centrally located servers where clients who are dispersed across the globe, can access the one central server without latency.

Another real world application is in organizations that rely on internal communications but don’t need the internet – they may use a VLAN network via a layer 2 switch. A final example would be with software testers who want to keep their sharing tools centrally located, but allow another server to access them without being physically connected to the same network.

Typical Applications of Layer 3 Switches

When MAC addresses are simply not enough, layer 3 switches can make use of the Internet Protocol (IP) Addresses to connect devices to different IP networks. You’ve already come into contact with a layer 3 switch via your internet router.

Other applications of layer 3 switches include university campuses or data centers that have vast computer networks set up. If a network has thousands of users or the network infrastructure requires heavy device management for the roll-out of patching or policy updates, or if you need specific control rules activated on certain devices within the network, a layer 3 switch is more appropriate due to its firewall protections.

The Key Takeaway

The main thing to remember when comparing layer 2 vs layer 3 switches is that the difference is in the routing capability of the switch. With layer 2 switches, there is no routing algorithm used and instead, the switch uses Address Resolution Protocol (ARP) to switch data from a physical port to a MAC address and compiles a MAC table for future packets. With layer 3 switches, they follow a routine algorithm that can send data from a host network to another device outside the host via Internet Protocol Addresses.

Leave a Comment