Gateway determination method and apparatus, computer device, and storage medium

By setting a preset associated flow table, the target gateway is determined based on the protocol address and routing address of the virtual network card, which solves the problem of inaccurate gateway selection in cloud computing and ensures accurate selection when traffic leaves the public network.

CN119276782BActive Publication Date: 2026-05-26CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CLOUD TECH CO LTD
Filing Date
2024-11-19
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In the field of cloud computing, there is a problem of inaccurate gateway selection due to the same NAT gateway and IGW routing configuration, which makes it impossible to accurately select the target gateway when traffic leaves the public network.

Method used

By setting a preset associated flow table, the system determines whether an associated entry exists based on the protocol address of the target virtual network interface card. If an associated entry exists, the target gateway is selected based on the associated entry and the routing address. If no associated entry exists, the target gateway is selected based on the protocol address and the routing address, ensuring the accuracy of gateway selection.

Benefits of technology

It enables accurate selection of the target gateway in the case of route overlap, avoids gateway selection confusion, and improves the accuracy of gateway selection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119276782B_ABST
    Figure CN119276782B_ABST
Patent Text Reader

Abstract

This application relates to a gateway determination method, apparatus, computer device, and storage medium. The method includes: determining whether a target association entry containing the protocol address exists in a preset association flow table based on the protocol address of the target virtual network interface card (NIC) to which the data to be transmitted belongs; the preset association flow table is used to indicate whether the target virtual NIC is associated with a flexible network address; if it exists, determining the target gateway for the data to be transmitted based on the target association entry and the routing address corresponding to the target virtual NIC; if it does not exist, determining the target gateway for the data to be transmitted based on the protocol address and routing address of the target virtual NIC. This method can accurately determine whether a target virtual NIC is associated with a flexible network address by setting a preset association flow table, and accurately determine the target gateway for the data to be transmitted, avoiding gateway selection confusion caused by identical routing configurations of target gateways, and further improving the accuracy of gateway selection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a gateway determination method, apparatus, computer device, and storage medium. Background Technology

[0002] Data packets in computer networks are numerous and complex, yet orderly within their apparent chaos. They can be divided into different data streams based on various attributes, such as Internet Protocol (IP) and Media Access Control Address (MAC) addresses. In the cloud computing field, a Virtual Private Cloud (VPC) has multiple gateways, which are responsible for sending different data packets to the appropriate gateway based on routing rules and the destination address of the data packets.

[0003] In traditional technologies, getting traffic out of the public network is a common requirement in the cloud computing field. To save costs, users typically create a Network Address Translation (NAT) gateway in their VPC and bind their Elastic IP (EIP) to the NAT gateway, configuring the next hop to the NAT gateway. Data packets are then translated from private IPs to public IPs through the NAT gateway, enabling communication with the public network. For customers with sufficient budgets and higher performance requirements, they may bind their EIP directly to a separate virtual machine and configure a route with the Internet Gateway (IGW) as the next hop.

[0004] While this method can be used to select the next-hop gateway, it can lead to route overlap when the routes configured for the NAT gateway and IGW are the same. For example, if there are two routes 0.0.0.0 / 0 in a subnet, with the next hops being the NAT gateway and the IGW respectively, there is a problem of inaccurate gateway selection. Summary of the Invention

[0005] Therefore, it is necessary to provide a gateway determination method, apparatus, computer device, and storage medium that can accurately select a gateway in order to address the above-mentioned technical problems.

[0006] Firstly, this application provides a gateway determination method, including:

[0007] Based on the protocol address of the target virtual network interface card to which the data to be transmitted belongs, determine whether there is a target association entry containing the protocol address in the preset association flow table; the preset association flow table is used to indicate whether the target virtual network interface card is associated with an elastic network address;

[0008] If it exists, then determine the target gateway for the data to be transmitted based on the target association table entry and the routing address corresponding to the target virtual network card;

[0009] If it does not exist, the target gateway for the data to be transmitted is determined based on the protocol address and routing address of the target virtual network interface card.

[0010] In one embodiment, the target association entry further includes routing matching conditions; determining the target gateway for the data to be transmitted based on the target association entry and the routing address corresponding to the target virtual network interface card includes:

[0011] Based on the target association table entry, match the target routing table entry that meets the route matching conditions from the preset routing flow table;

[0012] Determine the target gateway for the data to be transmitted based on the target routing table entry and the routing address corresponding to the target virtual network interface card.

[0013] In one embodiment, the route matching condition includes setting a first register and setting a second register; the second register being set is a virtual network identifier; correspondingly, based on the target association table entry, a target route table entry that meets the route matching condition is matched from a preset route flow table, including:

[0014] Set the first register in the target association table entry and update it to the address association identifier;

[0015] Based on the address association identifier and the virtual network identifier, match the target routing table entry containing the address association identifier and the virtual network identifier from the preset routing flow table.

[0016] In one embodiment, determining the target gateway for the data to be transmitted based on the target routing table entry and the routing address corresponding to the target virtual network interface card includes:

[0017] Retrieve the gateway identifier and gateway address from the target routing table entry;

[0018] Determine the target gateway for the data to be transmitted based on the gateway identifier, gateway address, and routing address corresponding to the target virtual network interface card.

[0019] In one embodiment, if there are at least two types of target gateways, the method further includes:

[0020] If the routing addresses of all target gateways are the same, select the Internet gateway from all target gateways and obtain the gateway description information of the Internet gateway.

[0021] Based on the gateway description information of the Internet gateway, generate routing table entries in the preset routing flow table.

[0022] In one embodiment, the preset associated flow table is generated in the following manner:

[0023] Based on the network interface card description information of the reference virtual network interface card, determine whether the reference virtual network interface card is associated with an elastic network address;

[0024] For reference virtual network interfaces associated with elastic network addresses, a reference association table entry corresponding to the reference virtual network interface is generated based on the protocol address of the reference virtual network interface.

[0025] The reference association entries corresponding to the reference virtual network interface cards associated with elastic network addresses are combined to obtain the preset association flow table.

[0026] Secondly, this application also provides a gateway determination device, comprising:

[0027] The association determination module is used to determine whether there is a target association entry containing the protocol address in the preset association flow table based on the protocol address of the target virtual network interface to which the data to be transmitted belongs; the preset association flow table is used to indicate whether the target virtual network interface is associated with a flexible network address;

[0028] The gateway determination module is used to determine the target gateway for data transmission based on the target association table entry and the routing address corresponding to the target virtual network interface if the gateway exists; otherwise, it determines the target gateway for data transmission based on the protocol address and routing address of the target virtual network interface.

[0029] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0030] Based on the protocol address of the target virtual network interface card to which the data to be transmitted belongs, determine whether there is a target association entry containing the protocol address in the preset association flow table; the preset association flow table is used to indicate whether the target virtual network interface card is associated with an elastic network address;

[0031] If it exists, then determine the target gateway for the data to be transmitted based on the target association table entry and the routing address corresponding to the target virtual network card;

[0032] If it does not exist, the target gateway for the data to be transmitted is determined based on the protocol address and routing address of the target virtual network interface card.

[0033] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0034] Based on the protocol address of the target virtual network interface card to which the data to be transmitted belongs, determine whether there is a target association entry containing the protocol address in the preset association flow table; the preset association flow table is used to indicate whether the target virtual network interface card is associated with an elastic network address;

[0035] If it exists, then determine the target gateway for the data to be transmitted based on the target association table entry and the routing address corresponding to the target virtual network card;

[0036] If it does not exist, the target gateway for the data to be transmitted is determined based on the protocol address and routing address of the target virtual network interface card.

[0037] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0038] Based on the protocol address of the target virtual network interface card to which the data to be transmitted belongs, determine whether there is a target association entry containing the protocol address in the preset association flow table; the preset association flow table is used to indicate whether the target virtual network interface card is associated with an elastic network address;

[0039] If it exists, then determine the target gateway for the data to be transmitted based on the target association table entry and the routing address corresponding to the target virtual network card;

[0040] If it does not exist, the target gateway for the data to be transmitted is determined based on the protocol address and routing address of the target virtual network interface card.

[0041] The aforementioned gateway determination method, apparatus, computer equipment, and storage medium determine whether a target association entry containing the protocol address exists in a preset association flow table based on the protocol address of the target virtual network interface card (NIC) to which the data to be transmitted belongs. The preset association flow table indicates whether the target virtual NIC is associated with a flexible network address. If it exists, the target gateway for the data to be transmitted is determined based on the target association entry and the routing address corresponding to the target virtual NIC. If it does not exist, the target gateway for the data to be transmitted is determined based on the protocol address and routing address of the target virtual NIC. In this embodiment, by setting a preset association flow table, the accuracy of determining whether the target virtual NIC is associated with a flexible network address is accurately established, and the target gateway for the data to be transmitted is accurately determined. This avoids gateway selection confusion caused by identical routing configurations of target gateways, further improving the accuracy of gateway selection. Attached Figure Description

[0042] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0043] Figure 1 This is an application environment diagram of a gateway determination method provided in this embodiment;

[0044] Figure 2 This is a flowchart illustrating the first gateway determination method provided in this embodiment;

[0045] Figure 3 This is a schematic diagram of a gateway configuration structure provided in this embodiment;

[0046] Figure 4 This is a schematic diagram of an associated flow table and a routing flow table provided in this embodiment;

[0047] Figure 5 This is a structural block diagram of a gateway determination device provided in this embodiment;

[0048] Figure 6 This embodiment provides an internal structural diagram of a computer device; Detailed Implementation

[0049] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0050] The gateway determination method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, the target virtual network interface 100 determines whether a target association entry containing the protocol address exists in a preset association flow table based on the protocol address of the target virtual network interface to which the data to be transmitted belongs. The preset association flow table is used to indicate whether the target virtual network interface is associated with an elastic network address. If it exists, the target gateway 101 for the data to be transmitted is determined based on the target association entry and the routing address corresponding to the target virtual network interface. If it does not exist, the target gateway 101 for the data to be transmitted is determined based on the protocol address and the routing address of the target virtual network interface.

[0051] In one exemplary embodiment, such as Figure 2 As shown, a gateway determination method is provided, which is applied to... Figure 1 Taking virtual network card 100 as an example, the explanation includes the following steps 201 to 203. Wherein:

[0052] Step 201: Obtain the protocol address of the target virtual network interface card to which the data to be transmitted belongs.

[0053] The data to be transmitted can be data that needs to be transferred from the target virtual network interface card (NIC) to the target NIC, such as traffic data. The target virtual NIC can be a virtual machine (VM) or a cluster of virtual machines. The protocol address can be the Internet Protocol (IP) address of the target virtual NIC.

[0054] Step 202: Determine whether there is a target association entry containing the protocol address in the preset association flow table based on the protocol address of the target virtual network interface card to which the data to be transmitted belongs.

[0055] The preset association flow table is used to indicate whether the target virtual network interface card (NIC) is associated with an Elastic IP address (EIP). This preset association flow table can include at least one association entry for a virtual NIC. An Elastic IP address (EIP) can be a dynamically assignable public IP address in a cloud computing service. Users can dynamically bind an Elastic IP address to a cloud computing resource, enabling it to access the public network through that public IP address.

[0056] The associated entry can be an entry containing the protocol address and routing matching conditions of the virtual network interface card, and the target associated entry can be the associated entry corresponding to the target virtual network interface card.

[0057] Specifically, based on the protocol address of the target protocol network card to which the data to be transmitted belongs, an associated entry containing that protocol address is selected from the preset associated flow table, and that associated entry is used as the associated entry of the target virtual network card.

[0058] Step 203: If it exists, determine the target gateway for the data to be transmitted based on the target association table entry and the routing address corresponding to the target virtual network card.

[0059] The routing address can be a Classless Inter-Domain Routing (CIDR) address configured for a target virtual network interface card with an EIP. The target gateway can include routes from a Network Address Translation (NAT) gateway, an Internet Gateway (IGW), etc.

[0060] It should be noted that because the EIP is bound to different locations, the target gateway corresponding to the routing address is different. The target virtual network interface can select the appropriate target gateway through this routing address. For example, for a target virtual network interface that binds the purchased EIP to a NAT gateway, the data to be transmitted needs to be translated from a private IP to a public IP through the NAT gateway to achieve communication with the public network. Therefore, a routing address of 0.0.0.0 / 0 with the NAT gateway as the next hop can be configured for this target virtual network interface. For a target virtual network interface that binds the purchased EIP to itself, a routing address of 0.0.0.0 / 0 with the IGW gateway as the next hop can be configured for this target virtual network interface.

[0061] For example, such as Figure 3 The diagram shows the gateway configuration structure, where IGW Host is the IGW gateway and NATGWHost is the NAT gateway. The underlying layer uses the Data Plane Development Kit (DPDK) to centrally forward traffic after the virtual network interface card (NIC). The curve represents the planned outbound data to be transmitted. After exiting the virtual NIC, the data passes through the Open vSwitch (OVS) to determine its next-hop destination gateway. There are two types of virtual machine clusters. The first type is VM1, which contains only one virtual NIC with IP address 192.168.1.1, and is bound to a single EIP1 with IP address 45.7.0.1. Another type is a virtual network interface card (NIC) cluster. As shown in the diagram, a virtual NIC cluster includes virtual NICs VM2, VM3, and VM4, etc. The IP address of virtual NIC VM2 is 192.168.1.2, the IP address of virtual NIC VM3 is 192.168.1.3, and the IP address of virtual NIC VM4 is 192.168.1.4, etc. An SNAT is added and associated with a NAT gateway. The public network is accessed through EIP2 bound to the NAT gateway, with the IP address 45.7.0.3. Simultaneously, there are two routes in the routing table, both with CIDR 0.0.0.0 / 0, and the next hops are the NAT gateway and the IGW gateway, respectively. The Route Table in the diagram represents a routing table containing target gateways with the same CIDR but different next hop IDs.

[0062] Specifically, if a target association entry containing a protocol address exists in the preset association flow table, it proves that the target virtual network card binds the EIP to itself. Therefore, based on the target association entry and the routing address corresponding to the target virtual network card, the IGW gateway is selected and determined as the target gateway for the data to be transmitted.

[0063] Step 204: If it does not exist, determine the target gateway for the data to be transmitted based on the protocol address and routing address of the target virtual network interface card.

[0064] Specifically, if there is no target association entry containing the protocol address in the preset association flow table, it proves that the target virtual network card binds the EIP to the NAT gateway. The NAT gateway can be selected according to the routing address corresponding to the target virtual network card, and the NAT gateway can be determined as the target gateway for the data to be transmitted.

[0065] The aforementioned gateway determination method determines whether a target association entry containing the protocol address exists in a preset association flow table based on the protocol address of the target virtual network interface card (NIC) to which the data to be transmitted belongs. The preset association flow table indicates whether the target NIC is associated with an elastic network address. If it exists, the target gateway for the data to be transmitted is determined based on the target association entry and the routing address corresponding to the target NIC. If it does not exist, the target gateway for the data to be transmitted is determined based on the protocol address and routing address of the target NIC. In this embodiment, by setting a preset association flow table, the method accurately determines whether the target NIC is associated with an elastic network address and accurately determines the target gateway for the data to be transmitted, avoiding gateway selection confusion caused by identical routing configurations of target gateways, and further improving the accuracy of gateway selection.

[0066] In one embodiment, the target association entry further includes routing matching conditions; determining the target gateway for the data to be transmitted based on the target association entry and the routing address corresponding to the target virtual network interface card includes: matching a target routing entry that meets the routing matching conditions from a preset routing flow table based on the target association entry; and determining the target gateway for the data to be transmitted based on the target routing entry and the routing address corresponding to the target virtual network interface card.

[0067] In one embodiment, based on the routing matching conditions of the target associated table entry, the target routing table entry that meets the routing matching conditions is selected from the preset routing flow table; based on the table entry description information of the target routing table entry and the routing address corresponding to the target virtual network interface card, the IGW gateway is selected, and the IGW gateway is determined to be the target gateway for the data to be transmitted.

[0068] In one embodiment, the route matching condition includes setting a first register and setting a second register; the second register is set to a virtual network identifier; correspondingly, matching a target routing table entry that meets the route matching condition from a preset routing flow table based on the target association table entry includes: setting the first register in the target association table entry to update it to an address association identifier; and matching a target routing table entry containing both the address association identifier and the virtual network identifier from the preset routing flow table based on the address association identifier and the virtual network identifier. The advantage of this configuration is that it allows for more accurate selection of target routing table entries.

[0069] Specifically, the first register in the target association entry is set, and the first register is updated to the address association identifier; based on the address association identifier and the virtual network identifier, a routing entry containing the address association identifier and the virtual network identifier is matched from the preset routing flow table, and this routing entry is determined as the target routing entry.

[0070] In one embodiment, determining the target gateway for the data to be transmitted based on the target routing table entry and the routing address corresponding to the target virtual network interface card includes: obtaining the gateway identifier and gateway address from the target routing table entry; and determining the target gateway for the data to be transmitted based on the gateway identifier, gateway address, and the routing address corresponding to the target virtual network interface card. The advantage of this configuration is that it can more accurately determine the target gateway for the data to be transmitted.

[0071] Specifically, obtain the gateway identifier and gateway address from the target routing table entry; select the IGW gateway based on the gateway identifier, gateway address, and the routing address corresponding to the target virtual network card, and determine the IGW gateway as the target gateway for the data to be transmitted.

[0072] For example, such as Figure 4 The diagram illustrates the associated flow table and routing flow table. Table 125 in the diagram is flow table number 125, which is the preset associated flow table; Table 130 in the diagram is flow table number 130, which is the preset routing flow table. In this embodiment, the target associated entry can be found from flow table number 125 based on the protocol address of the target virtual network interface card. This target associated entry contains the protocol address of the target protocol network interface card (i.e., SPI), the flow table to which the next hop is directed (i.e., Instruction), and the routing matching conditions. In the routing matching conditions, the first register is updated from 0 to the address association identifier (i.e., Reg10=1), and the second register is set to the virtual network identifier (i.e., Reg5=vni). In this embodiment, the target routing entry can also be found from flow table number 130 based on the address association identifier and the virtual network identifier. This target routing entry contains the following: the first register is updated from the address association identifier to 0; the second register is updated from the virtual network identifier to the IGW gateway identifier; and the media access control address is updated to the IGW gateway address.

[0073] This embodiment matches target routing entries that meet the routing matching conditions from the preset routing flow table based on the target association entry; and determines the target gateway of the data to be transmitted based on the target routing entry and the routing address corresponding to the target virtual network card. This can more accurately determine the target gateway of the data to be transmitted, thereby realizing intelligent route selection and avoiding the problem of gateway selection errors caused by routes with the same CIDR and all next hops being gateways.

[0074] In one embodiment, if there are at least two types of target gateways, the method further includes: selecting an Internet gateway from each target gateway when the routing addresses of each target gateway are the same, and obtaining the gateway description information of the Internet gateway; generating a routing table entry in a preset routing flow table based on the gateway description information of the Internet gateway.

[0075] Specifically, when the routing addresses of all target gateways (such as IGW gateway and NAT gateway) are the same, the Internet gateway (i.e., IGW gateway) is selected from the target gateways, the gateway description information of the Internet gateway is obtained, and the routing table entry in the preset routing flow table is generated based on the gateway description information of the Internet gateway.

[0076] For example, flow table 130 is responsible for routing and forwarding. If there are multiple CIDRs with the same next hop as the gateway, the route with the IGW as the next hop is selected, and an entry for flow table 130 is installed. Its priority is 1001, slightly higher than the priority of other flows with the same table number. The matching field is a value of 1 in register 10, and the unique index (vni) of the metadata subnet is set. The action is to set the value of the first register Reg10 to 0, indicating that the function of the first register Reg10 is complete. The second register Reg5 is then set to the gateway identifier, i.e., the gateway identifier of the IGW gateway, and the media access control address is set to the gateway address of the IGW gateway.

[0077] In this embodiment, when the routing addresses of all target gateways are the same, an Internet gateway is selected from the target gateways, and the gateway description information of the Internet gateway is obtained. Based on the gateway description information of the Internet gateway, a routing table entry in the preset routing flow table is generated. This embodiment can avoid the selection of the target gateway by setting the routing table entry.

[0078] In one embodiment, the preset associated flow table is generated in the following manner: based on the network card description information of the reference virtual network card, it is determined whether the reference virtual network card is associated with an elastic network address; for the reference virtual network card associated with an elastic network address, a reference association table entry corresponding to the reference virtual network card is generated based on the protocol address of the reference virtual network card; the reference association table entries corresponding to the reference virtual network card associated with an elastic network address are combined to obtain the preset associated flow table.

[0079] Specifically, based on the network interface card (NIC) description information of the reference virtual NIC, it is determined whether there is an association field associated with an elastic network address in the description information of the reference virtual NIC. If there is no association field, it proves that the reference virtual NIC is not associated with an elastic network address; if there is an association field, it proves that the reference virtual NIC is associated with an elastic network address. For reference virtual NICs not associated with an elastic network address, there is no need to set a preset association flow table. For each reference virtual NIC associated with an elastic network address, a reference association table entry corresponding to the reference virtual NIC is generated according to the protocol address of the reference virtual NIC. The reference association table entries corresponding to all reference virtual NICs associated with elastic network addresses are combined to generate a preset association flow table.

[0080] For example, when providing the external Application Programming Interface (API), multiple routes with the same CIDR can be inserted into the database. When retrieving route information, it is aggregated based on the CIDR. For multiple routes with the same CIDR and a gateway as the next hop, the IGW route is selected, other routes with the same CIDR are ignored, and the route is sent to the OVS flow table. During configuration retrieval, the virtual network interfaces (NICs) of the deployed compute nodes are filtered out, and those associated with EIPs are identified. The corresponding flow table entry for flow table number 125 is installed, with the matching field being the protocol address IP and a priority of 1000. Simultaneously, the first register is updated to the address association identifier (i.e., Reg10=1), the second register is set to the virtual network identifier of the virtual private cloud of the virtual NIC, and the route is sent to the next hop flow table number 130.

[0081] This embodiment determines whether a reference virtual network interface card (NIC) is associated with an elastic network address based on its NIC description information. For NICs associated with elastic network addresses, a reference association table entry is generated based on the NIC's protocol address. The reference association table entries for NICs associated with elastic network addresses are combined to obtain a preset association flow table. This embodiment sets a preset association flow table for NICs associated with elastic network addresses so that the target gateway can be directly determined based on the preset association flow table, improving the accuracy of target gateway selection.

[0082] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0083] Based on the same inventive concept, this application also provides a gateway determination apparatus for implementing the gateway determination method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more gateway determination apparatus embodiments provided below can be found in the limitations of the gateway determination method described above, and will not be repeated here.

[0084] In one exemplary embodiment, such as Figure 5 As shown, a gateway determination device is provided, including: an association determination module 10 and a gateway determination module 11, wherein:

[0085] The association determination module 10 is used to determine whether there is a target association entry containing the protocol address in the preset association flow table based on the protocol address of the target virtual network interface to which the data to be transmitted belongs; the preset association flow table is used to indicate whether the target virtual network interface is associated with a flexible network address;

[0086] The gateway determination module 11 is used to determine the target gateway for the data to be transmitted based on the target association table entry and the routing address corresponding to the target virtual network card if the gateway exists; otherwise, it determines the target gateway for the data to be transmitted based on the protocol address and routing address of the target virtual network card.

[0087] In one embodiment, the gateway determination module 11 is further configured to match a target routing table entry that meets the routing matching conditions from a preset routing flow table based on the target association table entry; and determine the target gateway for the data to be transmitted based on the target routing table entry and the routing address corresponding to the target virtual network card.

[0088] In one embodiment, the gateway determination module 11 is further configured to set the first register in the target association entry to update the address association identifier; and match the target routing table entry containing the address association identifier and the virtual network identifier from the preset routing flow table according to the address association identifier and the virtual network identifier.

[0089] In one embodiment, the gateway determination module 11 is further configured to obtain the gateway identifier and gateway address in the target routing table entry; and determine the target gateway for the data to be transmitted based on the gateway identifier, gateway address and routing address corresponding to the target virtual network card.

[0090] In one embodiment, the gateway determination module 11 is further configured to select an Internet gateway from the target gateways when the routing addresses of each target gateway are the same, and obtain the gateway description information of the Internet gateway; and generate a routing table entry in the preset routing flow table based on the gateway description information of the Internet gateway.

[0091] In one embodiment, the gateway determination module 11 is further configured to determine whether the reference virtual network interface card is associated with an elastic network address based on the network interface card description information of the reference virtual network interface card; for the reference virtual network interface card associated with an elastic network address, generate a reference association table entry corresponding to the reference virtual network interface card based on the protocol address of the reference virtual network interface card; and combine the reference association table entries corresponding to the reference virtual network interface card associated with an elastic network address to obtain a preset association flow table.

[0092] The modules in the aforementioned gateway determination device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0093] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When executed by the processor, the computer program implements a gateway determination method.

[0094] Those skilled in the art will understand that Figure 6The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0095] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0096] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0097] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0098] It should be noted that the data involved in this application (including but not limited to data used for analysis, data stored, data displayed, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0099] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0100] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0101] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A gateway determination method, characterized in that, The method includes: Based on the protocol address of the target virtual network interface card (NIC) to which the data to be transmitted belongs, determine whether there is a target association entry in the preset association flow table that contains the protocol address; the preset association flow table is used to indicate whether the target virtual NIC is associated with an elastic network address; the target association entry also includes routing matching conditions; the routing matching conditions include setting a first register and setting a second register; the second register setting is a virtual network identifier; If it exists, then according to the target association entry, a target routing table entry that satisfies the route matching condition is matched from the preset routing flow table; wherein, the step of matching a target routing table entry that satisfies the route matching condition from the preset routing flow table according to the target association entry includes: setting a first register in the target association entry and updating it to an address association identifier; matching a target routing table entry containing the address association identifier and the virtual network identifier from the preset routing flow table according to the address association identifier and the virtual network identifier; Obtain the gateway identifier and gateway address from the target routing table entry; The target gateway for the data to be transmitted is determined based on the gateway identifier, the gateway address, and the routing address corresponding to the target virtual network interface card. If it does not exist, the target gateway for the data to be transmitted is determined based on the protocol address and routing address of the target virtual network interface card. The preset associated flow table is generated in the following manner: based on the network card description information of the reference virtual network card, it is determined whether the reference virtual network card is associated with an elastic network address; for the reference virtual network card associated with an elastic network address, a reference associated table entry corresponding to the reference virtual network card is generated based on the protocol address of the reference virtual network card; the reference associated table entries corresponding to the reference virtual network cards associated with elastic network addresses are combined to obtain the preset associated flow table.

2. The method according to claim 1, characterized in that, If there are at least two types of target gateways, the method further includes: If the routing addresses of all the target gateways are the same, select the Internet gateway from the target gateways and obtain the gateway description information of the Internet gateway. Based on the gateway description information of the Internet gateway, generate routing table entries in the preset routing flow table.

3. A gateway determination device, characterized in that, The device includes: The association determination module is used to determine whether there is a target association entry containing the protocol address in a preset association flow table based on the protocol address of the target virtual network interface to which the data to be transmitted belongs; the preset association flow table is used to indicate whether the target virtual network interface is associated with an elastic network address; the target association entry also includes routing matching conditions; the routing matching conditions include setting a first register and setting a second register; the second register setting is a virtual network identifier; A gateway determination module is configured to, if present, match a target routing table entry satisfying the route matching condition from a preset routing flow table based on the target association entry; wherein, matching a target routing table entry satisfying the route matching condition from the preset routing flow table based on the target association entry includes: setting a first register in the target association entry and updating it to an address association identifier; matching a target routing table entry containing the address association identifier and the virtual network identifier from the preset routing flow table based on the address association identifier and the virtual network identifier; obtaining a gateway identifier and a gateway address from the target routing table entry; and matching a target routing table entry containing the address association identifier and the virtual network identifier from the target routing table based on the gateway identifier, the gateway address, and the target virtual network identifier. The routing address corresponding to the network interface card (NIC) is used to determine the target gateway for the data to be transmitted. If the target gateway does not exist, it is determined based on the protocol address and routing address of the target virtual NIC. The preset association flow table is generated as follows: based on the NIC description information of the reference virtual NIC, it is determined whether the reference virtual NIC is associated with an elastic network address. For reference virtual NICs associated with elastic network addresses, a reference association table entry is generated based on the protocol address of the reference virtual NIC. The reference association table entries corresponding to reference virtual NICs associated with elastic network addresses are combined to obtain the preset association flow table.

4. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 2.

5. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 2.

6. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 2.