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

By establishing preset association flow tables and routing flow tables, and based on the protocol and routing address matching conditions of the virtual network interface card, the problem of inaccurate gateway selection in cloud computing is solved, and accurate forwarding of data packets is achieved.

WO2026108768A1PCT designated stage Publication Date: 2026-05-28CHINA TELECOM CLOUD TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
CHINA TELECOM CLOUD TECH CO LTD
Filing Date
2025-11-17
Publication Date
2026-05-28

Smart Images

  • Figure CN2025135377_28052026_PF_FP_ABST
    Figure CN2025135377_28052026_PF_FP_ABST
Patent Text Reader

Abstract

A gateway determination method, comprising: on the basis of a protocol address of a target virtual network interface card to which data to be transmitted belongs, determining whether there is a target association table entry including the protocol address in a preset association flow table (202), wherein the preset association flow table is used for indicating whether the target virtual network interface card is associated with an elastic network address; if there is a target association table entry including the protocol address in the preset association flow table, on the basis of the target association table entry and a routing address corresponding to the target virtual network interface card, determining a target gateway of said data (203); and if there is no target association table entry including the protocol address in the preset association flow table, on the basis of the protocol address of the target virtual network interface card and the routing address of the target virtual network interface card, determining the target gateway of said data (204).
Need to check novelty before this filing date? Find Prior Art

Description

Gateway determination method, apparatus, computer equipment and storage medium

[0001] Cross-reference to related applications

[0002] This application claims priority to Chinese patent application filed on November 19, 2024, application number 202411652771.9, entitled "Gateway Determination Method, Apparatus, Computer Equipment and Storage Medium", the entire contents of which are incorporated herein by reference. Technical Field

[0003] 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

[0004] 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 the Internet Protocol (IP) and Media Access Control Addresses (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.

[0005] In traditional technologies, traffic exiting to the public internet is a common requirement in cloud computing. To save costs, users typically create a Network Address Translation (NAT) gateway in their VPC, bind their Elastic IP (EIP) to the NAT gateway, and configure the next hop to be the NAT gateway. Data packets are then translated from private IPs to public IPs through the NAT gateway, enabling communication with the public internet. 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.

[0006] 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

[0007] According to various embodiments of this application, a gateway determination method, apparatus, computer device, and storage medium capable of accurately selecting a gateway are provided.

[0008] In a first aspect, this application provides a gateway determination method, including:

[0009] 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;

[0010] 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;

[0011] 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.

[0012] As an embodiment of the gateway determination method described in this application, the target association entry further includes route 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:

[0013] 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;

[0014] 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.

[0015] As an embodiment of the gateway determination method described in this application, the route matching conditions include 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 conditions is matched from a preset route flow table, including:

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

[0017] 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.

[0018] As an embodiment of the gateway determination method described in this application, 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:

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

[0020] 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.

[0021] As an embodiment of the gateway determination method described in this application, if there are at least two types of target gateways, the method further includes:

[0022] 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.

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

[0024] As an embodiment of the gateway determination method described in this application, the preset associated flow table is generated in the following manner:

[0025] 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;

[0026] 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.

[0027] 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.

[0028] In a second aspect, this application also provides a gateway determination device, comprising:

[0029] 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 an elastic network address;

[0030] 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.

[0031] As an embodiment of the gateway determination device described in this application, the gateway determination module 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.

[0032] As an embodiment of the gateway determination device described in this application, the gateway determination module is further configured to set the first register in the target association entry and update it to the address association identifier; and to 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.

[0033] As an embodiment of the gateway determination device described in this application, the gateway determination module 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.

[0034] As an embodiment of the gateway determination device described in this application, the gateway determination module is further configured to select an Internet gateway from each target gateway 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 a preset routing flow table based on the gateway description information of the Internet gateway.

[0035] As an embodiment of the gateway determination device described in this application, the gateway determination module is further configured to determine whether a reference virtual network interface card (NIC) is associated with an elastic network address based on the NIC description information of the NIC; for a reference virtual NIC associated with an elastic network address, generate a reference association table entry corresponding to the reference virtual NIC based on the protocol address of the reference virtual NIC; and combine the reference association table entries corresponding to the reference virtual NICs associated with elastic network addresses to obtain a preset association flow table.

[0036] In a third aspect, 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:

[0037] 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;

[0038] 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;

[0039] 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.

[0040] In a fourth aspect of the embodiments of this application, this application also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the following steps:

[0041] 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;

[0042] 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;

[0043] 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.

[0044] In a fifth aspect of the embodiments of this application, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0045] 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;

[0046] 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;

[0047] 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.

[0048] Details of one or more embodiments of this application are set forth in the following drawings and description. Other features, objects, and advantages of this application will become apparent from the specification, drawings, and claims. Attached Figure Description

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

[0050] Figure 1 is an application environment diagram of a gateway determination method according to some embodiments;

[0051] Figure 2 is a flowchart illustrating a first gateway determination method according to some embodiments;

[0052] Figure 3 is a schematic diagram of a gateway setup structure according to some embodiments;

[0053] Figure 4 is a schematic diagram of an associated flow table and a routing flow table according to some embodiments;

[0054] Figure 5 is a structural block diagram of a gateway determination device according to some embodiments;

[0055] Figure 6 is an internal structural diagram of a computer device according to some embodiments. Detailed Implementation

[0056] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0057] 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.

[0058] The gateway determination method provided in this application embodiment can be applied to the application environment shown in Figure 1. Specifically, the target virtual network interface card 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 card to which the data to be transmitted belongs. The preset association flow table is used to indicate whether the target virtual network interface card 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 card. If it does not exist, the target gateway 101 for the data to be transmitted is determined based on the protocol address and routing address of the target virtual network interface card.

[0059] In an exemplary embodiment, as shown in FIG2, a gateway determination method is provided. Taking the application of this method to the virtual network card 100 in FIG1 as an example, the method includes the following steps 201 to 203. Wherein:

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

[0061] 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.

[0062] 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.

[0063] 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.

[0064] 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.

[0065] 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.

[0066] 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.

[0067] 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.

[0068] 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.

[0069] As exemplified, Figure 3 shows a gateway configuration structure diagram, where IGW Host is the IGW gateway and NATGW Host 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.

[0070] 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.

[0071] 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.

[0072] 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.

[0073] 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.

[0074] 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.

[0075] 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.

[0076] 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.

[0077] 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.

[0078] 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.

[0079] 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.

[0080] For example, Figure 4 shows a schematic diagram of the associated flow table and the routing flow table; Table 125 in the figure is flow table number 125, which is the preset associated flow table; Table 130 in the figure 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 according to the protocol address of the target virtual network interface card. The 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 to be (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 according to the address association identifier and the virtual network identifier. The 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.

[0081] 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.

[0082] 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.

[0083] 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.

[0084] 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 is installed in flow table 130 with a priority of 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 has been used. Then, the second register Reg5 is set to the gateway identifier, that is, the gateway identifier of the IGW gateway, and the media access control address is set to the gateway address of the IGW gateway.

[0085] 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.

[0086] 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.

[0087] 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.

[0088] 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.

[0089] 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.

[0090] 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.

[0091] 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.

[0092] In an exemplary embodiment, as shown in FIG5, a gateway determination device is provided, including: an association determination module 10 and a gateway determination module 11, wherein:

[0093] 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;

[0094] 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.

[0095] 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.

[0096] 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.

[0097] 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.

[0098] 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.

[0099] 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.

[0100] 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.

[0101] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram is shown in Figure 6. The 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 connected to the system bus via the I / O interfaces. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device is used to store data. The I / O interfaces of the computer device are used for exchanging information between the processor and external devices. The communication interface of the computer device is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a gateway determination method.

[0102] Those skilled in the art will understand that the structure shown in Figure 6 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.

[0103] 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.

[0104] 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.

[0105] 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.

[0106] 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.

[0107] Those skilled in the art will understand that all or part of the processes in the methods of 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, and when executed, it can include the processes of the embodiments of the above methods. 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.

[0108] 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.

[0109] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the 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 patent 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 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 network interface card is associated with a flexible network address; If it exists, then the target gateway for the data to be transmitted is determined based on the target association table entry and the routing address corresponding to the target virtual network 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.

2. The method according to claim 1, characterized in that, The target association entry also 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 includes: Based on the target association table entry, match the target routing table entry that meets the route matching condition from the preset routing flow table; The target gateway for the data to be transmitted is determined based on the target routing table entry and the routing address corresponding to the target virtual network interface card.

3. The method according to claim 2, characterized in that, The route matching conditions include setting a first register and setting a second register; the second register setting is a virtual network identifier; correspondingly, matching a target route entry that satisfies the route matching conditions from a preset route flow table based on the associated entry includes: Set the first register in the target association entry and update it to the address association identifier; Based on the address association identifier and the virtual network identifier, a target routing table entry containing the address association identifier and the virtual network identifier is matched from the preset routing flow table.

4. The method according to claim 2, characterized in that, The step of 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 includes: 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.

5. The method according to any one of claims 1-4, 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.

6. The method according to any one of claims 1-4, characterized in that, The preset association flow table is generated in the following way: Based on the network card description information of the reference virtual network card, determine whether the reference virtual network card is associated with an elastic network address; For a reference virtual network interface card (NIC) associated with a flexible network address, a reference association entry corresponding to the reference virtual NIC is generated based on the protocol address of the reference virtual NIC. The reference association entries corresponding to the reference virtual network interface cards associated with flexible network addresses are combined to obtain the preset association flow table.

7. 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 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; The gateway determination module 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 interface 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 interface card.

8. The apparatus according to claim 7, characterized in that, The gateway determination module is further configured to match target routing entries that meet the routing matching conditions from a preset routing flow table based on the target association entry; and to determine 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 card.

9. The apparatus according to claim 8, characterized in that, The gateway determination module is further configured to set the first register in the target association entry and update it to the address association identifier; and to match the 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.

10. The apparatus according to claim 8, characterized in that, The gateway determination module is also used 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 the routing address corresponding to the target virtual network card.

11. The apparatus according to any one of claims 7-10, characterized in that, The gateway determination module is further configured to select an Internet gateway from among 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 a preset routing flow table based on the gateway description information of the Internet gateway.

12. The apparatus according to any one of claims 7-10, characterized in that, The gateway determination module is also used 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 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. 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.

13. 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 6.

14. 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 6.

15. 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 6.