Why do we say that the Layer 3 forwarding performance of a Layer 3 switch is much more efficient than that of a router? Sometimes in many books it is mentioned that the software of current routers is also very powerful and can almost achieve the ability of speed-limited forwarding; but can software be compared with hardware? It is unlikely; the reason why the switch forwards quickly is that the switch uses a dedicated ASIC hardware forwarding card, while the router is software-based forwarding. We are used to saying that in a Layer 2 network environment, the same VLANs can communicate, but different VLANs cannot communicate. If you want to communicate, you must use Layer 3 devices. So what a Layer 3 switch must do is routing and forwarding, but what is the specific working principle?
First of all, what will the three-layer switch do in the same subnet and different subnet environments, and what are the differences? As shown in the figure above, in the Layer 2 environment, A and B communicate with each other. A sends a data packet with the destination MAC address of B. When it is sent to the switch, the switch forwards it based on the destination MAC address, and then starts to check its own MAC table entries to find the corresponding exit. In the whole process, only the MAC address is looked up, and no changes are made to the data frame. I will only give a brief and simple description of Layer 2 frame forwarding, after all, the focus is not here. In a Layer 3 environment, A and C communicate with each other. A sends a data packet. The destination MAC address should be the gateway MAC address, which is the switch MAC address SMAC. Let me insert a small episode here. Someone once asked me how a switch determines whether to forward at Layer 3. My answer at that time was to see if the MAC address of the data packet is its own. If it is, perform Layer 3 forwarding. Others said that the answer was correct; but when I came back to study this issue, I found that my answer was not rigorous. Why? When a switch receives a data packet with a Layer 2 destination MAC address of its own, what should it do at this time? Let me tell you a little story. I saw a short video on WeChat a few days ago. It was about a university classroom where two boys liked the class beauty sitting behind them so much that they kept looking at her. Suddenly, the girl stood up and prepared to leave. When she passed by them, she handed a rolled-up note to the boy sitting next to her. Physically, the girl handed the note to the boy. What would the boy do next? Would he open the note to see what was written inside? When the Layer 3 switch receives the destination MAC address as its own, it also needs to decapsulate it to the upper layer and check the Layer 3 destination IP address. Then what? ?At that time, the boy took the note very happily, and then opened it. It said "Please pass the note to the next person" on it. Haha, the three-layer switch is also like this. When it sees that the destination IP address is not its own, it performs forwarding at the routing level. So when the switch executes the three-layer forwarding, it is to check whether the IP address is its own while the destination MAC is its own. If it is its own, there is no need to forward it. When the switch determines that the destination IP is not its own, does it necessarily check the routing table? No, this is the key to the switch. The switch will not check the routing table, the ARP table, or the MAC address table at this time; what table will the switch check? The switch will now check the hardware forwarding table integrated in the ASIC hardware forwarding card. What does this hardware forwarding table contain?
Each manufacturer has a different definition in this area, but the principle is the same. Cisco uses the CEF table, and now the router has also integrated software-based CEF, which contains three tables, including the FIB table, the adjacency table (hardware forwarding table) and the netflow table. |
<<: Industrial IoT challenges are daunting, and seven test platforms are particularly important
>>: MIIT releases 5G spectrum planning, China launches mid-band 5G commercialization
Today, the Internet is very prosperous, and mobil...
[[329716]] On June 6, 2012, World IPv6 Launch, ma...
GSA released a report that believes that the freq...
SD-WAN is expected to grow 40% year-over-year thr...
LOCVPS has launched this year's 618 promotion...
HostDare has updated its VPS discount information...
Today, at the Huawei Developer Conference 2020 (C...
Starting from the second half of 2020, the nation...
Web3 is considered to be the future development t...
In the past one or two years, UWB technology has ...
This afternoon, Huawei held a new product launch ...
[[409233]] This article is reprinted from the WeC...
The growing number of “connected” devices is gene...
In the Internet world, HTTP and HTTPS are the two...
Yesterday, I was chatting with a friend who works...