Multi-WAN port traffic distribution method based on VPP
By using the global flow table and VRF mechanism, the WAN port VRF ID in the flow information is recorded, solving the problem that VPP does not provide multi-WAN port traffic diversion, and enabling the forwarding of packets of the same flow on the same WAN port, improving processing performance and network stability.
Patent Information
- Application Number
- CN202411580279.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-11-07
AI Technical Summary
Existing VPP technology does not provide a multi-WAN port traffic diversion solution, cannot ensure that the same flow of messages are forwarded through the same WAN port, does not distinguish between interface type processing logic, and relies on the ACL module and cannot be used independently.
Through the global flow table and VRF mechanism, the WAN port VRF ID in the flow information is recorded to ensure that the packets of the same flow are forwarded on the same WAN port. Different processing logic is used for different types of interfaces, and the diversion strategy is implemented in one module.
It realizes the normal operation of the multi-WAN port diversion function, improves the message processing performance of the diversion function, ensures load balancing and traffic management, and prevents network anomalies.
Smart Images

Figure CN119363669B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a multi-WAN port traffic distribution method based on VPP. Background Art
[0002] A multi-WAN router is one with multiple WAN interfaces. Multiple WAN interfaces offer advantages such as bandwidth aggregation, hot standby, and traffic optimization. These routers are widely deployed in home and enterprise networks. Due to VPP's rich functionality, production-grade quality, and superior framework design, a growing number of routers developed based on VPP are being used in live networks (both physical and virtual). However, VPP currently does not offer a multi-WAN traffic diversion solution. While VPP's ABF (ACL-Based Forwarding) can implement policy-based routing, it has three drawbacks when it comes to multi-WAN traffic diversion: 1. It cannot guarantee that all packets in the same (bidirectional) flow are forwarded through the same WAN interface; 2. It does not distinguish between interface types (LAN / WAN), and the processing logic is the same for all interfaces; and 3. It relies on the ACL module and cannot be used independently. Summary of the Invention
[0003] The present invention aims to implement multi-WAN port traffic diversion based on VPP, requiring only the first packet of each flow to look up the diversion policy (subsequent packets can simply look up the flow table), thereby improving the packet processing performance of the diversion function. Different processing logic is used for packets received by different types of interfaces (WAN / LAN ports), ensuring the proper function of multi-WAN port traffic diversion. The diversion policy and implementation are implemented in a single module, independent of other modules.
[0004] The principle of the present invention is: mainly through the global flow table, diversion strategy and VRF mechanism, to ensure that the same flow LAN port to WAN port and WAN port to LAN port direction of the message is processed on the same WAN interface, to achieve multiple WAN port load balancing and traffic management, and to prevent the flow of inconsistent caused by the network anomalies.
[0005] A multi-WAN port traffic distribution method based on VPP specifically includes the following steps:
[0006] (1) When the LAN interface receives a message, it performs the following steps:
[0007] Query the global flow table based on the five-tuple information of the message received by the LAN interface; the five-tuple information of the message includes the source IP address, destination IP address, source port number, destination port number and protocol number;
[0008] (1.1) If the flow information corresponding to the above message is found, the VRFID of the WAN interface in the flow information is obtained and the VRF ID is added to the message. The LAN port offload processing process is then terminated and the message is sent to the routing module of the VPP for processing.
[0009] (1.2) If the flow information corresponding to the above message is not found, query the routing table based on the destination IP address of the message:
[0010] (1.2.1) If no corresponding default route exists, the LAN port traffic diversion process ends and the message is sent to the VPP routing module for processing;
[0011] (1.2.2) If a corresponding default route exists, continue to search for the predefined diversion policy:
[0012] (1.2.2.1) If no traffic diversion policy exists, the LAN port traffic diversion process ends and the packet is sent to the VPP routing module for processing;
[0013] (1.2.2.2) If a traffic diversion policy exists, flow information for the packet is generated and added to the global flow table. The VRF ID corresponding to the WAN interface in the matching traffic diversion policy is updated in the flow information and the VRF ID is added to the packet. The LAN port traffic diversion process ends and the packet is sent to the VPP routing module for processing.
[0014] (1.3) In the VPP routing module, the virtual routing table corresponding to the WAN port or the default virtual routing table with VRF 0 will be queried based on the VRF ID in the message to complete the routing and forwarding of the message;
[0015] (2) When the WAN interface receives a message, it performs the following steps:
[0016] Query the global flow table based on the five-tuple information of the message received by the WAN interface;
[0017] (2.1) If the flow information of the above message is found, the WAN port offload processing process ends and the message is sent to the VPP routing module for processing;
[0018] (2.2) If the flow information for the above message is not found, the flow information for the message is generated and the VRF ID corresponding to the WAN interface that received the message is updated into the flow information. The WAN port offload processing process is then terminated and the message is sent to the VPP routing module for processing.
[0019] (2.3) In the VPP routing module, since the VRF ID is not marked in the message, the virtual routing table with VRF ID 0 is queried to complete the routing and forwarding of the message.
[0020] Furthermore, the method further includes initialization, which includes initializing the interface type, initializing the offload policy set, initializing and starting a timed detection thread, detecting the connection status and default route of the WAN interface in real time, and updating the offload policy and the VRF table of each WAN interface based on the detection results.
[0021] Furthermore, the VRF ID of the WAN interface is recorded in the flow information to ensure that all packets of the same flow are forwarded on the same WAN interface.
[0022] Furthermore, after querying the global flow table, if no flow information is found for a message received by the WAN interface, new flow information is automatically generated, and the WAN interface receiving the message is used as the outbound interface of the flow to ensure that subsequent flow messages are forwarded from this WAN interface.
[0023] The present invention also provides a computer-readable storage medium storing one or more programs, wherein the one or more programs include instructions that, when executed by a computing device, cause the computing device to perform the method described above.
[0024] The present invention also provides an electronic device comprising one or more processors, one or more memories, and one or more programs, wherein the one or more programs are stored in the one or more memories and are configured to be executed by the one or more processors, and the one or more programs include instructions for executing the method described above.
[0025] Compared with the prior art, the present invention has the following significant advantages:
[0026] 1. Implement multi-WAN port traffic distribution based on VPP;
[0027] 2. Implement multi-WAN port traffic distribution based on VPP, and use different processing logic for different types of (WAN / LAN) interfaces to ensure the normal function of multi-WAN port traffic distribution;
[0028] 3. Multi-WAN port traffic diversion is implemented based on VPP, and the diversion strategy and diversion implementation are implemented in one module, independent of other modules. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is the initialization process.
[0030] Figure 2 It is to detect the thread execution process.
[0031] Figure 3 This is the process of processing messages received by the LAN port.
[0032] Figure 4 This is the process of processing messages received by the WAN port. DETAILED DESCRIPTION
[0033] The following describes the embodiments of the present invention in detail with reference to the accompanying drawings.
[0034] NAT (Network Address Translation) is a technology that converts private (reserved) IP addresses into public IP addresses. It is widely used in various types of Internet access and networks. NAT works by modifying the IP address (and port) in a message according to specified rules.
[0035] VPP (Vector Packet Processing) is an open source version of Cisco's vector packet processing technology. It provides a high-performance packet processing stack that can run on commodity CPUs and deliver production-quality switch / router functionality.
[0036] ABF (ACL-Based Forwarding) is a functional module in VPP that provides packet forwarding based on specific policies. Policy-based routing is a more flexible routing mechanism than destination routing.
[0037] VRF (Virtual Routing and Forwarding) is a network virtualization technology that allows the creation of multiple virtual routing tables on the same physical network device. Each virtual routing table is independent of the others.
[0038] A multi-WAN router is one with multiple WAN interfaces. Multiple WAN interfaces offer advantages such as bandwidth aggregation, hot standby, and traffic optimization. Currently, multi-WAN routers are widely deployed in home and enterprise networks. Due to VPP's rich functionality, production-grade quality, and superior framework design, a growing number of routers developed based on VPP are being used in live networks (both physical and virtual). However, VPP currently does not offer a multi-WAN interface traffic distribution solution. Implementing multi-WAN interface traffic distribution requires two requirements: 1. All packets in the same (bidirectional) flow must be forwarded through the same WAN interface. This means that the forwarding interface for a packet is determined by the first packet of a flow, and subsequent packets of the flow are forwarded using the same forwarding interface as the first packet of the flow. 2. The interface type (WAN / LAN) must be distinguished, and packet processing must be performed differently based on the interface type (WAN / LAN port). Packets received on a WAN port do not require a multi-WAN interface traffic distribution policy; they are forwarded directly by searching the device routing table (VRF 0). Packets received on a LAN port require a multi-WAN interface traffic distribution policy and a WAN port for forwarding. Although ABF (ACL Based Forwarding) provided by VPP can implement policy routing and forward packets according to certain policies, it cannot meet the two requirements of multi-WAN port traffic distribution and its operation depends on the ACL module.
[0039] This application provides a multi-WAN port traffic diversion method based on VPP. By recording the flow table and marking the VRF ID corresponding to the WAN port in the flow information, it ensures that all packets of the same flow (bidirectional) are forwarded through the same WAN port. Different processing logic is used for different types of (WAN / LAN) interfaces to ensure the normal multi-WAN port traffic diversion function. The diversion strategy and diversion implementation are implemented in a single module and are independent of other modules. This method can realize the multi-WAN port traffic diversion function, and only the first packet of each flow needs to look up the diversion strategy (subsequent packets can directly look up the flow table), improving the packet processing performance of the diversion function.
[0040] The specific process of the present invention consists of two parts: initialization and message processing.
[0041] Initialization process, first initialize the interface type (WAN / LAN), and create independent VRF tables for all WAN interfaces; then initialize the diversion strategy, which can support multiple types (MAC, five-tuple, application, etc.); finally initialize and start the detection thread, the specific process is as follows Figure 1 shown.
[0042] Among them, the detection thread is mainly used to regularly detect the WAN port connection status and routing table (VRF 0), and when the WAN port connection status and routing table change, timely update the diversion strategy and the VRF table corresponding to each WAN port. First, check whether the WAN port connection status has changed. If it has changed, the diversion strategy needs to be updated to ensure that only the diversion strategy of all WAN ports with a connection status of UP takes effect; then check the routing table. If the default route of the WAN port has changed, update the VRF table corresponding to the WAN port in time to ensure that the content in the VRF table is the latest default route of the corresponding WAN port (if the default route of the corresponding WAN port does not exist, the corresponding VRF table is empty); finally, the thread sleeps (wait) for a few seconds and then re-executes the following steps: Figure 2 The detection process shown.
[0043] The message processing flow is divided into two cases: messages received by the LAN port and messages received by the WAN port.
[0044] Case 1 (messages received by the LAN port):
[0045] First, after receiving the message, the LAN port network card obtains the message's five-tuple information and uses the message's five-tuple information as the key to query the global flow table. If the corresponding flow information is queried, the VRF ID in the flow information is obtained and the VRFID tag is added to the message. Then, the LAN port diversion processing process is terminated and the message is sent to the VPP routing module for processing.
[0046] For packets for which no flow information is found, the routing table (VRF 0) is queried based on the packet's destination IP address. If the routing table entry exists and is the default route, the next step is executed. Otherwise, the LAN port offload process ends and the packet is sent to the VPP routing module for processing. This step is primarily to prevent the multi-WAN port offload strategy from affecting LAN-to-LAN traffic forwarding. The offload strategy specifies the rules used for offload, for example, selecting the appropriate WAN port based on the packet's source address, protocol, application type, and so on.
[0047] The predefined multi-WAN port traffic diversion policy set is queried again. If the corresponding diversion policy does not exist, the LAN port traffic diversion process is terminated and the message is sent to the VPP routing module for processing. If the diversion policy exists, flow information for this message is generated and added to the global flow table. The VRF ID corresponding to the WAN port is updated in the flow information. Finally, the VRF ID obtained from the flow information corresponding to the message is marked in the message, the LAN port traffic diversion process is terminated, and the message is sent to the VPP routing module for processing.
[0048] After the message enters the routing module of VPP, the VRF table of the corresponding WAN port will be searched according to the VRF ID in the message. The VRF table of the corresponding WAN port only contains the default route corresponding to the WAN port (or the default virtual routing table with VRF 0), ensuring that the message is sent from the corresponding WAN port according to this default route. The specific process is as follows: Figure 3 shown.
[0049] Case 2 (messages received by the WAN port):
[0050] First, after receiving the message, the WAN port network card obtains the message's five-tuple information and uses the message's five-tuple information as an index (key) to query the global flow table. If the corresponding flow information is found, the WAN port traffic diversion process ends and the message is sent to the VPP routing module for processing.
[0051] Then, for the message for which no flow information is found, the flow information for this message is generated and added to the global flow table. At the same time, the VRF ID corresponding to the WAN port that received the message is updated to the flow information. Then, the WAN port diversion processing process is terminated and the message is sent to the VPP routing module for processing. This step is mainly to ensure that the outgoing direction (LAN to WAN) message corresponding to the flow to which this message belongs does not search for multiple WAN port diversion strategies. Instead, the receiving interface (WAN port) of the incoming message of this flow is directly used as the outgoing interface to prevent the outgoing and incoming messages of this flow from using different WAN ports, which may cause network anomalies.
[0052] After the message enters the routing module of VPP, since VRFID is not marked in the message, the routing table (VRF 0) will be queried to complete the routing and forwarding of the message. The specific process is as follows: Figure 4 shown.
[0053] Based on the same technical solution, the present invention also discloses a computer-readable storage medium storing one or more programs, wherein the one or more programs include instructions. When the instructions are executed by a computing device, the computing device executes the above-mentioned VPP-based multi-WAN port traffic diversion method.
[0054] Based on the same technical solution, the present invention also discloses a computing device, including one or more processors, one or more memories, and one or more programs, wherein the one or more programs are stored in the one or more memories and are configured to be executed by the one or more processors, and the one or more programs include instructions for executing the above-mentioned VPP-based multi-WAN port traffic diversion method.
[0055] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0056] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0057] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0058] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0059] The above embodiments are only for illustrating the technical idea of the present invention and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the present invention.
Claims
1. A multi-WAN port traffic distribution method based on VPP, characterized in that: The method comprises the following steps: (1) When the LAN interface receives a message, it performs the following steps: Query the global flow table based on the five-tuple information of the message received by the LAN interface; the five-tuple information of the message includes the source IP address, destination IP address, source port number, destination port number and protocol number; (1.1) If the flow information corresponding to the above message is found, the VRF ID of the WAN interface in the flow information is obtained and the VRF ID is marked in the message. The LAN port offload processing process is then terminated and the message is sent to the VPP routing module for processing. (1.2) If the flow information corresponding to the above message is not found, query the routing table based on the destination IP address of the message: (1.2.1) If no corresponding default route exists, the LAN port traffic diversion process ends and the message is sent to the VPP routing module for processing; (1.2.2) If a corresponding default route exists, search the predefined traffic diversion policy set; (1.2.2.1) If no traffic diversion policy exists, the LAN port traffic diversion process ends and the packet is sent to the VPP routing module for processing; (1.2.2.2) If a traffic diversion policy exists, flow information for the packet is generated and added to the global flow table. The VRF ID corresponding to the WAN interface in the matching traffic diversion policy is updated in the flow information and the VRF ID is added to the packet. The LAN port traffic diversion process ends and the packet is sent to the VPP routing module for processing. (1.3) In the VPP routing module, the virtual routing table corresponding to the WAN port or the default virtual routing table with VRF 0 is searched based on the VRF ID in the message to complete the routing and forwarding of the message; (2) When the WAN interface receives a message, it performs the following steps: Query the global flow table based on the five-tuple information of the message received by the WAN interface; (2.1) If the flow information of the above message is found, the multi-WAN port traffic diversion process ends and the message is sent to the VPP routing module for processing; (2.2) If the flow information for the above message is not found, the flow information for the message is generated and the VRF ID corresponding to the WAN interface that received the message is updated in the flow information. The WAN port offload process is then terminated and the message is sent to the VPP routing module for processing. (2.3) In the VPP routing module, the virtual routing table with VRF ID 0 is queried to complete the routing and forwarding of the message.
2. The method according to claim 1, characterized in that The method further includes initialization, and the initialization process includes: Initialize the interface type; Initialize the diversion strategy set; Initialize and start the detection thread.
3. The method according to claim 2, characterized in that Initialization interface types include: Initialize the interface to be a WAN port or a LAN port, and create independent VRF tables for all WAN interfaces.
4. The method according to claim 2, characterized in that Start a periodic detection thread to detect the connection status and default route of the WAN interface in real time, and update the diversion policy set and the VRF table corresponding to each WAN interface based on the detection results.
5. The method according to claim 1, wherein The flow information records the VRF ID of the WAN interface, ensuring that all packets of the same flow are forwarded on the same WAN interface.
6. The method according to claim 1, characterized in that After querying the global flow table for packets received by the WAN interface, if no flow information is found, new flow information is automatically generated and the WAN interface that received the packet is used as the outbound interface of the flow to ensure that subsequent flow packets are forwarded from this WAN interface.
7. A computer-readable storage medium storing one or more programs, wherein the one or more programs include instructions, characterized in that When the instructions are executed by a computing device, the computing device is caused to perform the method according to any one of claims 1 to 6.
8. An electronic device, characterized in that: The method comprises one or more processors, one or more memories, and one or more programs, wherein the one or more programs are stored in the one or more memories and are configured to be executed by the one or more processors, and the one or more programs include instructions for executing the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Message forwarding method and gateway
CN111614565A
Data forwarding method and device and storage medium
CN112511483A