Gateway determination method and device, computer equipment and storage medium

By determining the gateway based on the protocol and routing address of the target virtual network card in cloud computing, the problem of inaccurate gateway selection caused by overlapping NAT gateway and IGW routing in cloud computing is solved, and more accurate gateway selection and packet routing forwarding are achieved.

CN119276782AActive Publication Date: 2025-01-07CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Application Number
CN202411652771.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-01-07
Estimated Expiration
2044-11-19

AI Technical Summary

Technical Problem

In the field of cloud computing, when the routing of NAT gateway and IGW configurations in traditional technology is the same, the problem of inaccurate selection of gateways, resulting in overlapping routes and the inability to accurately select the target gateway.

Method used

By determining whether there is a target association table entry containing a protocol address in the preset association flow table based on the protocol address of the target virtual network card to which the data to be transmitted belongs. If it exists, the target gateway is determined based on the target association table entry and the routing address. If it does not exist, then Determine the target gateway based on the protocol address and routing address, set up a preset association flow table to accurately determine whether the target virtual network card is associated with an elastic network address, and accurately determine the target gateway for the data to be transmitted.

Benefits of technology

It avoids the confusion in gateway selection caused by the same configuration of the target gateway, improves the accuracy of gateway selection, and ensures the correct routing and forwarding of data packets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119276782A_ABST
    Figure CN119276782A_ABST
Patent Text Reader

Abstract

The invention relates to a gateway determination method and device, computer equipment and a storage medium. The method comprises the following steps: according to a protocol address of a target virtual network card to which to-be-transmitted data belongs, determining whether a target association table item containing the protocol address exists in a preset association flow table; the preset association flow table is used for indicating whether the target virtual network card is associated with an elastic network address; if yes, determining a target gateway of the to-be-transmitted data according to the target association table item and a routing address corresponding to the target virtual network card; and if not, determining a target gateway of the to-be-transmitted data according to the protocol address of the target virtual network card and the routing address of the target virtual network card. By adopting the method, whether the target virtual network card is associated with the elastic network address or not can be accurately determined by setting the preset association flow table, and the target gateway is accurately determined for the to-be-transmitted data, so that the problem of disordered gateway selection caused by the same configuration route of the target gateway is avoided, and the accuracy of gateway selection is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a gateway determination method, apparatus, computer equipment and storage medium. Background Art

[0002] Data packets in computer networks are complex, but orderly, and they can be divided into different data streams according to different attributes, such as Internet Protocol (IP), Media Access Control Address (MAC address), etc. In the field of cloud computing, a virtual private cloud (VPC) will have multiple gateways, which can send different data packets to the corresponding gateways according to routing rules and the destination address of the data packet.

[0003] In traditional technology, it is a common requirement in the field of cloud computing to have traffic go out of the public network. To save costs, users usually create a network address translation gateway (NAT gateway) in their VPC, bind their elastic network address (EIP) to the NAT gateway, and configure the next hop of the route to be the NAT gateway. The data packet is then converted from the private IP to the public IP through the NAT gateway to achieve communication with the public network. For customers with sufficient budget and high performance requirements, their EIP will be directly bound to a single virtual machine and a route with the next hop being the Internet Gateway (IGW) will be configured.

[0004] Although the next-hop gateway selection can be completed in this way, when the routes configured for the NAT gateway and IGW are the same, route overlap will occur. For example, there are two 0.0.0.0 / 0 routes in a subnet, and the next hops are the NAT gateway and IGW respectively. Therefore, there is a problem of inaccurate gateway selection. Summary of the invention

[0005] Based on this, it is necessary to provide a gateway determination method, device, computer equipment and storage medium that can accurately select a gateway in response to the above technical problems.

[0006] In a first aspect, the present application provides a gateway determination method, comprising:

[0007] According to the protocol address of the target virtual network card to which the data to be transmitted belongs, determine whether there is a target association table 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 card is associated with an elastic network address;

[0008] If it exists, the target gateway of the data to be transmitted is determined according to 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 according to the protocol address of the target virtual network card and the routing address of the target virtual network card.

[0010] In one embodiment, the target association table item also includes a routing matching condition; determining a target gateway for data to be transmitted according to the target association table item and a routing address corresponding to the target virtual network card includes:

[0011] According to the target association table item, the target routing table item that meets the routing matching condition is matched from the preset routing flow table;

[0012] 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 card.

[0013] 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; accordingly, according to the target association table item, matching a target route table item that meets the route matching condition from a preset route flow table includes:

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

[0015] According to 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 a preset routing flow table.

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

[0017] Get the gateway identifier and gateway address in the target routing table entry;

[0018] 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 card.

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

[0020] When the routing addresses of the target gateways are the same, an Internet gateway is selected from the target gateways, and gateway description information of the Internet gateway is obtained;

[0021] Generate routing table entries in a preset routing flow table based on the gateway description information of the Internet gateway.

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

[0023] Determine, according to the network card description information of the reference virtual network card, whether the reference virtual network card is associated with an elastic network address;

[0024] For the reference virtual network card associated with the elastic network address, generating a reference association table entry corresponding to the reference virtual network card according to the protocol address of the reference virtual network card;

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

[0026] In a second aspect, the present application also provides a gateway determination device, including:

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

[0028] 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 card, if it exists; if it does not exist, determine the target gateway for the data to be transmitted based on the protocol address of the target virtual network card and the routing address of the target virtual network card.

[0029] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0030] According to the protocol address of the target virtual network card to which the data to be transmitted belongs, determine whether there is a target association table 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 card is associated with an elastic network address;

[0031] If it exists, the target gateway of the data to be transmitted is determined according to 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 according to the protocol address of the target virtual network card and the routing address of the target virtual network card.

[0033] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0034] According to the protocol address of the target virtual network card to which the data to be transmitted belongs, determine whether there is a target association table 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 card is associated with an elastic network address;

[0035] If it exists, the target gateway of the data to be transmitted is determined according to 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 according to the protocol address of the target virtual network card and the routing address of the target virtual network card.

[0037] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0038] According to the protocol address of the target virtual network card to which the data to be transmitted belongs, determine whether there is a target association table 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 card is associated with an elastic network address;

[0039] If it exists, determine the target gateway for the data to be transmitted according to 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 according to the protocol address of the target virtual network card and the routing address of the target virtual network card.

[0041] The above-mentioned gateway determination method, device, computer equipment and storage medium determine whether there is a target association table item containing a protocol address in the preset association flow table according to the protocol address of the target virtual network card to which the data to be transmitted belongs; the preset association flow table is used to indicate whether the target virtual network card is associated with an elastic network address; if so, the target gateway of the data to be transmitted is determined according to the target association table item and the routing address corresponding to the target virtual network card; if not, the target gateway of the data to be transmitted is determined according to the protocol address of the target virtual network card and the routing address of the target virtual network card. In this embodiment, by setting a preset association flow table, it is accurately determined whether the target virtual network card is associated with an elastic network address, and the target gateway is accurately determined for the data to be transmitted, avoiding the problem of confusion in gateway selection caused by the same routing configuration of the target gateway, and further improving the accuracy of gateway selection. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] FIG1 is an application environment diagram of a gateway determination method provided by this embodiment;

[0044] FIG2 is a schematic diagram of a flow chart of a first gateway determination method provided in this embodiment;

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

[0046] FIG4 is a schematic diagram of an association flow table and a routing flow table provided in this embodiment;

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

[0048] FIG6 is a diagram showing the internal structure of a computer device provided in this embodiment; DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0050] The gateway determination method provided in the embodiment of the present application can be applied in the application environment shown in FIG1. ​​The target virtual network card 100 determines whether there is a target association table entry containing a protocol address in the preset association flow table according to the protocol address of the target virtual network card to which the data to be transmitted belongs; the preset association flow table is used to indicate whether the target virtual network card is associated with an elastic network address; if so, the target gateway 101 of the data to be transmitted is determined according to the target association table entry and the routing address corresponding to the target virtual network card; if not, the target gateway 101 of the data to be transmitted is determined according to the protocol address of the target virtual network card and the routing address of the target virtual network card.

[0051] In an exemplary embodiment, as shown in FIG2 , a gateway determination method is provided, which is described by taking the method applied to the virtual network card 100 in FIG1 as an example, and includes the following steps 201 to 203. Among them:

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

[0053] The data to be transmitted may be data that needs to be transmitted from the target virtual network card to the target network card, for example, traffic data. The target virtual network card may be a virtual machine (VM) or a virtual machine cluster. The protocol address may be an Internet Protocol (IP) address of the target virtual network card.

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

[0055] The preset association flow table is used to indicate whether the target virtual network card is associated with an elastic network address, and the preset association flow table may include an association table entry of at least one virtual network card. An elastic network address (Elastic IP, EIP) can be a dynamically assignable public network IP address in cloud computing services. Users can dynamically bind the elastic public network IP address to cloud computing resources so that they can access the public network through the public network IP.

[0056] The association table entry may be an entry including the protocol address of the virtual network card and the routing matching condition, and the target association table entry may be an association table entry corresponding to the target virtual network card.

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

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

[0059] The routing address can be the Classless Inter-Domain Routing (CIDR) address configured for the target virtual network card purchased with EIP. The target gateway can include the Network Address Translation (NAT Gateway) and the Internet Gateway (IGW) routing.

[0060] It should be noted that, due to the different locations of EIP binding, the target gateways corresponding to the routing addresses are different, and the target virtual network card can select the corresponding target gateway through the routing address. For example, for the target virtual network card that binds the purchased EIP to the NAT gateway, the data to be transmitted needs to be converted from the private network IP to the public network IP through the NAT gateway to achieve communication with the public network, so the target virtual network card can be configured with a routing address of 0.0.0.0 / 0 and the next hop being the NAT gateway; for the target virtual network card that binds the purchased EIP to itself, the target virtual network card can be configured with a routing address of 0.0.0.0 / 0 and the next hop being the IGW gateway.

[0061] For example, as shown in FIG3, the schematic diagram of the gateway setting structure, in which IGW Host is the IGW gateway, NATGWHost is the NAT gateway, and the underlying layer uses the Data Plane Development Kit (DPDK) to realize the centralized forwarding of the traffic after the virtual network card is responsible for exiting. The curve is the planned data to be transmitted in the direction of the cloud. After the data to be transmitted exits the virtual network card, it passes through the virtual machine switch (Open vSwitch, OVS) to determine its next hop destination gateway. There are two types of virtual machine clusters. The first type is VM1 with only one virtual network card. The IP address of VM1 is 192.168.1.1, and an EIP1 is bound separately. The IP address of EIP1 is 45.7.0.1. The other type is a virtual network card cluster. The virtual network card cluster shown in the figure includes virtual network cards VM2, VM3, and VM4. The IP of virtual network card VM2 is 192.168.1.2, the IP of virtual network card VM3 is 192.168.1.3, and the IP of virtual network card VM4 is 192.168.1.4. Add SNAT and associate it with the NAT gateway, and access the public network through the EIP2 bound to the NAT gateway, with an IP address of 45.7.0.3. At the same time, there are two routes in the routing table, both with CIDR 0.0.0.0 / 0, and the next hops are NAT gateway and IGW gateway respectively. The Route Table in the figure is a routing table, which contains target gateways with the same CIDR but different next hops (i.e., Nexthop ID).

[0062] Specifically, if there is a target association table entry containing a protocol address in the preset association flow table, it proves that the target virtual network card binds the EIP to itself. Therefore, according to the target association table entry and the routing address corresponding to the target virtual network card, the IGW gateway is selected and the IGW gateway is 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 according to the protocol address of the target virtual network card and the routing address of the target virtual network card.

[0064] Specifically, if there is no target association table 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 above-mentioned gateway determination method determines whether there is a target association table entry containing a protocol address in the preset association flow table according to the protocol address of the target virtual network card to which the data to be transmitted belongs; the preset association flow table is used to indicate whether the target virtual network card is associated with an elastic network address; if so, the target gateway of the data to be transmitted is determined according to the target association table entry and the routing address corresponding to the target virtual network card; if not, the target gateway of the data to be transmitted is determined according to the protocol address of the target virtual network card and the routing address of the target virtual network card. In this embodiment, by setting a preset association flow table, it is accurately determined whether the target virtual network card is associated with an elastic network address, and the target gateway is accurately determined for the data to be transmitted, avoiding the problem of confusion in gateway selection caused by the same routing configuration of the target gateway, and further improving the accuracy of gateway selection.

[0066] In one embodiment, the target association table item also includes a routing matching condition; according to the routing address corresponding to the target association table item and the target virtual network card, the target gateway of the data to be transmitted is determined, including: according to the target association table item, matching the target routing table item that meets the routing matching condition from the preset routing flow table; according to the target routing table item and the routing address corresponding to the target virtual network card, the target gateway of the data to be transmitted is determined.

[0067] In one embodiment, according to the routing matching condition of the target association table item, a target routing table item that meets the routing matching condition is selected from a preset routing flow table; an IGW gateway is selected according to the table item description information of the target routing table item and the routing address corresponding to the target virtual network card, 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; accordingly, according to the target association table item, matching the target route table item that meets the route matching condition from the preset route flow table includes: setting the first register in the target association table item to update it to the address association identifier; according to the address association identifier and the virtual network identifier, matching the target route table item containing the address association identifier and the virtual network identifier from the preset route flow table. The advantage of such a setting is that the target route table item can be selected more accurately.

[0069] Specifically, determine the first register setting in the target association table item, and update the first register setting to the address association identifier; according to the address association identifier and the virtual network identifier, match the routing table item containing the address association identifier and the virtual network identifier from the preset routing flow table, and determine the routing table item as the target routing table item.

[0070] In one embodiment, determining the target gateway of the data to be transmitted according to the target routing table entry and the routing address corresponding to the target virtual network card includes: obtaining the gateway identifier and the gateway address in the target routing table entry; and determining the target gateway of the data to be transmitted according to the gateway identifier, the gateway address and the routing address corresponding to the target virtual network card. The advantage of such a setting is that the target gateway of the data to be transmitted can be determined more accurately.

[0071] Specifically, the gateway identifier and the gateway address in the target routing table entry are obtained; the IGW gateway is selected according to the gateway identifier, the gateway address and the routing address corresponding to the target virtual network card, and the IGW gateway is determined as the target gateway for the data to be transmitted.

[0072] Exemplary, a schematic diagram of an association flow table and a routing flow table is shown in FIG4; Table 125 in the figure is flow table No. 125, i.e., a preset association flow table; Table 130 in the figure is flow table No. 130, i.e., a preset routing flow table. In this embodiment, the target association table item can be found from flow table No. 125 according to the protocol address of the target virtual network card, and the target association table item includes the protocol address of the target protocol network card (i.e., Srcip), the flow table to which the next hop goes (i.e., Instruction), and the routing matching condition. In the routing matching condition, the first register is set from 0 to update 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 table item can also be found from flow table No. 130 according to the address association identifier and the virtual network identifier, and the target routing table item includes updating the first register setting from the address association identifier to 0; updating the second register setting from the virtual network identifier to the IGW gateway identifier; and updating the media access control address to the IGW gateway address.

[0073] This embodiment matches the target routing table item that meets the routing matching condition from the preset routing flow table according to the target association table item; determines the target gateway of the data to be transmitted according to the routing address corresponding to the target routing table item and the target virtual network card, and can more accurately determine the target gateway of the data to be transmitted, thereby realizing intelligent selection of routes and avoiding the problem of incorrect gateway selection caused by routes with the same CIDR and the next hop being the gateway.

[0074] In one embodiment, if there are at least two types of target gateways, the method also includes: when the routing addresses of the target gateways are the same, selecting an Internet gateway from each target gateway 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 the target gateways (such as the IGW gateway and the NAT gateway) are the same, an Internet gateway (i.e., the IGW gateway) is selected from the target gateways, the gateway description information of the Internet gateway is obtained, and the routing table entries in the preset routing flow table are generated according to the gateway description information of the Internet gateway.

[0076] Exemplarily, flow table 130 is responsible for the function of routing forwarding. If there are multiple routes with the same CIDR and the next hop is the gateway, the route with the next hop being the IGW is selected and the flow table entry of flow table 130 is installed. The priority (i.e., Priority) is 1001, which is slightly higher than the priority of other flows with the same table number. The matching domain is the value of register 10, which is 1, and the unique index of the metadata subnet (i.e., vni). 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 up. And set the second register Reg5 to the gateway identifier, i.e., the gateway identifier of the IGW gateway, and set the media access control address to the gateway address of the IGW gateway.

[0077] In this embodiment, when the routing addresses of the 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 a preset routing flow table is generated. This embodiment can avoid incorrect target gateway selection by setting the routing table entry.

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

[0079] Specifically, based on the network card description information of the reference virtual network card, determine whether there is an associated field associated with the elastic network address in the description information of the reference virtual network card. If there is no associated field, it proves that the reference virtual network card is not associated with the elastic network address; if there is an associated field, it proves that the reference virtual network card is associated with the elastic network address; for the reference virtual network card that is not associated with the elastic network address, there is no need to set a preset associated flow table; for each reference virtual network card associated with the elastic network address, generate a reference associated table entry corresponding to the reference virtual network card according to the protocol address of the reference virtual network card; combine the reference associated table entries corresponding to all reference virtual network cards associated with the elastic network address to generate a preset associated flow table.

[0080] Exemplarily, when providing an external application programming interface (API), multiple routes with the same CIDR are allowed to be inserted into the database. When pulling routing information, it is aggregated according to CIDR. For multiple routes with the same CIDR and the next hop being the gateway, the IGW route is selected, other routes with the same CIDR are ignored, and sent to the OVS flow table. When obtaining the configuration, the virtual network cards of the deployed computing nodes are filtered out, the virtual network cards associated with the EIP are found, and the corresponding flow table entries of flow table No. 125 are installed, with the matching domain being the protocol address IP and the priority being 1000. At the same time, the first register is set and updated to the address association identifier (i.e., Reg10=1), and the second register is set to the virtual network identifier of the virtual private cloud of the virtual network card, and sent to the next hop flow table No. 130.

[0081] This embodiment determines whether the reference virtual network card is associated with an elastic network address based on the network card description information of the reference virtual network card; for the reference virtual network card associated with the elastic network address, a reference association table entry corresponding to the reference virtual network card is generated according to the protocol address of the reference virtual network card; the reference association table entries corresponding to the reference virtual network card associated with the elastic network address are combined to obtain a preset association flow table. This embodiment sets a preset association flow table for the reference virtual network card associated with the elastic network address, so that the target gateway can be directly determined according to the preset association flow table in the future, thereby improving the accuracy of the target gateway selection.

[0082] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0083] Based on the same inventive concept, the embodiment of the present application also provides a gateway determination device for implementing the gateway determination method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more gateway determination device embodiments provided below can refer to the limitations of the gateway determination method above, and will not be repeated here.

[0084] 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:

[0085] An association determination module 10 is used to determine whether there is a target association table entry containing a protocol address in a preset association flow table according to the protocol address of the target virtual network card to which the data to be transmitted belongs; the preset association flow table is used to indicate whether the target virtual network card is associated with an elastic network address;

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

[0087] In one embodiment, the gateway determination module 11 is also used to match the target routing table item that meets the routing matching condition from the preset routing flow table according to the target association table item; and determine the target gateway of the data to be transmitted according to the routing address corresponding to the target routing table item and the target virtual network card.

[0088] In one embodiment, the gateway determination module 11 is also used to set the first register in the target association table entry and update it to the address association identifier; according to 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.

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

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

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

[0092] Each module in the above-mentioned gateway determination device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.

[0093] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG6. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a gateway determination method is implemented.

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

[0095] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0096] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

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

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

[0099] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium 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), magnetoresistive 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. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0100] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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 above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A gateway determination method, characterized in that: The method comprises: According to the protocol address of the target virtual network card to which the data to be transmitted belongs, determining whether there is a target association table 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 card is associated with an elastic network address; If so, determining the target gateway of the data to be transmitted according to the target association table entry and the routing address corresponding to the target virtual network card; If it does not exist, the target gateway of the data to be transmitted is determined according to the protocol address of the target virtual network card and the routing address of the target virtual network card.

2. The method according to claim 1, characterized in that The target association table item also includes a routing matching condition; and determining the target gateway of the data to be transmitted according to the target association table item and the routing address corresponding to the target virtual network card includes: According to the target association table item, matching the target routing table item that meets the routing matching condition from the preset routing flow table; The target gateway of the data to be transmitted is determined according to the target routing table entry and the routing address corresponding to the target virtual network card.

3. The method according to claim 2, characterized in that The routing 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 item that meets the routing matching condition from a preset routing flow table according to the association table item includes: Setting the first register in the target association table entry to update it to an address association identifier; According to the address association identifier and the virtual network identifier, a target routing table entry including the address association identifier and the virtual network identifier is matched from a preset routing flow table.

4. The method according to claim 2, characterized in that: The step of determining the target gateway of the data to be transmitted according to the target routing table entry and the routing address corresponding to the target virtual network card includes: Obtaining the gateway identifier and gateway address in the target routing table entry; The target gateway of the data to be transmitted is determined according to the gateway identifier, the gateway address and the routing address corresponding to the target virtual network card.

5. The method according to any one of claims 1 to 4, characterized in that: If there are at least two types of target gateways, the method further includes: In the case that the routing addresses of the target gateways are the same, selecting an Internet gateway from the target gateways, and obtaining gateway description information of the Internet gateway; Generate a routing table entry in the preset routing flow table according to the gateway description information of the Internet gateway.

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

7. A gateway determination device, characterized in that: The device comprises: An association determination module, used to determine whether there is a target association table entry containing the protocol address in a preset association flow table according to the protocol address of the target virtual network card to which the data to be transmitted belongs; the preset association flow table is used to indicate whether the target virtual network card is associated with an elastic network address; The gateway determination module is used to determine the target gateway of the data to be transmitted according to the target association table entry and the routing address corresponding to the target virtual network card, if it exists; if it does not exist, determine the target gateway of the data to be transmitted according to the protocol address of the target virtual network card and the routing address of the target virtual network card.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

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

Citation Information

Patent Citations

  • Equipment switching method and device, and service system

    CN110474802A

  • System and method for realizing communication between virtual machine and public network

    CN116170406A

  • Cross-AZ equipment switching system and method, storage medium and program product

    CN116346713A

  • Traffic monitoring method and device, equipment and storage medium

    CN116866232A

  • Network topology generation method and device, cloud platform and readable storage medium

    CN118041795A

Cited By

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

    WO2026108768A1