Ethernet switch manufacturers have launched Layer 2, Layer 3 or even Layer 4 switches basing on market demand. But no matter which kind of switches, its core function is still two-layer Ethernet data packet switching, including certain ability to process IP layer or even higher layer data packets. Now, we’d like to introduce the differences and characteristics of layer 2 switch, layer 3 switch and layer 4 switch in detail.
First, Layer 2 Switching
The development of Layer 2 switching technology is relatively mature. Layer 2 switches are data link layer devices that can identify the MAC address information in data packets, forward them according to the MAC addresses, and record these MAC addresses and corresponding ports in one of their own internal address table.
Second, Layer 3 switching
Features of Layer 3 switching:
1) Realizing high-speed forwarding of data by the combination of hardware. This is not a simple combination of layer 2 switches and routers. The layer 3 routing module is directly superimposed on the high-speed backplane bus of layer 2 switching, breaking through the interface rate limit of traditional routers, and the rate can reach dozens of Gbits. Including the backplane bandwidth, these are two important parameters for the performance of a Layer 3 switch.
2) Simplifying the routing process by using simple routing software. Except for the necessary routing selection handled by the routing software, most of the data forwarding is forwarded by the Layer 2 module at high speed. Most of the routing software is processed and optimized software, not simply copying the software in the router.
Selection of Layer 2 and Layer 3 Switches
Layer 2 switches are used in small local area networks. Needless to say, in a small local area network, the fast switching function, multiple access ports and low price of the Layer 2 switch provide a perfect solution for small network users.
The advantages of the Layer 3 switch are that it has rich interface types, powerful three-layer functions, and strong routing capabilities. It is suitable for routing between large networks. Its advantages lie in choosing the best route, sharing load, backup link and other functions such as exchanging routing information that routers have.
The most important function of the three-layer switch is to speed up the fast forwarding of data within the large local area network, and the addition of the routing function also serves this purpose. If a large network is divided into small local area networks according to factors such as departments, regions, and etc., this will lead to a large number of Internet accesses, and the simple use of Layer 2 switches cannot achieve the function of Internet access. Due to the limited number of interfaces and slow routing and forwarding speed, using routers will limit the speed and scale of the network. Thus, it is the first choice to use a layer-3 switch with routing function and fast forwarding.
Third, Layer 4 Switching
The characteristic of layer-4 switching is that each layer-4 switch keeps a connection table associated with the original IP address and original TCP port matching the selected server. Then the fourth layer switch forwards the connection request to this server. All subsequent packets are remapped and forwarded between the client and server until the switch discovers the session. In the case of Layer 4 switching, accesses can be linked with real servers to satisfy user-specified rules, such as having an equal number of accesses per server or distributing traffic according to the capacity of different servers.
To be effective in an enterprise network, Layer 4 switching must provide comparable performance to Layer 3 wire-speed routers. That is, Layer 4 switching must operate at full medium speed on all ports, even over multiple Gigabit Ethernet connections. Gigabit Ethernet speeds equal routing at a maximum speed of 1,488,000 packets per second.
2) Server capacity balancing algorithm
According to the desired capacity balance interval size, there are many algorithms for the layer 4 switch to assign the application to the server, including simple detection of the nearest connection of the loop, detection of loop delay or closed-loop feedback of the detection server itself. Of all the predictions, closed-loop feedback provides the most accurate detection of the server's existing traffic.
3) Routes Table
It should be noted that the Layer 4 switch needs to have the ability to distinguish and store a large number of sending table entries. This is especially true when switches are at the core of an enterprise network. Many L2/L3 switches tend to have a forwarding table whose size is directly proportional to the number of network devices. For Layer 4 switches, this number must be multiplied by the number of different application protocols and sessions used in the network. The size of the dispatch table thus grows rapidly with the number of endpoint devices and application types. Layer 4 switch designers need to account for this table growth when designing their products. Large table capacities are critical to making high-performance switches capable of sending Layer 4 traffic at wire speed.
Layer 4 switch has a function of supporting redundant topology inside. With a fault-tolerant connection of NICs with dual links, it is possible to build a fully redundant system from one server to NICs, links, and server switches.