Categories
Computer Networking

What are L2 and L3 Switches?

What is a Switch?

A Switch is a network device used to forward traffic within a LAN (Local Area Network).

It is a Layer 2 (Data Link) device on the OSI Model.

A switch in a network.
A switch in a network.

Switches Characteristics

switch
Photo by Manuel Wagner via pixabay
  • They have a lot of ports (minimum 24), so many clients and servers can connect to it. This is highly practical in a large LAN.
  • They (L2 switches) do not connect to other LANs.
  • They use the MAC Address to forward frames to the right destination.

What is a Layer 3 Switch?

Although we usually say that a Switch is a Layer 2 networking device, there are switches called L3 Switches that operate at both Layer 2 and Layer 3, which is why we refer to them as Multilayer Switches (MLS).

Being a Layer 3 device, they play almost the same role as a router, but they are much faster.

You’d think that if we have a L3 switch, then we won’t need a router!

Unfortunately, that would be far too simple. Because switches, including L3 switches, lack WAN (Wide Area Network) interfaces, they can’t connect to other LANs.

So, what do we do with them?

Layer 3 Switch and VLANs

We generally use L3 Switches with VLANs.

Two VLANs connected to a network via a L3 switch.
Two VLANs connected to a network via a L3 switch.

To segment network traffic and make it more secure, we implement several VLANs (Virtual Local Area Network) within the LAN.

Of course, these VLANs need to communicate with each other.

So first, we can connect each VLAN to a L2 switch, as a router wouldn’t have enough ports. In fact, if for example we have 5 devices in a VLAN, considering a router usually have 4 Ethernet ports maximum, we wouldn’t be able to connect them all to the router.

Then we can connect those switches to a L3 switch (same as above, a switch has way more ports than a router so it is easily scalable in case the network gets bigger in the future) that will perform something called Inter-VLAN Routing, enabling the different VLANs to communicate with each other.

To finish, we connect the L3 switch to a router that will send data packets to the Internet through a modem.

References:
Jeremy’s IT Lab: Free CCNA | Network Devices | Day 1 | CCNA 200-301 Complete Course
My Computer Notes: Layer 2 and Layer 3 Switches in Networking
Happy Routing: Layer 3 Switches Explained