Multi-active allocation method and device for cloud scenario NAT gateway cluster based on multicast
Through the multicast-based NAT gateway cluster multi-active allocation method in cloud scenarios, the problems of limited NAT gateway cluster bandwidth and unstable traffic switching are solved, automatic traffic switching and improvement of service quality are achieved, and the stability and reliability of the system are enhanced. .
Patent Information
- Application Number
- CN202211662560.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-12-23
AI Technical Summary
The bandwidth of the existing NAT gateway cluster is limited, resulting in the inability to automatically switch traffic in the event of a failure, affecting network service quality and stability.
Adopt multicast-based cloud scenario NAT gateway cluster all-active allocation method, by detecting new EIPs and failed NAT gateways in the network, calculate the configured bandwidth utilization, automatically migrate EIPs to the message queue to be processed, and recover or expand the capacity after NAT gateway failure reallocate the traffic at any time to realize automatic switching of traffic.
It improves the bandwidth of the NAT gateway cluster, ensures business service quality, prevents equipment business loss due to limited carrying capacity, realizes seamless traffic switching, and enhances the stability and reliability of the system.
Smart Images

Figure CN115941493B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a multi-active allocation method and related devices for a cloud scenario NAT gateway cluster based on multicast. Background Art
[0002] Software Defined Network (SDN) is a new type of innovative network architecture and a way to implement network virtualization. Its core technology, OpenFlow, separates the control plane from the data plane of network devices, thereby achieving flexible control of network traffic. The OpenFlow network consists of OpenFlow network devices, controllers, secure channels for connecting devices and controllers, and OpenFlow entries. The OpenFlow controller is located in the control layer of the SDN architecture and forwards traffic to devices through the OpenFlow protocol.
[0003] With the rapid development of the information age, the number of computers connected to the LAN is increasing rapidly. Due to insufficient addresses, the needs of network users cannot be met, so NAT gateways are generated. NAT Gateway (Network Address Translation) is a network cloud service that supports NAT and is deployed in cloud scenarios. It provides proxy services for cloud hosts without public IP in VPC to access the Internet, and implements address conversion services from private IP to public IP for cloud hosts. The SNAT function of NAT Gateway has security protection capabilities, which will block the external ports of cloud hosts in VPC and protect cloud hosts in VPC from external intrusions and attacks.
[0004] Since the NAT gateway needs to perform address translation services from private IP to public IP, the local needs to record the mapping and translation information based on the session. In the cloud scenario, in order to increase reliability, such as Figure 1 As shown in the figure, active-standby cluster deployment is generally adopted, and only one NAT gateway provides services at the same time. However, the bandwidth carried by a pair of NAT gateways is limited, and it is very important to improve the bandwidth of the NAT gateway cluster.
[0005] At present, in order to solve the problem of limited network bandwidth, the main methods of bandwidth scheduling are: the central server uniformly schedules and controls the current bandwidth used by each server, and the authoritative DNS migrates the adjusted bandwidth to other servers according to the corresponding scheduling ratio. However, the central server scheduling bandwidth will have a low accuracy of bandwidth scheduling due to the large granularity of bandwidth control, thus affecting the quality of network services; the authoritative DNS will migrate bandwidth according to the corresponding scheduling ratio, because the total amount of bandwidth occupied by each user terminal currently served by each local DNS is different. If the same scheduling ratio is used, it will cause large bandwidth fluctuations in the first server targeted by the service request and other servers that ultimately respond to the service request after migration.
[0006] Therefore, some public cloud networks have begun to use the multi-active deployment of NAT gateways. However, when a NAT gateway fails, traffic cannot be automatically switched and routes need to be manually configured to use other EIPs on the new NAT to carry the original business traffic. When the session is reestablished, the traffic will still be disconnected.
[0007] Therefore, there is an urgent need for a technology that increases the bandwidth of a NAT gateway cluster and enables automatic traffic switching without interruption. Summary of the invention
[0008] The technical problem to be solved by the present invention is: a method for improving the bandwidth of a NAT gateway cluster while automatically switching traffic without interruption. To solve the above problem, the present invention provides a multi-active allocation method and related devices for a cloud scenario NAT gateway cluster based on multicast, which effectively improves the bandwidth of a NAT gateway cluster while automatically switching traffic without interruption.
[0009] In a first aspect, the present invention provides a multi-active allocation method for a cloud scenario NAT gateway cluster based on multicast, comprising:
[0010] Check whether a new EIP is added to the network. If so, proceed to the next step. Otherwise, wait for a certain period of time and repeat this step.
[0011] Obtain all NAT gateways in the network and determine whether the NAT gateway is faulty. If the NAT gateway is faulty, migrate the EIP of the NAT gateway to the queue of pending messages. Otherwise, proceed to the next step.
[0012] Calculate the configured bandwidth utilization of the NAT gateway;
[0013] Determine whether the NAT gateway can carry the newly added EIP according to the configured bandwidth utilization of the NAT gateway. If the NAT gateway can carry the newly added EIP, allocate the newly added EIP to the NAT gateway. Otherwise, migrate the newly added EIP to the queue of pending messages.
[0014] The NAT gateway to which the newly added EIP can be allocated is periodically queried, and the EIP at the head of the queue of the to-be-processed messages is allocated to the NAT gateway.
[0015] Further, the method for calculating the configuration bandwidth utilization of the NAT gateway includes:
[0016] Get the bandwidth of the original EIP on the NAT gateway, the bandwidth of the newly added EIP, and the bandwidth of the NAT gateway external network card;
[0017] The calculation formula of the configured bandwidth utilization of the NAT gateway is: configured bandwidth utilization = (the sum of the bandwidths of the original EIPs on the NAT gateway + the bandwidth of the newly added EIP) / the bandwidth of the NAT gateway external network card.
[0018] Furthermore, the method for determining whether the NAT gateway can carry the newly added EIP includes:
[0019] A preset threshold is set. If the configured bandwidth utilization of the NAT gateway is lower than or equal to the preset threshold, it is determined that the NAT gateway can carry the newly added EIP. Otherwise, it is determined that the NAT gateway cannot carry the newly added EIP.
[0020] Furthermore, the method for periodically querying a NAT gateway to which a newly added EIP can be allocated includes:
[0021] Get all NAT gateways in the network;
[0022] The configured bandwidth utilization of the NAT gateway is calculated in sequence. If the configured bandwidth utilization of the NAT gateway is less than or equal to the preset threshold, the NAT gateway is determined to be a NAT gateway that can allocate a newly added EIP. Otherwise, the NAT gateway is determined to be unallocable to the newly added EIP.
[0023] Furthermore, the method of migrating the EIP of the NAT gateway to the queue of pending messages includes:
[0024] Traverse all EIPs on the NAT gateway and reallocate a NAT gateway to each EIP.
[0025] Furthermore, the multi-active distribution method of the NAT gateway cluster also includes: establishing a multicast synchronization group, the multicast synchronization group shares an IP address, and the multicast synchronization groups synchronize the session publishing information and session receiving information of the multicast message.
[0026] Furthermore, the method for publishing session information of synchronized multicast messages between synchronization groups includes:
[0027] Receive external network access traffic and obtain new session information;
[0028] Determine whether the newly added session information is local session information. If so, mark the newly added session information as local and update the session time. If the newly added session information is not local session information, assign a URL and port to the newly added session information.
[0029] The newly added session information is encapsulated into a multicast message, recorded as a multicast synchronization message, and sent from the IP address of the multicast synchronization group.
[0030] Furthermore, the method for receiving session information of synchronized multicast messages between synchronization groups includes:
[0031] Receive multicast messages;
[0032] Determine whether the IP address of the received multicast message is the IP address of the multicast synchronization group. If so, proceed to the next step; otherwise, end the process;
[0033] Parse the multicast message and determine whether the multicast message is a multicast synchronization message. If so, proceed to the next step. Otherwise, end the process.
[0034] All session information in the cyclic multicast synchronization message is traversed, a mark bit is set for the session information, and the session information is stored.
[0035] Further, the method of traversing all session information in the cyclic multicast synchronization message, setting a mark bit for the session information and storing the same includes:
[0036] Traverse all session information in the cyclic multicast synchronization message;
[0037] Determine the type of the session information. If the session information is newly added session information, set the flag of the session information to remote. If the session information is updated session information, search for the local session information and perform synchronous update. If the session information is deleted session information, delete the session information.
[0038] Stores all session information for which the flag is set.
[0039] In a second aspect, the present invention provides a multi-active distribution device for a cloud scenario NAT gateway cluster based on multicast, the device comprising:
[0040] The detection module is used to detect whether a new EIP is added to the network and whether a gateway failure occurs;
[0041] Information acquisition module, used to obtain NAT gateway and newly added EIP;
[0042] A judgment module, used to calculate the configured bandwidth utilization of the NAT gateway and determine whether the NAT gateway can carry the newly added EIP according to the configured bandwidth utilization of the NAT gateway;
[0043] The allocation module is used to allocate the newly added EIP to the NAT gateway.
[0044] Furthermore, the device also includes:
[0045] The multicast synchronization module is used to synchronize the session publishing information and session receiving information of the multicast message.
[0046] In a third aspect, the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements a multicast-based active-active distribution method for a cloud scenario NAT gateway cluster as described in the first aspect.
[0047] In a fourth aspect, the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the multi-active distribution method of a cloud scenario NAT gateway cluster based on multicast as described in the first aspect above.
[0048] The beneficial effects of the present invention are:
[0049] 1. The NAT gateway is deployed in a multi-active manner, which improves the cluster bandwidth.
[0050] 2. The controller selects a NAT gateway for the EIP based on the configured bandwidth utilization of the NAT gateway to ensure the quality of service and prevent device service loss due to the limited carrying capacity of the NAT gateway in extreme cases, thereby improving the system's ability to cope with sudden business emergencies.
[0051] 3. When a network failure occurs or the current NAT gateway cannot carry the newly added EIP, the controller assigns the EIP to the pending message queue, performs automatic migration, and realizes automatic traffic switching. After the network failure is restored or the NAT gateway is expanded, the EIP is reallocated to the NAT gateway to improve the stability and reliability of the system.
[0052] 4. By establishing multicast groups and synchronizing the session publishing information and session receiving information of multicast messages between multicast synchronization groups, the number of interactive messages is effectively reduced, and the session consistency in the NAT gateway cluster is ensured. When the traffic is switched to other NAT gateways, seamless traffic switching can be achieved to avoid information loss. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 The figure is a schematic diagram of the deployment of the active-standby cluster of NAT gateways in the prior art.
[0054] Figure 2 A schematic diagram of the multi-active cluster deployment of NAT gateways provided by the present invention.
[0055] Figure 3 A schematic flow chart of a multi-active allocation method for a multicast-based cloud scenario NAT gateway cluster provided by the present invention.
[0056] Figure 4 A schematic flow chart of a method for publishing session information of synchronized multicast messages between multicast synchronization groups provided by the present invention.
[0057] Figure 5 A schematic flow chart of a method for receiving session information of synchronized multicast messages between multicast synchronization groups provided by the present invention.
[0058] Figure 6 A structural diagram of the multi-active distribution device of the multicast-based cloud scenario NAT gateway cluster provided by the present invention.
[0059] Figure 7 A schematic diagram of the structure of a computer device provided by the present invention.
[0060] Description of the accompanying drawings: 100, NAT gateway; 200, SDN controller; 300, virtual machine switch; 30, computer device; 31, memory; 32, computer program; 33, processor. DETAILED DESCRIPTION
[0061] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments of the specification. Those of ordinary skill in the art will be able to implement the present invention based on these descriptions. In addition, the embodiments of the present invention involved in the following description are generally only embodiments of a part of the present invention, rather than all embodiments. Therefore, based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative work should fall within the scope of protection of the present invention.
[0062] The following is an introduction to some concepts involved in the embodiments of the present application.
[0063] (1) Software Defined Network (SDN) is a new type of innovative network architecture and a way to implement network virtualization. Its core technology, OpenFlow, separates the control plane from the data plane of network devices, thereby achieving flexible control of network traffic.
[0064] (2) OpenFlow is a network communication protocol that belongs to the data link layer and can control the forwarding plane of network switches or routers. Therefore, it is widely used in SDN architecture. SDN controls the forwarding plane of OVS through OpenFlow, thereby changing the network path taken by network data packets.
[0065] (3) Network Address Translation (NAT) is a network cloud service that supports NAT and is deployed in cloud scenarios. It provides proxy services for cloud hosts without public IP addresses within a VPC to access the Internet, thereby achieving address conversion services from private IP addresses to public IP addresses.
[0066] (4) SNAT rules: By binding the transit IP, multiple cloud hosts across availability zones within a VPC can share the transit IP and access external data centers or other VPCs.
[0067] (5) DNAT rules: By binding the transit IP, IP mapping or port mapping is implemented, so that multiple cloud hosts across availability zones within the VPC can share the transit IP and provide services for the external private network.
[0068] (6) Elastic IP (EIP) refers to a NAT IP that can provide independent public IP resources, including public IP addresses and public network export bandwidth services.
[0069] (7) Netconf is a network configuration and management protocol based on the extensible markup language XML, which uses a simple RPC-based mechanism to achieve communication between clients and servers.
[0070] See also Figure 1 In the prior art, in order to increase the reliability of the network, an active-standby cluster deployment is generally adopted, and only one NAT gateway provides services at the same time. The active-standby cluster deployment may cause network congestion and affect work efficiency due to the limited bandwidth carried by a pair of NAT gateways.
[0071] Therefore, this embodiment provides a multi-active allocation method for a cloud scenario NAT gateway cluster based on multicast, which effectively improves the bandwidth of the NAT gateway cluster and enables automatic traffic switching without interruption. Among them, the method and device described in the embodiment of the present application are based on the same technical concept. Since the principles of the problems solved by the method and the device are similar, the embodiments of the device and the method can refer to each other, and the repeated parts will not be repeated.
[0072] The preferred implementation modes of the present application are described in detail below with reference to the accompanying drawings.
[0073] like Figure 2As shown in the figure, it is a schematic diagram of the multi-active cluster deployment of the NAT gateway provided in this embodiment. In this embodiment, the NAT gateway is deployed in a multi-active form, and two NAT gateways, namely NAT_GW1 and NAT_GW2, are deployed in the environment. The SDN controller manages these two NAT gateways and sends multicast configurations through Netconf to form a multicast synchronization group for them. The tenant configures two EIPs, namely EIP1 and EIP2. The controller selects NAT_GW1 for EIP1 and NAT_GW2 for EIP2, and performs address translation on the SNAT rules and sends them to the corresponding NAT gateway, and sends the diversion flow table on the host machine where the tenant cloud host is located to send the traffic to the corresponding NAT gateway.
[0074] like Figure 3 As shown, a flowchart of a multi-active allocation method for a cloud scenario NAT gateway cluster based on multicast provided in this embodiment includes:
[0075] Step A01: Check whether a new EIP is added to the network. If so, proceed to the next step. Otherwise, wait for a certain period of time and repeat this step.
[0076] Step A02: Obtain all NAT gateways in the network and determine whether the NAT gateway is faulty.
[0077] The SDN controller and NAT gateway are connected via Netconf, and there are keep-alive messages in the connection. If the NAT gateway fails, the connection will be disconnected. The SDN controller determines whether the NAT gateway has failed by sensing whether the Netconf connection is disconnected. If the SDN controller detects that the NAT gateway has failed, it will add the EIP on the NAT gateway to the queue of pending messages.
[0078] Step A03: Calculate the configured bandwidth utilization of the NAT gateway.
[0079] If the SDN controller detects that the NAT gateway is not faulty, the configured bandwidth utilization of the NAT gateway is calculated. When executing step A03, the following steps may be performed when calculating the configured bandwidth utilization of the NAT gateway:
[0080] Step A031: Obtain the bandwidth of the original EIP on the NAT gateway, the bandwidth of the newly added EIP, and the bandwidth of the NAT gateway external network card;
[0081] Step A032: The calculation formula for the configured bandwidth utilization of the NAT gateway is: configured bandwidth utilization = (the sum of the bandwidths of the original EIPs on the NAT gateway + the bandwidth of the newly added EIP) / the bandwidth of the NAT gateway external network card;
[0082] The NAT gateway can deploy multiple EIPs. The EIP currently deployed on the NAT gateway is the original EIP on the NAT gateway. The EIP newly added in the network detected in step A01 is the newly added EIP.
[0083] Step A04: determine whether the NAT gateway can carry the newly added EIP according to the calculated configuration bandwidth utilization of the NAT gateway. If the NAT gateway can carry the newly added EIP, the newly added EIP is allocated to the NAT gateway. Otherwise, the newly added EIP is migrated to the queue of pending messages.
[0084] A preset threshold is set. If the configured bandwidth utilization of the NAT gateway is lower than or equal to the preset threshold, it is determined that the NAT gateway can carry the newly added EIP. Otherwise, it is determined that the NAT gateway cannot carry the newly added EIP. Preferably, the preset threshold is 1. When the configured bandwidth utilization of the NAT gateway is ≤1, it means that the NAT gateway can carry the service of the newly added EIP. The NAT gateway is assigned to the EIP, and the SNAT rules are issued and the OpenFlow flow table is issued on the corresponding host machine to divert the traffic accessing the external network to the NAT gateway. When the configured bandwidth utilization of the NAT gateway is >1, it means that the NAT gateway cannot carry the service of the newly added EIP, and the user needs to expand the capacity of the NAT gateway. Therefore, the EIP on the NAT gateway is migrated to the queue of pending messages, and the EIP is allocated to the NAT gateway again after the expansion. The method of migrating the EIP of the NAT gateway to the queue of pending messages includes: traversing all EIPs on the NAT gateway and reallocating the NAT gateway to each EIP.
[0085] In this embodiment, the EIP on the NAT gateway is migrated to the queue of pending messages, and the EIP is allocated again after the gateway failure is recovered or the gateway capacity is expanded, so that automatic traffic seamless switching can be achieved and the stability of the system can be improved.
[0086] Step A05: Periodically query the NAT gateway to which the newly added EIP can be assigned, and assign the EIP at the head of the queue of pending messages to the NAT gateway.
[0087] When the NAT gateway is expanded or recovered, the original normal business traffic will not be migrated, and the EIP in the message queue will be prioritized for NAT gateway allocation.
[0088] When executing step A05, the NAT gateway to which the newly added EIP can be assigned is periodically queried, and the following steps can be performed when the EIP at the head of the queue of pending messages is assigned to the NAT gateway:
[0089] Get all NAT gateways in the network;
[0090] The configured bandwidth utilization of the NAT gateway is calculated in sequence. If the configured bandwidth utilization of the NAT gateway is less than or equal to the preset threshold, the NAT gateway is determined to be a NAT gateway that can be allocated with a new EIP. Otherwise, the NAT gateway is determined to be unavailable for allocation with a new EIP.
[0091] In order to prevent the bandwidth of other network cards from being occupied and to facilitate mutual data backup between gateways, the multi-active distribution method of a cloud scenario NAT gateway cluster based on multicast provided in this embodiment also includes: establishing a multicast synchronization group, the multicast synchronization group shares an IP address, and the session publishing information and session receiving information of the multicast message are synchronized between the multicast synchronization groups. When a NAT gateway fails, although the SDN controller reassigns the EIP to the NAT gateway after the NAT gateway failure is restored, the session information needs to be re-established because there is no original session information on the restored NAT gateway, resulting in service disconnection and reduced system work efficiency. Therefore, this embodiment achieves automatic traffic switching and reduces information loss by establishing a multicast synchronization group and synchronizing the session publishing information and session receiving information of multicast messages between multicast synchronization groups.
[0092] like Figure 4 As shown, the method for publishing session information of synchronized multicast messages between synchronization groups provided in this embodiment. The cloud host accesses the Internet, the message is sent to the host, and the matching flow table is sent to NAT_GW1. NAT_GW1 searches for local session information and finds that it is a new session. It performs address translation for it according to the SNAT rule and sends the message out. At the same time, the session address mapping information is recorded in the local session information. The specific method includes:
[0093] Receive external network access traffic and obtain new session information;
[0094] Determine whether the newly added session information is local session information. If so, mark the newly added session information as local and update the session time. If the newly added session information is not local session information, assign a URL and port to the newly added session information.
[0095] The newly added session information is encapsulated into a multicast message, recorded as a multicast synchronization message, and sent from the IP address of the multicast synchronization group.
[0096] When the NAT gateway receives traffic to access the external network, it searches for local session information and determines whether the newly added session information is local session information. If the newly added session information is local session information, it means that the newly added session information is not a new session. Then the update time of the session information is updated, and DNAT rule conversion is performed according to the mapping relationship in the found session information, and a URL and port are assigned to the newly added session information. If the newly added session information is not found locally, it means that the newly added session information is a new session. According to the DNAT allocation mapping relationship and marked as local, the mapping relationship, establishment time, local mark bit and other information are recorded in the local session information, and then the URL and port are assigned to the newly added session information after NAT conversion. When the session synchronization thread receives a message that the newly added session information is local or a message that the remote is updated to local, it encapsulates the session information into a multicast message, records it as a multicast synchronization message, and sends it from the IP address of the multicast synchronization group. Similarly, if the local session is aged and deleted, after the session synchronization thread receives the deletion message, it will also encapsulate the deletion message into a multicast message, record it as a multicast synchronization message, and send it from the IP address of the multicast synchronization group.
[0097] When NAT_GW1 suddenly fails, the SDN controller reselects a new NAT gateway NAT_GW2, sends the SNAT rules to the new NAT gateway NAT_GW2, and then modifies the OpenFlow flow table on the host group table to send the traffic to NAT_GW2; the traffic from the cloud host to the Internet reaches NAT_GW2. Since the multicast synchronization group is established, the original NAT session information is saved on NAT_GW2, and the original session information for accessing the Internet does not need to be disconnected and re-established, thus achieving seamless switching. In order to ensure the consistency of information, the NAT gateway will periodically synchronize the local session information to the remote device. After receiving the remote device, the session is smoothed to ensure the consistency of the session information.
[0098] like Figure 5 As shown, the method for receiving session information of synchronized multicast messages between synchronization groups provided in this embodiment includes:
[0099] Receive multicast messages;
[0100] Determine whether the IP address of the received multicast message is the IP address of the multicast synchronization group. If so, proceed to the next step; otherwise, end the process;
[0101] Parse the multicast message and determine whether the multicast message is a multicast synchronization message. If so, proceed to the next step. Otherwise, end the process.
[0102] All session information in the cyclic multicast synchronization message is traversed, and a mark bit is set for the session information and stored.
[0103] Determine the type of the session information. If the session information is new session information, set the session information flag to remote. If the session information is updated session information, search for local session information and perform synchronous update. If the session information is deleted session information, delete the session information. Store the session information with the flag set.
[0104] This embodiment also includes a multi-active distribution device for a cloud scenario NAT gateway cluster based on multicast, the device comprising:
[0105] The detection module is used to detect whether a new EIP is added to the network and whether a gateway failure occurs;
[0106] Information acquisition module, used to obtain NAT gateway and newly added EIP;
[0107] A judgment module is used to calculate the configured bandwidth utilization of the NAT gateway and determine whether the NAT gateway can carry the newly added EIP according to the configured bandwidth utilization of the NAT gateway;
[0108] The allocation module is used to allocate the newly added EIP to the NAT gateway.
[0109] The device further includes: a multicast synchronization module, which is used to synchronize session publishing information and session receiving information of multicast messages.
[0110] like Figure 6 As shown, a computer device is provided in this embodiment, and the computer device 30 includes a memory 31, a processor 33, and a computer program 32 stored in the memory 31 and executable on the processor 33. When the computer program 32 is executed by the processor 33, the multi-active distribution method of the cloud scenario NAT gateway cluster based on multicast as mentioned above is implemented.
[0111] The computer device may be a general-purpose computer device or a special-purpose computer device. In a specific implementation, the computer device may be a server cluster including multiple servers, such as a blockchain system including multiple nodes. Those skilled in the art will understand that Figure 6 It is only an example of a computer device and does not constitute a limitation of the computer device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, such as input and output devices, network access devices, etc.
[0112] The processor 33 may be a central processing unit (CPU), or other general-purpose processors 33, a digital signal processor 33 (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor 33 may be a microprocessor 33 or any conventional processor 33.
[0113] In some embodiments, the memory 31 may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the memory 31 may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Further, the memory 31 may also include both an internal storage unit of the computer device and an external storage device. The memory 31 is used to store an operating system, an application program, a boot loader, data, and other programs. The memory 31 may also be used to temporarily store data that has been output or is to be output.
[0114] On the other hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program 32. When the computer program 32 is executed by the processor 33, it implements the multi-active distribution method of the cloud scenario NAT gateway cluster based on multicast as described above.
Claims
1. A multi-active allocation method for a cloud scenario NAT gateway cluster based on multicast, characterized in that: include: Check whether a new EIP is added to the network. If so, proceed to the next step. Otherwise, wait for a certain period of time and repeat this step. Obtain all NAT gateways in the network and determine whether the NAT gateway is faulty. If the NAT gateway is faulty, migrate the EIP of the NAT gateway to the queue of pending messages. Otherwise, proceed to the next step. Calculate the configured bandwidth utilization of the NAT gateway; Determine whether the NAT gateway can carry the newly added EIP according to the configured bandwidth utilization of the NAT gateway. If the NAT gateway can carry the newly added EIP, allocate the newly added EIP to the NAT gateway. Otherwise, migrate the newly added EIP to the queue of pending messages. Periodically query the NAT gateway to which the newly added EIP can be allocated, and allocate the EIP at the head of the queue of pending messages to the NAT gateway; The method for calculating the configuration bandwidth utilization of the NAT gateway includes: Get the bandwidth of the original EIP on the NAT gateway, the bandwidth of the newly added EIP, and the bandwidth of the NAT gateway external network card; The calculation formula of the configured bandwidth utilization of the NAT gateway is: configured bandwidth utilization = (the sum of the bandwidth of the original EIP on the NAT gateway + the bandwidth of the newly added EIP) / the bandwidth of the NAT gateway external network card; The method for determining whether the NAT gateway can carry the newly added EIP includes: A preset threshold is set. If the configured bandwidth utilization rate of the NAT gateway is lower than or equal to the preset threshold, it is determined that the NAT gateway can carry the newly added EIP. Otherwise, it is determined that the NAT gateway cannot carry the newly added EIP. Methods for periodically querying NAT gateways that can be assigned newly added EIPs include: Get all NAT gateways in the network; The configured bandwidth utilization of the NAT gateway is calculated in sequence. If the configured bandwidth utilization of the NAT gateway is less than or equal to the preset threshold, the NAT gateway is determined to be a NAT gateway that can allocate a newly added EIP. Otherwise, the NAT gateway is determined to be unallocable to the newly added EIP.
2. The multi-active allocation method of the cloud scenario NAT gateway cluster based on multicast according to claim 1 is characterized in that, The method of migrating the EIP of the NAT gateway to the queue of pending messages includes: Traverse all EIPs on the NAT gateway and reallocate a NAT gateway to each EIP.
3. The multi-active allocation method of the cloud scenario NAT gateway cluster based on multicast according to claim 1 is characterized in that, The multi-active distribution method of the NAT gateway cluster also includes: establishing a multicast synchronization group, the multicast synchronization group shares an IP address, and the multicast synchronization groups synchronize the session publishing information and session receiving information of the multicast message.
4. The multi-active allocation method of the cloud scenario NAT gateway cluster based on multicast according to claim 3 is characterized in that, The method for publishing session information of synchronized multicast messages between synchronization groups includes: Receive external network access traffic and obtain new session information; Determine whether the newly added session information is local session information. If so, mark the newly added session information as local and update the session time. If the newly added session information is not local session information, assign a URL and port to the newly added session information. The newly added session information is encapsulated into a multicast message, recorded as a multicast synchronization message, and sent from the IP address of the multicast synchronization group.
5. The multi-active allocation method of the cloud scenario NAT gateway cluster based on multicast according to claim 4 is characterized in that, The method for receiving session information of synchronized multicast messages between synchronization groups includes: Receive multicast messages; Determine whether the IP address of the received multicast message is the IP address of the multicast synchronization group. If so, proceed to the next step; otherwise, end the process; Parse the multicast message and determine whether the multicast message is a multicast synchronization message. If so, proceed to the next step. Otherwise, end the process. All session information in the cyclic multicast synchronization message is traversed, a mark bit is set for the session information, and the session information is stored.
6. The multi-active allocation method of the cloud scenario NAT gateway cluster based on multicast according to claim 5 is characterized in that: The method of traversing all session information in the cyclic multicast synchronization message, setting a mark bit for the session information and storing the same includes: Traverse all session information in the cyclic multicast synchronization message; Determine the type of the session information. If the session information is newly added session information, set the flag of the session information to remote. If the session information is updated session information, search for the local session information and perform synchronous update. If the session information is deleted session information, delete the session information. Stores all session information for which the flag is set.
7. A multi-active distribution device for a cloud scenario NAT gateway cluster based on multicast, used to execute the cloud scenario NAT gateway cluster distribution method based on multicast as described in any one of claims 1-6, characterized in that: The device comprises: The detection module is used to detect whether a new EIP is added to the network and whether a gateway failure occurs; Information acquisition module, used to obtain NAT gateway and newly added EIP; A judgment module, used to calculate the configured bandwidth utilization of the NAT gateway and determine whether the NAT gateway can carry the newly added EIP according to the configured bandwidth utilization of the NAT gateway; The allocation module is used to allocate the newly added EIP to the NAT gateway.
8. The multi-active distribution device of the cloud scenario NAT gateway cluster based on multicast according to claim 7 is characterized in that: The device also includes: The multicast synchronization module is used to synchronize the session publishing information and session receiving information of the multicast message.
9. A computer device, characterized in that: The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the multi-active distribution method of the cloud scenario NAT gateway cluster based on multicast is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the multi-active distribution method of a cloud scenario NAT gateway cluster based on multicast is implemented as described in any one of claims 1 to 6.
