Cancel
https://media.fs.com/images/community/uploads/post/202008/28/1-layer-2-vs-layer-3-switch-thumbnail-9.jpg

Layer 2 vs Layer 3 Switch: Which One Do You Need?

November 8, 2017

Generally, a Layer 2 switch is one of the basic equipment used to connect all network and client devices. But for now,  layer 3 switch is thriving in data centers, complicated enterprise networks and commercial applications with the growing diversity of network applications and the converged network implementations. There comes the question: layer 2 vs layer 3 switch, which is the network switch of choice?

Layer 2 Switch and Layer 3 Switch: What Are They?

Layers 2 switch and layer 3 switch are adopted in the Open System Interconnect (OSI) model, which is a reference model for describing and explaining network communications. The OSI model has seven layers: application layer, presentation layer, session layer, transport layer, network layer, data link layer and physical layer, among which layer 2 and layer 3 refer to the data link layer and network layer respectively, and the switches working in these layers are called layer 2 switch and layer 3 switch.

Layer 2 & Layer 3 in OSI model


Figure 1: Layer 2 & Layer 3 in OSI model.

Layer 2 vs Layer 3 Switch

The layer 2 and Layer 3 differs mainly in the routing function.  A Layer 2 switch works with MAC addresses only and does not care about IP address or any items of higher layers. Layer 3 switch, or multilayer switch, can do all the job of a layer 2 switch and additional static routing and dynamic routing as well. That means, a Layer 3 switch has both MAC address table and IP routing table, and handles intra-VLAN communication and packets routing between different VLANs. There is also layer 2+ (layer 3 Lite) switch that adds only static routing. Other than routing packets, layer 3 switches also include functions that require to understand the IP address information of data entering the switch, such as tagging VLAN traffic based on IP address instead of manually configuring a port. Layer 3 switches are increased in power and security as demanded.

When lingering between Layer 2 and Layer 3 switches, you should think about where it will be used. If you have a pure Layer 2 domain, you can simply go for Layer 2 switch. A pure Layer 2 domain is where the hosts are connected, so a Layer 2 switch will work fine there. This is usually called access layer in a network topology. If you need the switch to aggregate multiple access switches and do inter-VLAN routing, then a Layer 3 switch is needed. This is known as the distribution layer in the network topology.

when to use Layer 2 switch, Layer 3 switch and router


Figure 2: when to use Layer 2 switch, Layer 3 switch and router?

Item Layer 2 Switch Layer 3 Switch
Routing Function Mac address only Supports higher routing such as static routing and dynamic routing
VLAN Tagging Based on IP Address No Yes
Inter-VLAN No Yes
Using Scenario Pure Layer 2 domain Aggregate multiple access switches

Layer 2 vs Layer 3 Switch: Key Parameters to Consider When Purchasing

If you are buying a Layer 2 or Layer 3 switch, there are some key parameters that you should check out, including the forwarding rate, backplane bandwidth, number of VLANs, memory of MAC address, latency, etc.

The forwarding rate (or throughput rate) is the forwarding capabilities of a backplane (or switch fabric). When the forwarding capabilities are greater than the sum of speeds of all ports, we call the backplane non-blocking. The forwarding rate is expressed in packets per second (pps). The following formula gives how to calculate the forwarding rate of a switch:

Forwarding Rate (pps) = number of 10Gbit/s ports * 14,880,950 pps + number of 1 Gbit/s ports * 1,488,095 pps + number of 100Mbit/s ports * 148,809 pps

For example, FS S5850-32S2Q has 32 10 Gbit/s ports and 2 40 Gbit/s ports, so its forwarding rate is:

32 * 14,880,950 pps + 2 * 4 * 14,880,950 pps = 595,238,000 pps ≈ 596 Mpps

The next parameter is the backplane bandwidth or switch fabric capacity, which is the sum of speeds of all ports. The sum of speeds of all ports are counted twice, one for Tx direction and one for Rx direction. Backplane bandwidth is expressed in bits per second (bps or bit/s).

Backplane Bandwidth (bps) = port number * port data rate * 2

So the backplane bandwidth for S5850-32S2Q is:

(32 * 10 Gbps + 2 * 40 Gbps) * 2 = 800 Gbps

Other important parameters are number of VLANs that can be configured. Generally, 1K = 1024 VLANs is enough for a Layer 2 switch, and the typical number of VLANs for Layer 3 switch is 4k = 4096. Memory of MAC address table is the number of MAC addresses that a switch can keep, usually expressed as 8k or 128k. Latency is the delay time that a data transfer suffers. It requires to be as short as possible, so the latency is usually expressed in nanosecond (ns).

Summary

This post has explained the differences of Layer 2 vs Layer 3 Switch. The comparison of their functions is also made, in the hope of solving the problem of deciding between these devices. Also key parameters for measuring a Layer 2 or Layer 3 switch are also discussed. It is not always the case that more advanced device is better, but it is right to choose the most appropriate one for your specific application.

180.1k

You might also be interested in