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.
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.
Figure 2: when to use Layer 2 switch, Layer 3 switch and router?
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.