Method and device based on gateway equipment load balancing and electronic equipment

By preconfiguring the load balancing policy on the gateway device and matching the target policy, the problem of poor network access quality in the existing technology is solved, and the load balancing allocation of DNS requests and the improvement of network access quality is achieved.

CN119520410AInactive Publication Date: 2025-02-25BEIJING ANBOTONG TECH CO LTD

Patent Information

Application Number
CN202510072942.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-17
Publication Date
2025-02-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The lack of load balancing strategies in the prior art leads to poor network access quality, especially in cross-operator network scenarios, slow network access speed and DNS proxy traffic are prone to excessive link load.

Method used

By preconfiguring the load balancing policy on the gateway device, receiving DNS messages sent by the client, creating a session and matching the target load balancing policy, computing the corresponding link interface, and realizing load balancing allocation of DNS requests.

Benefits of technology

This method can reduce the network configuration planning workload of DNS proxy policy selection and other traffic, ensure that DNS requests always access high-quality DNS servers exported by the current operator, and ensure that the client's DNS requests and Internet requests go to the external network through the same link, thereby improving network access quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119520410A_ABST
    Figure CN119520410A_ABST
Patent Text Reader

Abstract

The invention relates to a load balancing method and device based on gateway equipment and electronic equipment, and belongs to the technical field of network communication, and the method comprises the steps that a load balancing strategy is pre-configured, and the load balancing strategy comprises a load balancing interface and a matching condition; receiving a DNS message sent by the client; when it is determined that a session corresponding to the DNS message does not exist in a preset session table, creating a first session based on the DNS message; matching a first session with the load balancing strategy to obtain a target load balancing strategy; and calculating the source address of the first session based on the target load balancing strategy to obtain a link interface corresponding to the first session. According to the invention, the DNS request can be ensured to always access the high-quality DNS server at the exit of the current operator, and the DNS request and the internet access request of the client are ensured to always access the external network through the same link, so that the network access quality of the client is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication technology, and in particular to a method, device and electronic equipment based on gateway device load balancing. Background Art

[0002] In modern life and work, the Internet has become increasingly indispensable. In order to avoid the network availability risks caused by network export failures and solve the network access problems caused by insufficient network bandwidth, network users generally rent two or more operator exports (such as: China Telecom, China Mobile, China Unicom, etc.).

[0003] In the prior art, enterprises rent multiple operator exports. When intranet users access the external network, they will search for the server through the DNS address configured on the user's host. The IP address returned at this time is not necessarily the IP address under the jurisdiction of the corresponding operator. In this cross-operator network scenario, the user's Internet speed cannot be guaranteed. In order to enable our corresponding link to return the IP address of the service provided by the corresponding service provider and solve the problem of slow Internet speed, a more common DNS proxy function is provided. While this technology solves the problem of Internet speed, all DNS traffic will rush to a certain network exit, causing the link to be overloaded. The independent DNS proxy strategy can manage the user's DNS business in a refined manner, but it will also bring tedious configuration management work to the network administrator. And there is a great possibility that the DNS proxy traffic and the subsequent website access traffic will go to different links respectively. In this case, it brings great difficulties to the user's business management and traffic control.

[0004] In summary, the existing technology lacks a load balancing strategy to improve the quality of network access. Summary of the invention

[0005] In view of this, it is necessary to provide a method, an apparatus and an electronic device based on gateway device load balancing to solve the problem of poor network access quality in the prior art.

[0006] In order to solve the above problems, the present invention provides a method based on gateway device load balancing, which is applied to the gateway device and includes: Preconfigure a load balancing strategy, wherein the load balancing strategy includes a load balancing interface and a matching condition; Receive DNS messages sent by the client; When it is determined that there is no session corresponding to the DNS message in the preset session table, creating a first session based on the DNS message; Matching the first session with the load balancing strategy to obtain a target load balancing strategy; The source address of the first session is calculated based on the target load balancing policy to obtain a link interface corresponding to the first session.

[0007] In a possible implementation, the load balancing interface includes: basic configuration and DNS server configuration, the basic configuration includes the outbound interface link name and the next hop address, the DNS server configuration includes whether to enable the DNS service, manual configuration or inheritance link configuration, primary DNS address, backup DNS address and DNS detection failure action; The matching conditions include: client, source interface, source address, destination address, time matching, matching protocol and matching port number.

[0008] In a possible implementation, the receiving a DNS message sent by the client includes: When the received DNS message is sent by a client that can only access the intranet, the corresponding DNS server configuration includes whether to enable the DNS service, manual configuration or inherited link configuration, primary DNS address, backup DNS address, and DNS detection failure action; When the received DNS message is sent by a client that can access the external network, the corresponding DNS server configuration includes whether to enable the DNS service, manual configuration or inherited link configuration, and DNS detection failure action.

[0009] In a possible implementation, the method further includes: When it is determined that the second session corresponding to the DNS message exists in the preset session table, the DNS message is forwarded based on the load balancing policy corresponding to the second session.

[0010] In a possible implementation manner, calculating the source address of the first session based on the target load balancing policy to obtain the link interface corresponding to the first session includes: Based on the target load balancing strategy, a hash algorithm is used to calculate the source address of the first session to obtain a link interface corresponding to the first session.

[0011] In a possible implementation, the source address of the first session is calculated by using a hash algorithm based on the target load balancing strategy to obtain a link interface corresponding to the first session, including: Set weight for each link interface; Based on the link interface and the weight, obtaining a weight hash table; Obtain the client source IP address corresponding to the first session, and obtain a hash value of the source IP based on the client source IP address; Obtaining an index value based on the hash value and the weight; A link interface corresponding to the first session is determined in the weighted hash table based on the index value.

[0012] In a possible implementation manner, after calculating the source address of the first session based on the first load balancing strategy to obtain the link interface corresponding to the first session, the method further includes: DNS address detection is performed based on the link interface.

[0013] In a possible implementation manner, the performing DNS address detection based on the link interface includes: When it is determined that the DNS address detection based on the link interface is successful, starting the link interface and the DNS proxy; When it is determined that the DNS address detection based on the link interface fails, the link interface is disabled or the DNS proxy is disabled.

[0014] On the other hand, the present invention also provides a device based on gateway device load balancing, comprising: A pre-configuration module, used for pre-configuring a load balancing strategy, wherein the load balancing strategy includes a load balancing interface and a matching condition; A message receiving module is used to receive the DNS message sent by the client; A session creation module, configured to create a first session based on the DNS message when it is determined that the session corresponding to the DNS message does not exist in a preset session table; A target load balancing policy acquisition module, used to match the first session with the load balancing policy to obtain a target load balancing policy; The link interface acquisition module is used to calculate the source address of the first session based on the target load balancing strategy to obtain the link interface corresponding to the first session.

[0015] On the other hand, the present invention also provides an electronic device, including a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in a method based on gateway device load balancing described in any one of the above implementations.

[0016] On the other hand, the present invention also provides a computer-readable storage medium for storing computer-readable programs or instructions, which, when executed by a processor, can implement the steps in a method based on gateway device load balancing described in any of the above-mentioned implementation methods.

[0017] The beneficial effects of the present invention are as follows: the present invention provides a method for load balancing based on a gateway device, first pre-configuring a load balancing strategy, the load balancing strategy including a load balancing interface and a matching condition, then receiving a DNS message sent by a client, further creating a first session based on the DNS message when it is determined that the session corresponding to the DNS message does not exist in a preset session table, further matching the first session with the load balancing strategy to obtain a target load balancing strategy, which can reduce the workload of network configuration planning for DNS proxy strategy routing and other traffic, and further calculating the source address of the first session based on the target load balancing strategy to obtain a link interface corresponding to the first session. The present invention configures a load balancing strategy and matches the target load balancing strategy corresponding to the session from the load balancing strategy, thereby ensuring that the DNS request always accesses the high-quality DNS server exported by the current operator, ensuring that the DNS request and Internet access request of the client always pass through the same link to the external network, making it easier for the gateway device to manage user traffic and related services, thereby improving the quality of client network access. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A flow chart of an embodiment of a method based on gateway device load balancing provided by the present invention; Figure 2 A flow chart of a load balancing strategy configuration method in an embodiment of a method based on gateway device load balancing provided by the present invention; Figure 3 For the present invention Figure 1 A schematic flow chart of an embodiment of S102; Figure 4 A flowchart of a specific embodiment of a method based on gateway device load balancing provided by the present invention; Figure 5 A DNS proxy traffic scenario diagram of load balancing strategy routing in a specific embodiment of the present invention; Figure 6 A schematic diagram of an embodiment of a device for gateway device load balancing provided by the present invention; Figure 7 A schematic structural diagram of an embodiment of an electronic device provided by the present invention. DETAILED DESCRIPTION

[0019] The preferred embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.

[0020] Before presenting the embodiments, the following terms are explained.

[0021] A gateway device, also known as an internetwork connector or protocol converter, is a computer system or device that provides data conversion services between multiple networks. It can be said that a gateway device is a connector between different networks, that is, a device that must be negotiated when data is transferred from one network to another.

[0022] Embodiment 1: The present invention provides a method, an apparatus and an electronic device based on gateway device load balancing, which are respectively described below.

[0023] Figure 1 A schematic diagram of an embodiment of a method for gateway device load balancing provided by the present invention is shown in FIG. Figure 1 As shown, the method based on gateway device load balancing is applied to the gateway device, including: S101, pre-configure a load balancing strategy, wherein the load balancing strategy includes a load balancing interface and a matching condition; S102, receiving a DNS message sent by the client; S103: if it is determined that there is no session corresponding to the DNS message in the preset session table, create a first session based on the DNS message; S104, matching the first session with the load balancing policy to obtain a target load balancing policy; S105: Calculate the source address of the first session based on the target load balancing policy to obtain a link interface corresponding to the first session.

[0024] Compared with the prior art, the present invention provides a method based on load balancing of a gateway device, first pre-configures a load balancing strategy, the load balancing strategy includes a load balancing interface and a matching condition, and the pre-configured load balancing strategy can reduce the complicated and tedious work of configuring the DNS proxy strategy on the gateway device, and then receives the DNS message sent by the client, and further creates a first session based on the DNS message when it is determined that the session corresponding to the DNS message does not exist in the preset session table, and further matches the first session with the load balancing strategy to obtain the target load balancing strategy, which can reduce the workload of network configuration planning of the DNS proxy strategy routing and other traffic, and further calculates the source address of the first session based on the target load balancing strategy to obtain the link interface corresponding to the first session. The present invention configures the load balancing strategy, matches the target load balancing strategy corresponding to the session from the load balancing strategy, thereby ensuring that the DNS request always accesses the high-quality DNS server exported by the current operator, and ensures that the DNS request and Internet access request of the client always pass through the same link to the external network, so that the gateway device can more easily manage user traffic and related services, thereby improving the quality of client network access.

[0025] In some embodiments of the present invention, the load balancing interface includes: basic configuration and DNS server configuration, the basic configuration includes the outbound interface link name and the next hop address, the DNS server configuration includes whether to enable the DNS service, manual configuration or inheritance link configuration, primary DNS address, backup DNS address and DNS detection failure action; The matching conditions include: client, source interface, source address, destination address, time matching, matching protocol and matching port number.

[0026] In a specific embodiment of the present invention, in step S101, Figure 2 The following are the specific steps for configuring a load balancing policy. First, configure the load balancing outbound interface link on the gateway device, configure the next hop address in the outbound interface link, configure the DNS proxy server IP address and DNS detection, and select the behavior after the detection fails. By pre-configuring the load balancing policy, the complex and tedious work of configuring the DNS proxy policy on the gateway device can be reduced, and the workload of network configuration planning for DNS proxy policy selection and other traffic can be reduced.

[0027] Then create a load balancing policy and select a load sharing method in the load balancing policy, such as sharing by link priority or sharing by link weight. Finally, add the previously created load balancing outbound interface link configuration to the load balancing policy.

[0028] In some embodiments of the present invention, in the load balancing strategy, when the outbound interface link in the basic configuration is a DHCP and PPPoE dynamic interface, the method can automatically obtain the DNS address dynamically obtained by the interface without manual modification, and can directly inherit the link export configuration.

[0029] In some embodiments of the present invention, Figure 3 As shown, the receiving of the DNS message sent by the client includes: S301, when the received DNS message is sent by a client that can only access the intranet, the corresponding DNS server configuration includes whether to enable the DNS service, manual configuration or inherited link configuration, primary DNS address, backup DNS address, and DNS detection failure action; S302: When the received DNS message is sent by a client that can access the external network, the corresponding DNS server configuration includes whether to enable the DNS service, manual configuration or inherited link configuration, and DNS detection failure action.

[0030] In a specific embodiment of the present invention, in step S101, Figure 4 The figure shows the forwarding flow chart of DNS proxy traffic selected by load balancing strategy. The specific steps are as follows: Step 1: Receive the DNS message sent by the client; Step 2: Check whether the same session exists. If so, forward it according to the load balancing policy corresponding to the existing session. If not, create a session according to the five-tuple corresponding to the DNS message. Step 3: Match the created session with the load balancing policy to obtain the target load balancing policy corresponding to the session; Step 4: The target load balancing strategy performs hash calculation based on the source address of the session to obtain the link interface corresponding to the DNS message; Step 5: Perform DNS address detection according to the link interface. If the detection is successful, the link interface directly sends a DNS request message to the configured DNS address to resolve the real domain name sent by the client, such as www.xxxx.com.

[0031] Step 6: When the DNS address detection is successful according to the link interface, the link interface and the DNS proxy are enabled; when the DNS address detection is failed according to the link interface, the link interface is disabled or the DNS proxy is disabled; Step 7: Select a link based on the detection results and complete the DNS proxy within the link.

[0032] In the above steps, the source IP of the session is hashed through the load balancing strategy during the message forwarding process to ensure that the DNS service of the same user and other services are forwarded through the same link to ensure network quality. At the same time, the link interface sends a DNS request message to the DNS address to resolve the address of www.xxxx.com and verify the validity of the DNS address.

[0033] The load balancing policy will then select the transmission link based on the DNS detection result and the load balancing type (priority or weight). When configuring the load balancing policy outbound interface link, the next hop address of the link will be configured, and the message will be forwarded according to the next hop address of the load balancing policy outbound link, without the need to add additional static routes or other dynamic routing configurations.

[0034] In summary, the gateway device does not need to configure additional DNS proxy policies or routing configurations, and can switch link status based on DNS detection results. This reduces the network administrator's configuration tasks while ensuring the quality of user network access.

[0035] In some embodiments of the present invention, it further comprises: When it is determined that the second session corresponding to the DNS message exists in the preset session table, the DNS message is forwarded based on the load balancing policy corresponding to the second session.

[0036] In some embodiments of the present invention, in step S104, matching the first session with the load balancing strategy specifically includes: After the gateway device creates a new session, the session will be sent to the load balancing policy and compared one by one according to the matching conditions set in the load balancing policy. The matching conditions in the control policy include user, source interface, source address, destination address, time and service. The service includes matching protocol and port number. The source interface information is not carried in the session. Instead, the policy directly queries according to the interface on the device and only matches the messages coming in from the interface.

[0037] The time in the load balancing policy is used to constrain the working hours of the policy. For example, you can set a working time object as 9:00-18:00, and then configure it in the policy. Then the policy will not work during non-working hours.

[0038] In some embodiments of the present invention, calculating the source address of the first session based on the target load balancing strategy to obtain the link interface corresponding to the first session includes: Based on the target load balancing strategy, a hash algorithm is used to calculate the source address of the first session to obtain a link interface corresponding to the first session.

[0039] In some embodiments of the present invention, the source address of the first session is calculated using a hash algorithm based on the target load balancing strategy to obtain a link interface corresponding to the first session, including: Set weight for each link interface; Based on the link interface and the weight, obtaining a weight hash table; Obtain the client source IP address corresponding to the first session, and obtain a hash value of the source IP based on the client source IP address; Obtaining an index value based on the hash value and the weight; A link interface corresponding to the first session is determined in the weighted hash table based on the index value.

[0040] In some embodiments of the present invention, after calculating the source address of the first session based on the first load balancing strategy to obtain the link interface corresponding to the first session, the method further includes: DNS address detection is performed based on the link interface.

[0041] It should be noted that this embodiment can perform DNS address detection, and when the DNS address fails, it can be selected to automatically close the DNS proxy function or automatically close the current link. In some embodiments of the present invention, the DNS address detection based on the link interface includes: When it is determined that the DNS address detection based on the link interface is successful, starting the link interface and the DNS proxy; When it is determined that the DNS address detection based on the link interface fails, the link interface is disabled or the DNS proxy is disabled.

[0042] Embodiment 2: like Figure 2 The figure shows the flow chart of the load balancing strategy configuration method. After the load balancing strategy is configured, the DNS message can be forwarded according to the strategy corresponding to the DNS message when it is received. Figure 5 As shown, department 1 is an intranet client, and departments 2 and 3 are accessible extranet clients.

[0043] Department 1 in the company network is only allowed to access the internal network. The department uses intranet DNS servers 1 and 2, and uses intranet exit 1 and intranet exit 2 as backup for each other.

[0044] Department 1's DNS proxy based on load balancing policy can be configured as follows: Step 1: Create a new outbound interface link. Specifically, fill in the outbound interface link name ge2 and the next hop address 10.210.2.2 in the New Outbound Interface Link page. Select Enable in the DNS server enable and disable options; Select Manual Configuration from the Manual Configuration and Inherit Link Configuration options; Enter 10.210.230.2 in the Primary DNS text box; Enter 10.210.230.3 in the Backup DNS text box; Select On from the On and Off options in the DNS Detection option; In the DNS detection failure options, select Disable DNS function and Disable load link outbound interface, and select Disable load link; It should be noted that if the outbound interface link name is not manually filled in, for example, when one of the DHCP, Tunnel, PPPOE interface and Layer 3 interface is selected, the next hop text box can be empty.

[0045] Step 2: Add the outbound interface link to the load balancing policy and add matching conditions to the policy to match the client of department 1. Specifically: Select Enable in the Basic Settings of the Load Balancing Policy page; In the Load Balancing Strategy options, select Based on Priority Load or Based on Weight Load. Select Department 1 in the user options of the matching condition to match Department 1; In the Source Interface text box, select any to indicate any source interface, or select one or more other specific source interfaces. In the Source address text box, select any to indicate any source address, or select a specific IP address or IP address range; In the Destination Address text box, select any to indicate any destination address, or select a specific IP address or IP address range; Select "always" in the time text box to indicate any time. The time can be set according to specific needs. Select any in the Service text box to indicate that any matching protocol and port number can be matched.

[0046] The DNS proxy based on the load balancing strategy of Department 2 and Department 3 can be configured as follows: Step 1: Create a new outbound interface link. Specifically, fill in the outbound interface link name ge3 in the New Outbound Interface Link page (ge3 has been configured as the network interface corresponding to China Telecom PPPoE); Select Enable in the DNS server enable and disable options; Select Inherit link configuration from the Manual configuration and Inherit link configuration options. In this case, you do not need to fill in the Primary DNS text box and the Backup DNS text box. Select On from the On and Off options in the DNS Detection option; In the DNS detection failure options, select Disable DNS function and Disable load link outbound interface, and select Disable load link; It should be noted that if the outbound interface link name is not manually filled in, for example, when one of the DHCP, Tunnel, PPPOE interface and Layer 3 interface is selected, the next hop text box can be empty.

[0047] Step 2: Add the external network outbound interface link to the load balancing policy, and add matching conditions to the policy to match the clients of department 2 and department 3. Specifically: Select Enable in the Basic Settings of the Load Balancing Policy page; In the Load Balancing Strategy options, select Based on Priority Load or Based on Weight Load. Select Department 2 and Department 3 in the user options of the matching conditions to match Department 2 and Department 3; In the Source Interface text box, select any to indicate any source interface, or select one or more other specific source interfaces. In the Source address text box, select any to indicate any source address, or select a specific IP address or IP address range; In the Destination Address text box, select any to indicate any destination address, or select a specific IP address or IP address range; Select "always" in the time text box to indicate any time. The time can be set according to specific needs. Select any in the Service text box to indicate that any matching protocol and port number can be matched.

[0048] After the above two load balancing policies are configured, the internal clients of the gateway can access the Internet normally without the need to configure additional routing policies and DNS proxy policies.

[0049] In summary, the present invention can ensure that DNS requests always access the high-quality DNS servers exported by the current operator, and ensure that the user's DNS requests and Internet access requests always go through the same link to the external network; making it easier for the gateway device to manage user traffic and related services.

[0050] In order to better implement a method based on gateway device load balancing in an embodiment of the present invention, based on a method based on gateway device load balancing, correspondingly, as Figure 6 As shown, an embodiment of the present invention further provides a device based on gateway device load balancing, and a device 600 based on gateway device load balancing includes: A pre-configuration module 601 is used to pre-configure a load balancing strategy, wherein the load balancing strategy includes a load balancing interface and a matching condition; The message receiving module 602 is used to receive the DNS message sent by the client; A session creation module 603, configured to create a first session based on the DNS message when it is determined that the session corresponding to the DNS message does not exist in the preset session table; A target load balancing policy acquisition module 604 is used to match the first session with the load balancing policy to obtain a target load balancing policy; The link interface acquisition module 605 is used to calculate the source address of the first session based on the target load balancing policy to obtain the link interface corresponding to the first session.

[0051] The device 600 based on gateway device load balancing provided in the above embodiment can implement the technical solution described in the above method embodiment based on gateway device load balancing. The specific implementation principles of the above modules or units can refer to the corresponding contents in the above method embodiment based on gateway device load balancing, which will not be repeated here.

[0052] like Figure 7 As shown, the present invention also provides an electronic device 700. The electronic device 700 includes a processor 701, a memory 702 and a display 703. Figure 7Only some components of the electronic device 700 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0053] In some embodiments, the processor 701 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 702, such as a method based on gateway device load balancing in the present invention.

[0054] In some embodiments, the processor 701 may be a single server or a server group. The server group may be centralized or distributed. In some embodiments, the processor 701 may be local or remote. In some embodiments, the processor 701 may be implemented in a cloud platform. In some embodiments, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multi-cloud, etc., or any combination thereof.

[0055] In some embodiments, the memory 702 may be an internal storage unit of the electronic device 700, such as a hard disk or memory of the electronic device 700. In other embodiments, the memory 702 may also be an external storage device of the electronic device 700, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the electronic device 700.

[0056] Furthermore, the memory 702 may include both an internal storage unit of the electronic device 700 and an external storage device. The memory 702 is used to store application software installed in the electronic device 700 and various data.

[0057] In some embodiments, the display 703 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 703 is used to display information on the electronic device 700 and to display a visual client interface. The components 701-703 of the electronic device 700 communicate with each other via a system bus.

[0058] In one embodiment, when the processor 701 executes a program based on gateway device load balancing in the memory 702, the following steps may be implemented: Preconfigure a load balancing strategy, wherein the load balancing strategy includes a load balancing interface and a matching condition; Receive DNS messages sent by the client; When it is determined that there is no session corresponding to the DNS message in the preset session table, creating a first session based on the DNS message; Matching the first session with the load balancing strategy to obtain a target load balancing strategy; The source address of the first session is calculated based on the target load balancing policy to obtain a link interface corresponding to the first session.

[0059] It should be understood that: when the processor 701 executes a program based on gateway device load balancing in the memory 702, in addition to the above functions, other functions can also be implemented. For details, please refer to the description of the corresponding method embodiment above.

[0060] Furthermore, the embodiment of the present invention does not specifically limit the type of the electronic device 700 mentioned, and the electronic device 700 may be a portable electronic device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device, a laptop computer, etc. Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with IOS, Android, Microsoft or other operating systems. The above-mentioned portable electronic devices may also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present invention, the electronic device 700 may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).

[0061] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.

[0062] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.

Claims

1. A method based on gateway device load balancing, applied to a gateway device, characterized in that: include: Preconfigure a load balancing strategy, wherein the load balancing strategy includes a load balancing interface and a matching condition; Receive DNS messages sent by the client; When it is determined that there is no session corresponding to the DNS message in the preset session table, creating a first session based on the DNS message; Matching the first session with the load balancing strategy to obtain a target load balancing strategy; The source address of the first session is calculated based on the target load balancing policy to obtain a link interface corresponding to the first session.

2. The method based on gateway device load balancing according to claim 1, characterized in that: The load balancing interface includes: basic configuration and DNS server configuration, the basic configuration includes the outbound interface link name and the next hop address, the DNS server configuration includes whether to enable the DNS service, manual configuration or inheritance link configuration, primary DNS address, backup DNS address and DNS detection failure action; The matching conditions include: client, source interface, source address, destination address, time matching, matching protocol and matching port number.

3. The method based on gateway device load balancing according to claim 2, characterized in that: The receiving of the DNS message sent by the client includes: When the received DNS message is sent by a client that can only access the intranet, the corresponding DNS server configuration includes whether to enable the DNS service, manual configuration or inherited link configuration, primary DNS address, backup DNS address, and DNS detection failure action; When the received DNS message is sent by a client that can access the external network, the corresponding DNS server configuration includes whether to enable the DNS service, manual configuration or inherited link configuration, and DNS detection failure action.

4. The method based on gateway device load balancing according to claim 1, characterized in that: Also includes: When it is determined that the second session corresponding to the DNS message exists in the preset session table, the DNS message is forwarded based on the load balancing policy corresponding to the second session.

5. The method based on gateway device load balancing according to claim 1, characterized in that: The calculating the source address of the first session based on the target load balancing strategy to obtain the link interface corresponding to the first session includes: Based on the target load balancing strategy, a hash algorithm is used to calculate the source address of the first session to obtain a link interface corresponding to the first session.

6. The method based on gateway device load balancing according to claim 5, characterized in that: The source address of the first session is calculated by using a hash algorithm based on the target load balancing strategy to obtain a link interface corresponding to the first session, including: Set weight for each link interface; Based on the link interface and the weight, obtaining a weight hash table; Obtain the client source IP address corresponding to the first session, and obtain a hash value of the source IP based on the client source IP address; Obtaining an index value based on the hash value and the weight; A link interface corresponding to the first session is determined in the weighted hash table based on the index value.

7. The method based on gateway device load balancing according to claim 1, characterized in that: After calculating the source address of the first session based on the first load balancing strategy to obtain the link interface corresponding to the first session, the method further includes: DNS address detection is performed based on the link interface.

8. The method based on gateway device load balancing according to claim 7, characterized in that: The performing DNS address detection based on the link interface includes: When it is determined that the DNS address detection based on the link interface is successful, starting the link interface and the DNS proxy; When it is determined that the DNS address detection based on the link interface fails, the link interface is disabled or the DNS proxy is disabled.

9. A device based on gateway device load balancing, characterized in that: include: A pre-configuration module, used for pre-configuring a load balancing strategy, wherein the load balancing strategy includes a load balancing interface and a matching condition; A message receiving module is used to receive the DNS message sent by the client; A session creation module, configured to create a first session based on the DNS message when it is determined that the session corresponding to the DNS message does not exist in a preset session table; A target load balancing policy acquisition module, used to match the first session with the load balancing policy to obtain a target load balancing policy; The link interface acquisition module is used to calculate the source address of the first session based on the target load balancing strategy to obtain the link interface corresponding to the first session.

10. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in the method based on gateway device load balancing as described in any one of claims 1 to 8 above.

Citation Information

Patent Citations

  • Method and device for balancing link load on basis of domain name resolution

    CN101873358A

  • Load balance processing method and device

    CN103297347A

  • Domain name resolution method and apparatus, and computer-readable storage medium

    WO2019237288A1

Cited By

  • Load balancing method and device supporting data source-in and source-out

    CN120980027A