Traffic forwarding method and device based on self-learning, equipment and storage medium
By dynamically acquiring forwarding flow table rules through a self-learning traffic forwarding method, the resource bottleneck and scalability issues of virtual private clouds in cloud computing environments are resolved, improving resource utilization and change efficiency, and adapting to large-scale IP demands.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-15
- Publication Date
- 2026-04-07
AI Technical Summary
In cloud computing environments, virtual private cloud virtual switches face resource bottlenecks, insufficient scalability, and low resource utilization when IP address demand increases. In particular, the storage and distribution of full FDB rules consumes a large amount of memory and computing resources, affecting change efficiency.
A self-learning-based traffic forwarding method is adopted to dynamically learn the forwarding flow table rules. Missing forwarding flow tables are obtained by generating request packets and saved as needed, reducing the static distribution of all rules and optimizing resource utilization.
It reduces the memory footprint of OVS and control plane processes, reduces disk and storage card space waste, improves resource utilization and rule change efficiency, and supports VPC scaling.
Smart Images

Figure CN121814710A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cloud computing technology, and in particular to a traffic forwarding method, apparatus, device, and storage medium based on self-learning. Background Technology
[0002] With the popularization of cloud computing technology, the demand for cloud-based business within the group continues to grow, and the demand for IP (Internet Protocol Address) addresses per VPC (Virtual Private Cloud) has exceeded one million. In the current cloud computing environment, the virtual switches (OVS, OpenvSwitch) of compute nodes use a static pre-configuration method to distribute all FDB (Forwarding Database, the core database for Layer 2 data forwarding in network switches) flow table forwarding rules for the VPC. This mechanism faces significant resource bottlenecks, insufficient scalability, and low resource utilization as the VPC continues to expand. Specifically, the storage and distribution of all FDB rules consumes a large amount of memory resources in OVS and control plane processes, making memory the primary bottleneck limiting VPC scale. Furthermore, full rule storage wastes disk / memory card space, full distribution consumes additional computing resources and network bandwidth, and rule changes require simultaneous full updates, severely impacting change efficiency. Summary of the Invention
[0003] In view of this, the purpose of this invention is to provide a self-learning-based traffic forwarding method, apparatus, device, and storage medium that can dynamically learn forwarding flow table rules on demand, significantly reducing resource consumption. The specific solution is as follows: Firstly, this application discloses a self-learning-based traffic forwarding method applied to a communication transmission virtual machine, comprising: Based on the received network communication request, a communication traffic data packet is generated, and the local forwarding flow table database is queried to see if there is a target forwarding flow table that matches the communication traffic data packet; If the target forwarding flow table does not exist, extract the data packet information corresponding to the preset information type from the communication traffic data packet, and generate a request message based on the data packet information; The request message is sent to the preset cluster gateway, and after receiving the forwarding flow table to be loaded from the preset cluster gateway, the forwarding flow table to be loaded is added to the local forwarding flow table database. The communication traffic data packets are forwarded to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded.
[0004] Optionally, the step of generating communication traffic data packets based on the received network communication request and querying the local forwarding flow table database to see if a target forwarding flow table matching the communication traffic data packets exists includes: If a network communication request from a local application is received, a communication traffic data packet is generated and transmitted to the local virtual switch so that the virtual switch can query the local forwarding flow table database to see if there is a target forwarding flow table that matches the communication traffic data packet.
[0005] Optionally, after generating a communication traffic data packet based on the received network communication request and querying the local forwarding flow table database to see if a target forwarding flow table matching the communication traffic data packet exists, the method further includes: If the target forwarding flow table that matches the communication traffic data packet exists in the local forwarding flow table database, the communication traffic data packet is modified based on the flow table information in the target forwarding flow table to obtain the modified traffic data packet. The modified traffic data packet is encapsulated based on the identifier in the target forwarding flow table to obtain the encapsulated traffic data packet; The encapsulated traffic data packets are forwarded to the communication receiving virtual machine.
[0006] Optionally, if the target forwarding flow table does not exist, then extracting data packet information corresponding to the preset information type from the communication traffic data packets, and generating a request message based on the data packet information, includes: If the target forwarding flow table that matches the communication traffic data packet does not exist in the local forwarding flow table database, then the virtual network identifier, virtual machine address and node location information corresponding to the communication traffic data packet are extracted. A request message is generated based on the virtual network identifier, the virtual machine address, and the node location information.
[0007] Optionally, sending the request message to a preset cluster gateway, and adding the forwarding flow table to be loaded to the local forwarding flow table database after receiving the forwarding flow table to be loaded from the preset cluster gateway, includes: The request message is sent to the preset cluster gateway, so that after the preset cluster gateway receives the request message, it queries the local full forwarding flow table to find the matching forwarding flow table that matches the data packet information in the request message, and feeds back the matching forwarding flow table to the communication sending virtual machine. The received adapted forwarding flow table is loaded locally as a forwarding flow table to be loaded, and the forwarding flow table to be loaded is saved to the local forwarding flow table database.
[0008] Optionally, forwarding the communication traffic data packets to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded includes: Determine the traffic forwarding priority, forwarding action, and forwarding identification information corresponding to the forwarding flow table to be loaded; Based on the traffic forwarding priority and the forwarding execution action, the communication traffic data packet is forwarded to the communication receiving virtual machine corresponding to the forwarding identification information.
[0009] Optionally, the self-learning-based traffic forwarding method further includes: If the forwarding flow table to be loaded does not receive a matching traffic data packet within a preset time threshold, then the forwarding flow table to be loaded is unloaded.
[0010] Secondly, this application discloses a self-learning traffic forwarding device applied to a communication transmission virtual machine, comprising: The flow table query module is used to generate communication traffic data packets based on the received network communication requests, and to query whether there is a target forwarding flow table in the local forwarding flow table database that matches the communication traffic data packets; The message generation module is used to extract data packet information corresponding to a preset information type from the communication traffic data packet if the target forwarding flow table does not exist, and to generate a request message based on the data packet information; The flow table loading module is used to send the request message to the preset cluster gateway, and after receiving the forwarding flow table to be loaded from the preset cluster gateway, add the forwarding flow table to be loaded to the local forwarding flow table database. The traffic forwarding module is used to forward the communication traffic data packets to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded.
[0011] Thirdly, this application discloses an electronic device, comprising: Memory, used to store computer programs; A processor is used to execute the computer program to implement the self-learning-based traffic forwarding method as described above.
[0012] Fourthly, this application discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned self-learning-based traffic forwarding method.
[0013] In this application, a communication traffic data packet can be generated based on a received network communication request, and a local forwarding flow table database can be queried to determine if a target forwarding flow table matching the communication traffic data packet exists. If the target forwarding flow table does not exist, data packet information corresponding to a preset information type is extracted from the communication traffic data packet, and a request message is generated based on the data packet information. The request message is sent to a preset cluster gateway, and after receiving the forwarding flow table to be loaded from the preset cluster gateway, the forwarding flow table to be loaded is added to the local forwarding flow table database. The communication traffic data packet is forwarded to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded. Therefore, the method of this application can generate a communication traffic data packet based on a received network communication request, then query a local target forwarding flow table matching the traffic data packet, and if no matching forwarding flow table is found, extract the data packet information, generate a request message based on the data packet information, and send the request message to a preset cluster gateway so that a forwarding flow table matching the data packet can be determined in the preset cluster gateway, and then the communication traffic data packet is forwarded to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded. In this way, FDB rules can be dynamically learned on demand, significantly reducing resource consumption, breaking through the single VPCIP scale limit, adapting to the characteristics of uneven traffic, improving resource utilization and rule change efficiency, smoothly transitioning to the existing network architecture, and meeting the large-scale IP needs of large customers and group businesses moving to the cloud. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0015] Figure 1 This is a flowchart of a traffic forwarding method based on self-learning disclosed in this application; Figure 2 This is a flowchart illustrating the self-learning process of forwarding flow table rules disclosed in this application; Figure 3 This is a schematic diagram of a traffic forwarding device based on self-learning disclosed in this application; Figure 4 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0017] In the current cloud computing environment, the virtual switches of computing nodes use a static pre-configuration method to distribute the full set of FDB flow table forwarding rules for the private cloud. This mechanism faces problems such as prominent resource bottlenecks, insufficient scalability, and low resource utilization during the continuous expansion of the private cloud.
[0018] To overcome the aforementioned technical problems, this application discloses a traffic forwarding method, apparatus, device, and storage medium based on self-learning, which can dynamically learn forwarding flow table rules on demand, significantly reducing resource consumption.
[0019] See Figure 1 As shown, this embodiment of the invention discloses a traffic forwarding method based on self-learning, applied to a communication sending virtual machine, including: Step S11: Generate a communication traffic data packet based on the received network communication request, and query the local forwarding flow table database to see if there is a target forwarding flow table that matches the communication traffic data packet.
[0020] In this embodiment, a communication traffic data packet needs to be generated based on the received network communication request. Then, a local lookup is performed to check if a matching forwarding flow table exists. Specifically, if a network communication request from a local application is received, a communication traffic data packet is generated and transmitted to the local virtual switch. After receiving the communication traffic data packet, the virtual switch can query the host machine's local forwarding flow table database (FDB) to check if a target forwarding flow table matching the communication traffic data packet exists. It should be noted that the generated communication traffic data packet contains the target IP address, Ethernet type, and Virtual Network Identifier (VNI). The VNI identifies which virtual network the data packet belongs to, and the target IP address is the IP address of the target virtual machine to communicate with, clearly indicating which IP address's forwarding path needs to be learned.
[0021] Step S12: If the target forwarding flow table does not exist, extract the data packet information corresponding to the preset information type from the communication traffic data packet, and generate a request message based on the data packet information.
[0022] In this embodiment, if a target forwarding flow table corresponding to a communication traffic data packet does not exist locally, the data packet information corresponding to the communication traffic data packet needs to be extracted, and then a request message is generated based on the data packet information. Specifically, if a target forwarding flow table matching the communication traffic data packet does not exist in the local forwarding flow table database, the virtual network identifier, virtual machine address, and node location information corresponding to the communication traffic data packet are extracted, and then a request message is generated based on the virtual network identifier, virtual machine address, and node location information. It should be noted that if a target forwarding flow table corresponding to the communication traffic data packet does not exist locally, the "no matching flow table" information needs to be reported to the OVS controller, i.e., to the virtual converter controller, thereby triggering the FDB rule self-learning process.
[0023] In another scenario, if a target forwarding flow table matching the communication traffic packet exists in the local forwarding flow table database, the communication traffic packet is modified based on the flow table information in the target forwarding flow table to obtain a modified traffic packet. Further, the modified traffic packet needs to be encapsulated based on the identifier in the target forwarding flow table to obtain an encapsulated traffic packet, which is then forwarded to the communication receiving virtual machine. It should be noted that modifying the traffic packet involves adding information from the target forwarding flow table to the communication traffic packet. If the same type of information exists, the information in the target forwarding flow table is replaced with the flow table information of the same type from the target forwarding flow table, ultimately resulting in the modified traffic packet.
[0024] Step S13: Send the request message to the preset cluster gateway, and after receiving the forwarding flow table to be loaded from the preset cluster gateway, add the forwarding flow table to be loaded to the local forwarding flow table database.
[0025] In this embodiment, a request message needs to be sent to a preset cluster gateway. After receiving the forwarding flow table to be loaded from the preset cluster gateway, the forwarding flow table to be loaded is added to the local forwarding flow table database. Specifically, the request message needs to be sent to the preset cluster gateway so that after receiving the request message, the preset cluster gateway queries the local full forwarding flow table to find the appropriate forwarding flow table that matches the data packet information in the request message. The appropriate forwarding flow table is then fed back to the communication sending virtual machine. The received appropriate forwarding flow table is then loaded locally as a forwarding flow table to be loaded, and saved to the local forwarding flow table database. It should be noted that the above-mentioned FDB rule self-learning process is the process of obtaining the forwarding flow table corresponding to the communication traffic data packet in the preset cluster gateway. Furthermore, since the request message contains information such as the virtual network identifier, virtual machine address, and node location information, the corresponding forwarding flow table can be matched in the preset cluster gateway based on this information. If the match is successful, the successfully matched flow table is added to the local forwarding flow table database as a forwarding flow table to be loaded. This approach allows for dynamic learning of FDB rules corresponding to flow tables on demand, avoiding the static distribution of all rules. Furthermore, only successfully matched flow tables with forwarding are saved locally, significantly reducing memory usage by OVS and control plane processes, minimizing disk and / or storage card space waste, and lowering computational and network bandwidth consumption, thus effectively improving rule change efficiency. Moreover, building upon the existing full FDB information maintained by the clustered gateway eliminates the need to reconstruct the underlying network architecture, enabling a smooth transition from static pre-configuration to dynamic learning, and supporting further expansion of the VPC scale.
[0026] Step S14: Forward the communication traffic data packet to the communication receiving virtual machine according to the traffic forwarding rule corresponding to the forwarding flow table to be loaded.
[0027] In this embodiment, communication traffic data packets can be forwarded according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded, so as to forward the communication traffic data packets to the communication receiving virtual machine. Specifically, the traffic forwarding priority, forwarding execution action, and forwarding identification information corresponding to the forwarding flow table to be loaded can be determined, and then the communication traffic data packets are forwarded to the communication receiving virtual machine corresponding to the forwarding identification information based on the traffic forwarding priority and forwarding execution action. It should be noted that after loading the forwarding flow table to be loaded locally, the traffic forwarding rules corresponding to the forwarding flow table to be loaded can be extracted. It should be noted that the forwarding flow table contains the flow table type, the matching scenario description, and the flow table rule details. Taking a specific case as an example, the flow table type is learned FDB, that is, the learned FDB; the matching scenario description is general VPC intra-traffic matching (applicable to cross-node / same-node communication scenarios between regular virtual machines); the flow table rule details are: priority: high priority (higher than the default static rule, ensuring that the matching logic is executed first); matching field: VNI = target virtual network identifier (used to distinguish different VPC network domains). =The Ethernet type value corresponding to the IP protocol (e.g., 0x0800 represents IPv4), ipv4(dst=target IP address) (exactly matches IPv4 traffic to a specified target IP). =Preset timeout (automatic aging when no traffic triggers); The execution actions are set(eth(dst=target MAC (Media Access Control Address) address)) (updates the target MAC address of the data packet to the expected value) and encap(virtual network identifier, target compute node VTEP IP) (encapsulates the tunnel according to parameters: including virtual network identifier and target node virtual tunnel endpoint VTEP IP).
[0028] It should be noted that high-priority configuration ensures that learned FDB rules are executed before default static rules; The settings control flow table aging. Flow tables are automatically deleted when no traffic matches within a set time, preventing invalid rules from occupying resources for extended periods. The "target compute node VTEP IP" in the encap action refers to the IP address of the Virtual Tunnel Endpoint (VTEP), primarily used to implement tunnel forwarding of traffic across compute nodes, ensuring communication connectivity between VMs on different nodes. Furthermore, the forwarding of communication traffic packets includes setting the target Ethernet MAC address of the traffic packets via the set action and encapsulating the traffic packets according to the tunnel encapsulation parameters via the encap action.
[0029] In this embodiment, a communication traffic data packet can be generated based on the received network communication request, and a local forwarding flow table database can be queried to determine if a target forwarding flow table matching the communication traffic data packet exists. If the target forwarding flow table does not exist, data packet information corresponding to a preset information type is extracted from the communication traffic data packet, and a request message is generated based on the data packet information. The request message is sent to a preset cluster gateway, and after receiving the forwarding flow table to be loaded from the preset cluster gateway, the forwarding flow table to be loaded is added to the local forwarding flow table database. The communication traffic data packet is forwarded to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded. Therefore, the method of this application can generate a communication traffic data packet based on the received network communication request, then query a target forwarding flow table matching the traffic data packet locally, and if no matching forwarding flow table is found, extract the data packet information, generate a request message based on the data packet information, and send the request message to a preset cluster gateway so that a forwarding flow table matching the data packet can be determined in the preset cluster gateway, and then the communication traffic data packet is forwarded to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded. In this way, FDB rules can be dynamically learned on demand, significantly reducing resource consumption, breaking through the single VPC IP size limit, adapting to the characteristics of uneven traffic, improving resource utilization and rule change efficiency, smoothly transitioning to the existing network architecture, and meeting the large-scale IP needs of large customers and group businesses moving to the cloud.
[0030] As a preferred embodiment, see [link to example]. Figure 2The diagram illustrates the self-learning process of forwarding flow table rules in cloud computing. VM1 initiates network communication to VM2, generating traffic data packets (such as IP packets). These packets are sent to the OVS on the compute node. OVS queries its locally configured FDB flow tables. If no matching flow table is found (e.g., the forwarding rule corresponding to the target IP), it reports "no matching flow table" to the OVS controller, triggering the FDB rule self-learning process. Upon receiving the report, the OVS controller sends a learning message to the cluster gateway, carrying key information about the data packet (such as VNI, target IP, VPC type, etc.). The cluster gateway queries its locally maintained full FDB information, extracts the FDB rule corresponding to the target IP (including forwarding target MAC, encapsulation parameters, timeout, etc.), and returns the rule to the OVS controller. The OVS controller dynamically distributes the FDB rule to the OVS via the OVS. The OVS loads the newly distributed FDB rule and performs forwarding according to the rule for subsequent traffic from VM1 to VM2 (e.g., setting the target MAC, encapsulating tunnels, etc.), while the flow table enters an idle timer state. Among them, VM1 and VM2 refer to the communication sending virtual machine and the communication receiving virtual machine; OVS refers to the virtual switch; OVS Controller refers to the OVS controller; and virtualRouter refers to the clustering gateway.
[0031] See Figure 3 As shown, this embodiment of the invention discloses a self-learning-based traffic forwarding device applied to a communication sending virtual machine, comprising: The flow table query module 11 is used to generate a communication traffic data packet based on the received network communication request, and query whether there is a target forwarding flow table in the local forwarding flow table database that matches the communication traffic data packet; The message generation module 12 is used to extract data packet information corresponding to a preset information type from the communication traffic data packet if the target forwarding flow table does not exist, and to generate a request message based on the data packet information. The flow table loading module 13 is used to send the request message to the preset cluster gateway, and after receiving the forwarding flow table to be loaded from the preset cluster gateway, add the forwarding flow table to be loaded to the local forwarding flow table database. The traffic forwarding module 14 is used to forward the communication traffic data packets to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded.
[0032] In this embodiment, a communication traffic data packet can be generated based on the received network communication request, and a local forwarding flow table database can be queried to determine if a target forwarding flow table matching the communication traffic data packet exists. If the target forwarding flow table does not exist, data packet information corresponding to a preset information type is extracted from the communication traffic data packet, and a request message is generated based on the data packet information. The request message is sent to a preset cluster gateway, and after receiving the forwarding flow table to be loaded from the preset cluster gateway, the forwarding flow table to be loaded is added to the local forwarding flow table database. The communication traffic data packet is forwarded to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded. Therefore, the method of this application can generate a communication traffic data packet based on the received network communication request, then query a target forwarding flow table matching the traffic data packet locally, and if no matching forwarding flow table is found, extract the data packet information, generate a request message based on the data packet information, and send the request message to a preset cluster gateway so that a forwarding flow table matching the data packet can be determined in the preset cluster gateway, and then the communication traffic data packet is forwarded to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded. In this way, FDB rules can be dynamically learned on demand, significantly reducing resource consumption, breaking through the single VPC IP size limit, adapting to the characteristics of uneven traffic, improving resource utilization and rule change efficiency, smoothly transitioning to the existing network architecture, and meeting the large-scale IP needs of large customers and group businesses moving to the cloud.
[0033] In some embodiments, the flow table query module 11 may specifically include: The flow table query unit is used to generate a communication traffic data packet if a network communication request is received from a local application, and transmit the communication traffic data packet to a local virtual switch so that the virtual switch can query whether there is a target forwarding flow table that matches the communication traffic data packet in the configured forwarding flow table in the local forwarding flow table database.
[0034] In some embodiments, the self-learning-based traffic forwarding device may further include: The data packet modification unit is used to modify the communication traffic data packet based on the flow table information in the target forwarding flow table if a target forwarding flow table matching the communication traffic data packet exists in the local forwarding flow table database, so as to obtain the modified traffic data packet. A packet encapsulation unit is used to encapsulate the modified traffic data packet based on the identifier in the target forwarding flow table to obtain an encapsulated traffic data packet. The data packet sending unit is used to forward the encapsulated traffic data packet to the communication receiving virtual machine.
[0035] In some embodiments, the message generation module 12 may specifically include: The information extraction unit is used to extract the virtual network identifier, virtual machine address and node location information corresponding to the communication traffic data packet if there is no target forwarding flow table matching the communication traffic data packet in the local forwarding flow table database. The message generation unit is used to generate a request message based on the virtual network identifier, the virtual machine address, and the node location information.
[0036] In some embodiments, the flow table loading module 13 may specifically include: The message sending unit is used to send the request message to the preset cluster gateway, so that after the preset cluster gateway receives the request message, it queries the local full forwarding flow table according to the request message to find the matching forwarding flow table that matches the data packet information in the request message, and feeds back the matching forwarding flow table to the communication sending virtual machine. The flow table loading unit is configured to load the received adapted forwarding flow table as a forwarding flow table to be loaded into the local machine, and save the forwarding flow table to be loaded into the local forwarding flow table database. In some embodiments, the traffic forwarding module 14 may specifically include: The flow table information determination unit is used to determine the traffic forwarding priority, forwarding execution action, and forwarding identification information corresponding to the forwarding flow table to be loaded. A traffic forwarding unit is used to forward the communication traffic data packet to the communication receiving virtual machine corresponding to the forwarding identification information based on the traffic forwarding priority and the forwarding execution action.
[0037] In some embodiments, the self-learning-based traffic forwarding device may further include: The flow table unloading unit is used to unload the forwarding flow table to be loaded if the forwarding flow table to be loaded does not receive a matching traffic data packet within a preset time threshold.
[0038] Furthermore, embodiments of this application also disclose an electronic device, Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0039] Figure 4This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the self-learning-based traffic forwarding method disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be a computer.
[0040] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0041] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0042] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the self-learning-based traffic forwarding method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0043] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned self-learning-based traffic forwarding method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0044] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0045] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0046] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0047] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0048] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A traffic forwarding method based on self-learning, characterized in that, Applications to communication sending virtual machines include: Based on the received network communication request, a communication traffic data packet is generated, and the local forwarding flow table database is queried to see if there is a target forwarding flow table that matches the communication traffic data packet; If the target forwarding flow table does not exist, extract the data packet information corresponding to the preset information type from the communication traffic data packet, and generate a request message based on the data packet information; The request message is sent to the preset cluster gateway, and after receiving the forwarding flow table to be loaded from the preset cluster gateway, the forwarding flow table to be loaded is added to the local forwarding flow table database. The communication traffic data packets are forwarded to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded.
2. The traffic forwarding method based on self-learning according to claim 1, characterized in that, The step of generating communication traffic data packets based on received network communication requests and querying the local forwarding flow table database to see if a target forwarding flow table matching the communication traffic data packets exists includes: If a network communication request from a local application is received, a communication traffic data packet is generated and transmitted to the local virtual switch so that the virtual switch can query the local forwarding flow table database to see if there is a target forwarding flow table that matches the communication traffic data packet.
3. The traffic forwarding method based on self-learning according to claim 1, characterized in that, After generating a communication traffic data packet based on the received network communication request and querying the local forwarding flow table database to see if a target forwarding flow table matching the communication traffic data packet exists, the method further includes: If the target forwarding flow table that matches the communication traffic data packet exists in the local forwarding flow table database, the communication traffic data packet is modified based on the flow table information in the target forwarding flow table to obtain the modified traffic data packet. The modified traffic data packet is encapsulated based on the identifier in the target forwarding flow table to obtain the encapsulated traffic data packet; The encapsulated traffic data packets are forwarded to the communication receiving virtual machine.
4. The traffic forwarding method based on self-learning according to claim 1, characterized in that, If the target forwarding flow table does not exist, then extract the data packet information corresponding to the preset information type from the communication traffic data packet, and generate a request message based on the data packet information, including: If the target forwarding flow table that matches the communication traffic data packet does not exist in the local forwarding flow table database, then the virtual network identifier, virtual machine address and node location information corresponding to the communication traffic data packet are extracted. A request message is generated based on the virtual network identifier, the virtual machine address, and the node location information.
5. The traffic forwarding method based on self-learning according to claim 1, characterized in that, The step of sending the request message to the preset cluster gateway, and after receiving the forwarding flow table to be loaded from the preset cluster gateway, adding the forwarding flow table to be loaded to the local forwarding flow table database, includes: The request message is sent to the preset cluster gateway, so that after the preset cluster gateway receives the request message, it queries the local full forwarding flow table to find the matching forwarding flow table that matches the data packet information in the request message, and feeds back the matching forwarding flow table to the communication sending virtual machine. The received adapted forwarding flow table is loaded locally as a forwarding flow table to be loaded, and the forwarding flow table to be loaded is saved to the local forwarding flow table database.
6. The traffic forwarding method based on self-learning according to claim 1, characterized in that, The step of forwarding the communication traffic data packets to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded includes: Determine the traffic forwarding priority, forwarding action, and forwarding identification information corresponding to the forwarding flow table to be loaded; Based on the traffic forwarding priority and the forwarding execution action, the communication traffic data packet is forwarded to the communication receiving virtual machine corresponding to the forwarding identification information.
7. The traffic forwarding method based on self-learning according to claim 1, characterized in that, Also includes: If the forwarding flow table to be loaded does not receive a matching traffic data packet within a preset time threshold, then the forwarding flow table to be loaded is unloaded.
8. A traffic forwarding device based on self-learning, characterized in that, Applications to communication sending virtual machines include: The flow table query module is used to generate communication traffic data packets based on the received network communication requests, and to query whether there is a target forwarding flow table in the local forwarding flow table database that matches the communication traffic data packets; The message generation module is used to extract data packet information corresponding to a preset information type from the communication traffic data packet if the target forwarding flow table does not exist, and to generate a request message based on the data packet information; The flow table loading module is used to send the request message to the preset cluster gateway, and after receiving the forwarding flow table to be loaded from the preset cluster gateway, add the forwarding flow table to be loaded to the local forwarding flow table database. The traffic forwarding module is used to forward the communication traffic data packets to the communication receiving virtual machine according to the traffic forwarding rules corresponding to the forwarding flow table to be loaded.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the self-learning-based traffic forwarding method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program, wherein the computer program, when executed by a processor, implements the self-learning-based traffic forwarding method as described in any one of claims 1 to 7.