Load balancing method, device, electronic device and storage medium supporting IPv6

By modifying the target MAC address at the IPV6 message sending end, load balancing of IPV6 messages is achieved, and the problem of wasted bandwidth resources during transmission and reception of IPV6 messages is solved. It is suitable for a wide range of bond interface deployment scenarios.

CN116155902BActive Publication Date: 2024-11-26CHINA TELECOM CLOUD TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211736430.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-30
Publication Date
2024-11-26
Estimated Expiration
2042-12-30

AI Technical Summary

Technical Problem

IPV6 lacks load balancing mechanism when sending and receiving packets, resulting in wasted bandwidth resources.

Method used

By creating an ns message on the data message sending end, and obtaining the destination MAC address based on the destination IP address, sending data messages based on the source IP address, source MAC address, destination IP address and MAC address of the sending interface, realizing the IPV6 message Load balancing.

Benefits of technology

It improves the utilization rate of network bandwidth, avoids the waste of bandwidth resources, and is suitable for all scenarios where bond interfaces are deployed, without changing the original network architecture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116155902B_ABST
    Figure CN116155902B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a load balancing method, device, electronic device and storage medium supporting IPV6. The load balancing method supporting IPV6 includes: creating a first ns message when it is determined that the destination IP address of the data message to be sent does not have a link layer address; modifying the link layer address field in the option field of the first ns message to the first MAC address of the first sending interface; sending the first ns message based on the first sending interface; receiving the first na message for the first ns message, and obtaining the destination MAC address corresponding to the destination IP address from the na message; sending the data message based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface. Load balancing of IPV6 messages at the receiving end is achieved, the utilization rate of network bandwidth is improved, and the waste of bandwidth resources is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer technology, and in particular relates to a load balancing method, device, electronic equipment and storage medium supporting IPv6. Background Art

[0002] In resource pool network deployment, in order to increase bandwidth, multiple network cards can be bound together and used as bond interfaces (bonding ports). When one of the network cards fails, the server service will not be interrupted. Among them, the bond interface has 7 modes. The adaptive load balancing mode realizes load balancing in the receiving and sending directions, and does not require any configuration of the switch, so it has been widely used.

[0003] However, currently, for IPV6 (Internet Protocol Version 6), only the physical network interface is used to send and receive messages, and there is no corresponding load balancing mechanism for the receiving direction, resulting in a waste of bandwidth resources. Summary of the invention

[0004] The present invention provides a load balancing method, device, electronic device and storage medium supporting IPv6, so as to solve the technical problem that load balancing cannot be achieved when sending and receiving messages in IPv6, resulting in waste of bandwidth resources.

[0005] In a first aspect, the present invention provides a load balancing method supporting IPV6, which is applied to a first network end, wherein the first network end includes a plurality of bound network cards, and the network card interfaces of the plurality of network cards serve as slave interfaces of the bound ports, and the method includes:

[0006] When it is determined that the destination IP address of the data message to be sent does not have a link layer address, create a first ns message and obtain a first client information table corresponding to the destination IP address;

[0007] When it is determined according to the first client information table that no first sending interface is allocated for the destination IP address, selecting a network card interface from a plurality of network interfaces as the first sending interface for the destination IP address according to a preset load balancing strategy;

[0008] According to the data message, the source IP address, the source MAC address, the destination IP address, and the first MAC address of the first sending interface are stored in the first customer information table;

[0009] Modify the link layer address field in the option field of the first ns message to the first MAC address of the first sending interface;

[0010] Based on the first sending interface, sending the first ns message with the link layer address field modified;

[0011] receiving a first na message for the first ns message, and acquiring a destination MAC address corresponding to the destination IP address from a link layer address field of the na message;

[0012] The data message is sent based on the source IP address, the source MAC address, the destination IP address, the destination MAC address and the first MAC address of the first sending interface.

[0013] In a second aspect, the present invention provides a load balancing method supporting IPV6, which is applied to a second network end, wherein the second network end includes a plurality of bound network cards, and the network card interfaces of the plurality of network cards serve as slave interfaces of the bound ports, and the method includes:

[0014] When receiving the first ns message, creating a first na message and obtaining the destination IP address from the first ns message;

[0015] If it is determined that a destination MAC address corresponding to the destination IP address exists locally, obtaining a second client information table corresponding to the destination IP address;

[0016] When it is determined according to the second client information table that no second sending interface is allocated for the destination IP address, selecting a network card interface from a plurality of network interfaces as the second sending interface for the destination IP address according to a preset load balancing strategy;

[0017] According to the first ns message, the source IP address, the source MAC address, the destination IP address, the destination MAC address, and the second MAC address of the second sending interface are stored in the second customer information table;

[0018] Modify the link layer address field in the option field of the first na message to the second MAC address of the second sending interface;

[0019] Based on the second sending interface, the first na message with the link layer address field modified is sent out so that the other end can obtain the destination MAC address corresponding to the destination IP address from the link layer address field of the na message, and send the data message based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface.

[0020] In a third aspect, the present invention provides a load balancing device supporting IPV6, which is applied to a first network end, wherein the first network end includes a plurality of bound network cards, and the network card interfaces of the plurality of network cards serve as subordinate interfaces of the bound ports, and the device includes:

[0021] A first creation module, configured to create a first ns message when it is determined that the destination IP address of the data message to be sent does not have a link layer address, and obtain a first customer information table corresponding to the destination IP address;

[0022] A first selection module is used to select a network card interface from multiple network interfaces as the first sending interface of the destination IP address according to a preset load balancing strategy when it is determined according to the first customer information table that no first sending interface is allocated for the destination IP address;

[0023] A first storage module, configured to store a source IP address, a source MAC address, a destination IP address, and a first MAC address of a first sending interface into the first customer information table according to the data message;

[0024] A first modification module, configured to modify the link layer address field in the option field of the first ns message to the first MAC address of the first sending interface;

[0025] A first sending module, configured to send out, based on the first sending interface, a first ns message in which the link layer address field is modified;

[0026] A first receiving module, configured to receive a first na message for the first ns message, and obtain a destination MAC address corresponding to the destination IP address from a link layer address field of the na message;

[0027] The second sending module is used to send the data message based on the source IP address, the source MAC address, the destination IP address, the destination MAC address and the first MAC address of the first sending interface.

[0028] In a fourth aspect, the present invention provides a load balancing device supporting IPV6, which is applied to a second network end, wherein the second network end includes a plurality of bound network cards, and the network card interfaces of the plurality of network cards serve as slave interfaces of the bound ports, and the device includes:

[0029] A second creation module is used to create a first na message when receiving the first ns message, and obtain a destination IP address from the first ns message;

[0030] A first acquisition module, configured to acquire a second customer information table corresponding to the destination IP address when it is determined that a destination MAC address corresponding to the destination IP address exists locally;

[0031] A second selection module is used to select a network card interface from multiple network interfaces as the second sending interface of the destination IP address according to a preset load balancing strategy when it is determined according to the second customer information table that no second sending interface is allocated for the destination IP address;

[0032] A second storage module, used for storing the source IP address, the source MAC address, the destination IP address, the destination MAC address, and the second MAC address of the second sending interface into the second customer information table according to the first ns message;

[0033] A second modification module, used to modify the link layer address field in the option field of the first na message to the second MAC address of the second sending interface;

[0034] The third sending module is used to send out the first na message with the link layer address field modified based on the second sending interface, so that the other end can obtain the destination MAC address corresponding to the destination IP address from the link layer address field of the na message, and send the data message based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface.

[0035] In a fifth aspect, the present invention provides an electronic device comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned load balancing method supporting IPV6 when executing the program.

[0036] In a sixth aspect, the present invention provides a readable storage medium, which, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the above-mentioned load balancing method supporting IPV6.

[0037] In an embodiment of the present invention, the first network end creates a first ns message when it is determined that the destination IP address of the data message to be sent does not have a link layer address, and sends the first ns message based on the first sending interface, then receives the first na message sent by the opposite end for the first ns message, and obtains the destination MAC address corresponding to the destination IP address from the na message; finally, based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface, the data message is sent, and load balancing of the IPV6 message at the receiving end can be achieved by only modifying the destination MAC address at the message sending end, thereby improving the utilization rate of the network bandwidth and avoiding the waste of bandwidth resources; in addition, the technical solution provided by the embodiment of the present invention is applicable to all scenarios where bond interfaces are deployed, does not require changes to the original network architecture and other special configurations, and has a wide range of applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0039] Figure 1 It is a flow chart of the steps of a load balancing method supporting IPV6 provided by an embodiment of the present invention;

[0040] Figure 2 It is a flowchart of a method for constructing a hash table provided by an embodiment of the present invention;

[0041] Figure 3 It is a flowchart of a method for sending an ns message provided by an embodiment of the present invention;

[0042] Figure 4 It is a flowchart of another load balancing method supporting IPV6 provided by an embodiment of the present invention;

[0043] Figure 5 It is a flowchart of a method for sending a NA message provided by an embodiment of the present invention;

[0044] Figure 6 is a flowchart of a deinitialization method provided by an embodiment of the present invention;

[0045] Figure 7 It is an interactive step diagram of a load balancing method supporting IPV6 provided by an embodiment of the present invention;

[0046] Figure 8 It is a logical block diagram of a load balancing device supporting IPV6 provided by an embodiment of the present invention;

[0047] Fig. 9 It is a logic block diagram of another load balancing device supporting IPV6 provided by an embodiment of the present invention;

[0048] Fig.10 It is a logic block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] In order to enable those skilled in the art to better understand the present invention, the concepts involved in the present invention are described below:

[0051] ICMPv6 (Internet Control Managemet Protocol Version 6): ICMPv6 is an Internet Control Message Protocol developed for use with IPv6. Like IPv4 (Internet Protocol Version 4), IPv6 also needs to use ICMP (Internet Control Managemet Protocol). The old version of ICMP cannot meet all the requirements of IPv6, so a new version of ICMP, called ICMPv6, was developed.

[0052] Bond interface: is a collection of multiple network card interfaces; a network card has one network interface. Binding multiple network cards into a bond port can improve the performance of the network and the performance of the network load. Among them, the interface of each network card serves as the slave interface (slave interface) of the bond interface, the bond port serves as the master interface (master interface), and selects a slave interface as the curr_active_slave interface (currently active slave interface). Specifically, the bond interface has 7 modes, mode = 0 (balance-rr, balanced load mode), mode = 1 (active-backup, master-backup mode), mode = 2 (balance-xor, balanced mode), mode = 3 (broadcast, broadcast mode), mode = 4 (802.3ad, dynamic link aggregation), mode = 5 (balance-tlb, transmission load balancing), mode = 6 (balance-alb, adaptive load balancing). The binding port described in the embodiment of the present invention is a bond interface.

[0053] NDP protocol (Neighbor Discovery Protocol): NDP protocol is a key protocol of IPv6. It combines the ARP (Address Resolution Protocol), ICMP router discovery and ICMP redirect protocols in IPv4 and improves them. As a basic protocol of IPv6, NDP also provides functions such as prefix discovery, neighbor unreachability detection, duplicate address monitoring, and address automatic configuration. Specifically, there are five types of ICMPv6 messages in the NDP protocol, namely, rs message, ra message, ns message, na message and redirect message, among which ns message and na message are mainly used for address resolution, ra message and rs message are mainly used for stateless address automatic configuration, and redirect message is used for router redirection. In the embodiment of the present invention, the address resolution function of ns message and na message in the NDP protocol is mainly applied.

[0054] ns message: When a node does not know the link layer address of the target address, it will send an ns message. At this time, the source address of the ns message is the source MAC address (Media Access Control / Medium Access Control) of the sending interface, and the target MAC address is the multicast MAC address of the requested node corresponding to the accessed address. The ns message includes the link layer address of the sender, and the link layer address here generally refers to the MAC address of the Ethernet. In addition, ns can also be used to detect the reachability of neighbors and perform address conflict detection. When a node needs to verify the reachability of a neighbor, it will send a unicast ns message.

[0055] na message: When a node receives an ns message, it will quickly respond to the na message, or when the node needs to quickly spread a new message (unsolicited), it will also send a na message. The na message that is replied to after receiving the ns message is sent in unicast form, the source IP is the IP address of the visited node, and the destination IP is the source IP address in the ns message; if the source IP address in the received ns message is an unspecified address, the destination IP address of the na message is the multicast address of all nodes, which is similar to the ARP response. For unsolicited na messages, the destination IP address is the multicast IP address of all nodes.

[0056] Figure 1 : is a flow chart of the steps of a load balancing method supporting IPV6 provided by an embodiment of the present invention, which is applied to a first network end, such as Figure 1 As shown, the method may include:

[0057] Step 101: When it is determined that the destination IP address of the data message to be sent does not have a link layer address, create a first ns message and obtain a first client information table corresponding to the destination IP address.

[0058] In an embodiment of the present invention, the first network end includes a plurality of bound network cards, and the network card interfaces of the plurality of network cards serve as slave interfaces of the bound port; wherein the bound port serves as a master interface, and the plurality of network card interfaces serve as slave interfaces of the bound port. Specifically, the bound port may be a bond interface, and a load balancing method supporting IPV6 described in an embodiment of the present invention is performed in an adaptive load balancing (balance-alb) mode based on the bond interface.

[0059] In an embodiment of the present invention, the first customer information table is a table preset in the first network terminal for storing message information, and the message information may include the destination IP address of the data message to be sent, the source IP address of the first network terminal, the source MAC address and other information. The specific information stored in the first customer information table can be stored according to actual needs, and the embodiment of the present invention does not limit this.

[0060] In an embodiment of the present invention, the first ns message is an ns message created by the first network end based on the NDP protocol and the destination IP address of the data message to be sent, and is used to obtain the destination MAC address corresponding to the destination IP address of the data message to be sent from the neighboring network end, and the destination MAC address is stored in the link layer address (lladdr).

[0061] Optionally, step 110 may include the following sub-steps:

[0062] Sub-step 111: Obtain the hash value of the destination IP address.

[0063] Sub-step 112: based on the hash value, searching the first customer information table in a preset hash table.

[0064] In an embodiment of the present invention, when the first network terminal determines that the destination IP address of the data packet to be sent does not have a link layer address, it first obtains the destination IP address of the data packet to be sent, and then calculates a hash value corresponding to the destination IP address through a hash function based on the destination IP address of the data packet to be sent.

[0065] It should be noted that the preset hash table may include several different first customer information tables and hash values ​​of different destination IP addresses corresponding to the several first customer information tables; wherein the hash values ​​of the first customer information tables and the destination IP addresses are in a one-to-one correspondence, and based on the hash value, the first customer information table that uniquely corresponds to the hash value can be found in the preset hash table.

[0066] Optionally, before sub-step 111, the following sub-steps may also be included:

[0067] Sub-step 101: create a binding port through a binding driver, and bind multiple network card interfaces as slave interfaces of the binding port.

[0068] It should be noted that when the binding port establishes a connection with the first network terminal, the first network terminal will install a binding driver corresponding to the binding port, and establish a communication connection between the first network terminal and the multiple network cards connected to the binding port through the binding driver. At the same time, the binding port is configured through the binding driver, and two and / or more than two network card interfaces are bound as subordinate interfaces of the binding port. Multiple network cards can be shielded through the binding driver, and there is only one binding network card for the TCP / IP protocol (Transmission Control Protocol / Internet Protocol) layer. The load balancing of message reception is achieved through the binding port, that is, the destination MAC address of the data message is relocated to the MAC address of different network cards to improve the availability of the overall network bandwidth.

[0069] Sub-step 102: applying for an array of a preset size in the memory to construct a hash table; in the hash table: the key is the hash value of the IP address, and the value corresponding to the key stores the first customer information table.

[0070] In an embodiment of the present invention, a data group of a preset size may be applied in advance at the first network end to construct a hash table, wherein the preset size refers to the memory size occupied by the hash table constructed by the data group, which may be specifically 28KB (Kilobyte, information measurement unit: kilobyte). The hash table includes a key and a value, wherein the key is a hash value of the destination IP address of the data message to be sent, and the value corresponds to the key one-to-one, and a first customer information table is stored, and different keys correspond to different values, corresponding to different first customer information tables.

[0071] It should be noted that the hash table of the preset size may specifically be 28 KB, and the hash table may specifically include 256 values, and the 256 values ​​respectively correspond to 256 first customer information tables.

[0072] For example, Figure 2 is a flowchart of a method for constructing a hash table provided by an embodiment of the present invention, which is applied to a first network end, such as Figure 2 As shown, the method includes:

[0073] Step S201, enter the initialization process.

[0074] It should be noted that the initialization process may be a process in which the first network end is initialized before executing the steps of the load balancing method supporting IPV6 described in the embodiment of the present invention.

[0075] Step S202, apply for an array rx6_hashtbl of a size of 256 struct rlb_client_info.

[0076] In the embodiment of the present invention, the struct rlb_client_info corresponds to the aforementioned first client information table, and the rx6_hashtbl corresponds to the aforementioned hash table, that is, a hash table including 256 first client information tables is applied for in the memory of the first network terminal, and the preset size of the hash table can be 28KB. Of course, the specific value of the preset size can be determined according to the size of the first client information table, and is not limited to the aforementioned 28KB size.

[0077] Optionally, after sub-step 112, the method may further include: when it is determined that a hash conflict occurs, clearing the first customer information table corresponding to the key.

[0078] It should be noted that the hash collision is that the same hash value is calculated by a hash function according to different destination IP addresses, and the first customer information table is searched in a preset hash table based on the same hash value, and the same first customer information table will be found. At this time, the operation performed after the first customer information table was found the last time will be cleared and overwritten by the operation performed after the first customer information table is found this time.

[0079] Step 120: When it is determined according to the first customer information table that no first sending interface is allocated for the destination IP address, select a network card interface from multiple network interfaces as the first sending interface for the destination IP address according to a preset load balancing strategy.

[0080] It should be noted that after the first sending interface is assigned to a certain destination IP address, the first information table will store the first sending interface information. After obtaining the first customer information table corresponding to the destination IP address, the assigned first sending interface information can be obtained from the first customer information table. When the first sending interface is not assigned to a certain destination IP address, the information about the first sending interface in the first customer information table is empty. After obtaining the first customer information table corresponding to the destination IP address, the information about the first sending interface cannot be obtained from the first customer information table. At this time, it is necessary to execute the step of selecting a network card interface from multiple network interfaces as the first sending interface of the destination IP address according to the preset load balancing strategy.

[0081] It should be noted that the first sending interface information may include the name of the first sending interface and / or the MAC address of the first sending interface.

[0082] Optionally, step 120 may include: selecting a network card interface with the largest bandwidth as the first sending interface; or, selecting a network card interface from multiple network card interfaces in sequential polling as the first sending interface; or, selecting the network card interface with the lowest load as the first sending interface.

[0083] In the embodiment of the present invention, the preset load balancing strategy may include performing load balancing according to the bandwidth of the network card interface, or performing load balancing according to the arrangement order of multiple network card interfaces, or performing load balancing according to the load condition of the current network card interface.

[0084] Step 130: According to the data message, the source IP address, the source MAC address, the destination IP address, and the first MAC address of the first sending interface are stored in the first customer information table.

[0085] It should be noted that the source IP address and the source MAC address are the local IP address and the local MAC address of the first network end; the destination IP address is the destination IP address of the data message to be sent.

[0086] In an embodiment of the present invention, when determining the first sending interface assigned to the destination IP address, it is necessary to store the source IP address, source MAC address, destination IP address, and the first MAC address of the first sending interface in the first customer information table so as to facilitate subsequent retrieval and use during the sending of the first ns message and subsequent maintenance.

[0087] It should be noted that the post-maintenance refers to the maintenance operation performed when the subordinate interface of the bound port changes and / or the MAC address of the subordinate interface changes; specifically, when the above situation occurs, it is necessary to send a NA message to the other end to notify the other end of the specific changes. When the other end receives the NA message, it updates the change information based on the information in the NA message.

[0088] Exemplarily, when the current curr_active_slave interface in the binding port of device A exits, device A promptly selects a slave interface from other slave interfaces as the curr_active_slave interface and sends a na message to the peer device B, wherein the na message includes change information about the curr_active_slave interface, and the change information includes MAC address change information of the curr_active_slave interface. After receiving the na message, the peer device B updates the destination MAC address in the first customer information table corresponding to the MAC address.

[0089] Optionally, after step 130, the following steps may also be included:

[0090] When the multiple network cards are updated, the receiving end sends a second NA message based on the second customer information table, and updates the MAC address corresponding to the destination IP address in the first customer information table based on the second NA message; wherein the update includes deleting at least one network card from the multiple network cards, or adding a new network card bound to the binding port.

[0091] In the embodiment of the present invention, the update may also include a situation where the MAC address of one or more slave interfaces of the bound port changes.

[0092] Step 140: Modify the link layer address field in the option field of the first ns message to the first MAC address of the first sending interface.

[0093] In an embodiment of the present invention, when it is determined that a first sending interface is allocated for the target IP address, the link layer address field in the option field of the first ns message created in step 110 needs to be modified to the first MAC address of the first sending interface. The purpose is to facilitate the opposite device (second network end) receiving the first ns message to send the first na message for the first ns message to the first network end through the first interface port based on the first MAC address.

[0094] Specifically, the option field may be an option field of the first ns message based on the ICMPv6 protocol, the Option field includes a link layer address field, and the link layer address field may include the first MAC address information of the first sending interface.

[0095] Step 150: Based on the first sending interface, send out the first ns message with the link layer address field modified.

[0096] In the embodiment of the present invention, the first network terminal sends a first NS message to a neighboring network terminal, and after the second network terminal in the neighboring network terminal receives the first NS message, it replies to the first network terminal with a first NA message for the first NS message.

[0097] Step 160: Receive a first na message for the first ns message, and obtain a destination MAC address corresponding to the destination IP address from a link layer address field of the na message.

[0098] In an embodiment of the present invention, the first network end receives, through a first sending interface, a first NA message for a first NS message replied by the second network end, and the link layer address field of the first NA message includes a destination MAC address corresponding to the destination IP address of the data message. After receiving the first NA message for the first NS message, the first network end can obtain the destination MAC address corresponding to the destination IP address from the link layer address field of the first NA message.

[0099] It should be noted that when the second network end sends the first NA message for the first NS message, the source IP address and source MAC address in the first NS message are used as the destination IP address and destination MAC address of the first NA message, and the destination MAC address corresponding to the destination IP address of the data message is stored in the link layer address field of the first NA message, and the first NA message is sent to the first sending interface of the first network end corresponding to the first MAC address, and the first network end receives the first NA message through the first sending interface.

[0100] Step 170: Send the data message based on the source IP address, the source MAC address, the destination IP address, the destination MAC address, and the first MAC address of the first sending interface.

[0101] In an embodiment of the present invention, based on the above steps 110 to 160, the first network end, when determining that the destination IP address of the data message to be sent does not have a link layer address, obtains the destination MAC address corresponding to the destination IP address of the data message to be sent through the first ns message; after obtaining the destination MAC address corresponding to the destination IP address of the data message to be sent, the data message can be sent based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface.

[0102] It should be noted that the destination MAC address is one of the network card interfaces selected by the second network end based on the service conditions of the subordinate port in its own bound port as the receiving interface of the data message, and the MAC address of the receiving interface is the destination MAC address in the link layer address field of the first na message. Therefore, the load balancing method supporting IPV6 proposed by the embodiment of the present invention can realize the load balancing of IPV6 messages at the receiving end by modifying the destination MAC address at the sending end of the data message.

[0103] For example, Figure 3 is a flowchart of a method for sending an ns message provided by an embodiment of the present invention, which is applied to a first network end, such as Figure 3 As shown, the method includes:

[0104] Step S301, enter the process of sending ns message.

[0105] In the embodiment of the present invention, when it is determined that the destination IP address of the data message to be sent does not have a link layer address, the process of sending the ns message may be entered after the first ns message is created.

[0106] Step S302: Obtain hash_index according to the destination IP address.

[0107] It should be noted that the destination IP address is the destination IP address of the data message to be sent, and the hash_index corresponds to the hash value of the above-mentioned destination IP address; specifically, the hash value of the destination IP address is obtained according to the destination IP address.

[0108] Step S303, obtain struct rlb_client_info in rx6_hashtbl according to hash_index.

[0109] Specifically, the first client information table (struct rlb_client_info) is searched in a preset hash table (rx6_hashtbl) based on the hash value (hash_index).

[0110] It should be noted that the hash table may include several different first customer information tables and hash values ​​of different destination IP addresses corresponding to the several first customer information tables; wherein the hash values ​​of the first customer information tables and the destination IP addresses are in a one-to-one correspondence, and based on the hash values, the first customer information table that uniquely corresponds to the hash value can be found in the preset hash table.

[0111] Step S304: Determine whether a sending interface is allocated.

[0112] Specifically, it is determined whether a sending interface is allocated for the destination IP address of the data message to be sent. If it is determined that a sending interface is allocated, step S307 is executed; if it is determined that no sending interface is allocated, step S305 is executed.

[0113] In an embodiment of the present invention, a method for determining whether a sending interface is assigned for a destination IP address of a data packet to be sent can specifically be to search the first customer information table in a preset hash table based on a hash value corresponding to the destination IP address; if sending interface information about the destination IP address is found in the first customer information table corresponding to the destination IP address, it means that a sending interface is assigned; if sending interface information about the destination IP address is not found in the first customer information table corresponding to the destination IP address, it means that no sending interface is assigned.

[0114] Step S305: Select the slave port with the maximum bandwidth as the sending interface.

[0115] In the case where no sending interface is allocated, the slave port with the largest bandwidth can be used as the sending interface to send the ns message. It should be noted that the slave port is a subordinate port of the first network end binding port.

[0116] Step S306: fill the source IP address, destination IP address, source MAC address, sending interface, etc. into struct rlb_client_info.

[0117] In the embodiment of the present invention, the source IP address, the source MAC address, the destination IP address, and the first MAC address of the first sending interface may be stored in the first client information table (struct rlb_client_info) according to the data message.

[0118] Step S307: Update the lladdr in the ICMPv6 Option of the ns message to the MAC address of the sending interface.

[0119] In the embodiment of the present invention, the link layer address field in the option field of the first ns message may be modified to the first MAC address of the first sending interface.

[0120] It should be noted that the ICMPv6 Option may be an option field of the first ns message based on the ICMPv6 protocol, and the Option field includes a link layer address field (lladdr), and the link layer address field may include the first MAC address information of the first sending interface.

[0121] Step S308: Send the message from the selected sending interface.

[0122] Specifically, the ns message with the lladdr in the ICMPv6 Option updated is sent out from the selected sending interface.

[0123] Step S309, end.

[0124] Figure 4 It is a flow chart of the steps of another load balancing method supporting IPV6 provided by an embodiment of the present invention, which is applied to the second network end, such as Figure 4 As shown, the method may include:

[0125] Step 210: When a first NS message is received, a first NA message is created, and a destination IP address is obtained from the first NS message.

[0126] In an embodiment of the present invention, the second network end includes a plurality of bound network cards, and the network card interfaces of the plurality of network cards serve as slave interfaces of the bound port; wherein the bound port serves as a master interface, and the plurality of network card interfaces serve as slave interfaces of the bound port. Specifically, the bound port may be a bond interface, and a load balancing method supporting IPV6 described in an embodiment of the present invention is performed in an adaptive load balancing (balance-alb) mode based on the bond interface.

[0127] It should be noted that the second network end and the first network end may be the same device or different devices, and the second network end and the first network end are neighboring network ends.

[0128] In an embodiment of the present invention, the first na message is a na message created by the second network end based on the NDP protocol and the first ns message sent by the first network end, and is used to reply to the first ns message in unicast form; wherein the source IP address and source MAC address in the first na message are the local IP address and local MAC address of the second network end, and the destination IP address and destination MAC address in the first na message are the source IP address and source MAC address in the first ns message, that is, the local IP address and local MAC address of the first network node.

[0129] It should be noted that the destination IP address obtained from the first ns message is the destination IP address of the message to be sent in the first network end.

[0130] Step 220: When it is determined that a destination MAC address corresponding to the destination IP address exists locally, obtain a second customer information table corresponding to the destination IP address.

[0131] In an embodiment of the present invention, the second customer information table is a table preset in the second network end for storing message information, and the message information may be information such as the source IP address and source MAC address of the second network end. The specific information stored in the second customer information table may be stored according to actual needs, and the embodiment of the present invention does not limit this.

[0132] It should be noted that the second customer information table may be an information table with the same function as the first customer information table, and the specific information filled in the customer information table may be filled in according to the working requirements of different network terminals.

[0133] In an embodiment of the present invention, after obtaining the destination IP address from the first ns message, a search is performed on the local network end to determine whether there is a destination MAC address corresponding to the destination IP address. If it is determined that the destination MAC address corresponding to the destination IP address exists locally, a second customer information table corresponding to the destination IP address is obtained; if it is determined that the destination MAC address corresponding to the destination IP address does not exist locally, the first ns message is ignored, and there is no need to reply to the first ns message.

[0134] Optionally, step 220 may include the following sub-steps:

[0135] Sub-step 221: Obtain the hash value of the destination IP address.

[0136] Sub-step 222: Based on the hash value, search the second customer information table in a preset hash table.

[0137] In the embodiment of the present invention, when the second network end determines that the destination MAC address corresponding to the destination IP address exists locally, the second network end calculates the hash value corresponding to the destination IP address through a hash function according to the destination IP address in the first ns message.

[0138] It should be noted that the preset hash table may include several different second customer information tables and hash values ​​of different destination IP addresses corresponding to the several second customer information tables; wherein the hash values ​​of the second customer information table and the destination IP address are in a one-to-one correspondence, and based on the hash value, the second customer information table that uniquely corresponds to the hash value can be found in the preset hash table.

[0139] Optionally, the following sub-steps may be included before sub-step 221:

[0140] Sub-step 201: Create a binding port through a binding driver, and bind multiple network card interfaces to the binding port.

[0141] It should be noted that when the binding port establishes a connection with the second network end, the second network end will install the binding driver corresponding to the binding port, and establish a communication connection between the second network end and the multiple network cards connected to the binding port through the binding driver. At the same time, the binding port is configured through the binding driver, and two and / or more than two network card interfaces are bound as subordinate interfaces of the binding port. Multiple network cards can be shielded through the binding driver, and there is only one binding network card for the TCP / IP protocol layer. The load balancing of message reception is achieved through the binding port, that is, the destination MAC address of the data message is relocated to the MAC address of the different network cards of the second network end, so as to improve the availability of the overall network bandwidth.

[0142] Sub-step 202: applying for an array of a preset size in the memory to construct a hash table; in the hash table: the key is the hash value of the IP address, and the value corresponding to the key stores the second customer information table.

[0143] In an embodiment of the present invention, a data group of a preset size may be applied in advance at the second network end to construct a hash table, wherein the preset size refers to the memory size occupied by the hash table constructed by the data group, which may be specifically 28KB (Kilobyte, information measurement unit: kilobyte). The hash table includes a key and a value, wherein the key is the hash value of the destination IP address in the first ns message, and the value corresponds to the key one-to-one, and a second customer information table is stored, and different keys correspond to different values, corresponding to different second customer information tables.

[0144] It should be noted that the hash table of the preset size may specifically be 28 KB, and the hash table may specifically include 256 values, and the 256 values ​​respectively correspond to 256 second customer information tables.

[0145] Optionally, after sub-step 222, the following may be included: when it is determined that a hash conflict occurs, clearing the second customer information table corresponding to the key.

[0146] It should be noted that the hash collision is that the same hash value is calculated by a hash function according to different destination IP addresses, and the second customer information table is searched in a preset hash table based on the same hash value, and the same second customer information table will be found. At this time, the operation performed after the second customer information table was found the previous time will be cleared and overwritten by the operation performed after the second customer information table is found this time.

[0147] Step 230: When it is determined according to the second customer information table that no first sending interface is allocated for the destination IP address, select a network card interface from multiple network interfaces as a second sending interface for the destination IP address according to a preset load balancing strategy.

[0148] In an embodiment of the present invention, after a second sending interface is assigned to a certain destination IP address, the second information table will store the second sending interface information. After obtaining the second customer information table corresponding to the destination IP address, the assigned second sending interface information can be obtained from the second customer information table. When a second sending interface is not assigned to a certain destination IP address, the second sending interface information in the second customer information table is empty. After obtaining the second customer information table corresponding to the destination IP address, the information about the second sending interface cannot be obtained from the second customer information table. At this time, it is necessary to execute the step of selecting a network card interface from multiple network interfaces as the second sending interface for the destination IP address according to a preset load balancing strategy.

[0149] It should be noted that the second sending interface information may include the name of the second sending interface and / or the MAC address of the second sending interface. The second sending interface selected by the second network end for the first na message will be used as the receiving interface for the subsequent first network end to send data messages with the destination IP. Therefore, when the second network end allocates the second sending interface for the destination IP address, it needs to allocate it according to the preset load balancing strategy to achieve the effect of load balancing when receiving the data message sent by the first network end.

[0150] Optionally, step 203 may include: selecting a network card interface with the largest bandwidth as the second sending interface; or, selecting a network interface from multiple network card interfaces in sequential polling as the second sending interface; or, selecting the network card interface with the lowest load as the second sending interface.

[0151] In the embodiment of the present invention, the preset load balancing strategy may include performing load balancing according to the bandwidth of the network card interface, or performing load balancing according to the arrangement order of multiple network card interfaces, or performing load balancing according to the load condition of the current network card interface.

[0152] Step 240: According to the first ns message, the source IP address, the source MAC address, the destination IP address, the destination MAC address, and the second MAC address of the second sending interface are stored in the second customer information table.

[0153] It should be noted that the source IP address and the source MAC address are the local IP address and the local MAC address of the second network end; the destination IP address and the destination MAC address are the source IP address and the source MAC address of the first ns message.

[0154] In an embodiment of the present invention, when determining the second sending interface assigned to the destination IP address, it is necessary to store the source IP address, source MAC address, destination IP address, and the second MAC address of the second sending interface in the second customer information table for subsequent sending of the first na message and for search and use during subsequent maintenance.

[0155] It should be noted that the post-maintenance refers to the maintenance operation performed when the subordinate interface of the bound port changes and / or the MAC address of the subordinate interface changes; specifically, when the above situation occurs, it is necessary to actively send a NA message to the other end to notify the other end of the specific changes. When the other end receives the NA message, it updates the change information based on the information in the NA message.

[0156] Step 250: Modify the link layer address field in the option field of the first na message to the second MAC address of the second sending interface.

[0157] In an embodiment of the present invention, when it is determined that a first sending interface is allocated for the target IP address, it is necessary to modify the link layer address field in the option field of the first ns message created in step 210 to the second MAC address of the second sending interface. The purpose is to facilitate the first network end to use the second MAC address as the destination MAC address of the data message based on the second MAC address in the na message after receiving the first na message for the first ns message and send the data message to the second sending interface of the second network end.

[0158] Specifically, the option field can be the option field of the first na message based on the ICMPv6 protocol, and the Option field includes a link layer address field, and the link layer address field can include the second MAC address information of the second sending interface, that is, the MAC address information of the receiving port of the receiving end.

[0159] Step 260: Based on the second sending interface, the first na message with the link layer address field modified is sent out, so that the other end can obtain the destination MAC address corresponding to the destination IP address from the link layer address field of the na message, and send the data message based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface.

[0160] In an embodiment of the present invention, the second network end sends a first na message for the first ns message to the first sending interface of the first network end. After receiving the first na message for the first ns message, the first network end can obtain the destination MAC address corresponding to the destination IP address from the link layer address field of the first na message, and send the data message to the second sending interface of the second network end based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface.

[0161] It should be noted that the destination MAC address corresponding to the destination IP address obtained by the first network end from the link layer address field of the first na message is one of the network card interfaces selected by the second network end as the receiving interface of the data message based on the service conditions of the subordinate port in its own bound port, and the MAC address of the receiving interface is the destination MAC address in the link layer address field of the first na message. Therefore, the load balancing method supporting IPV6 proposed by the embodiment of the present invention can realize the load balancing of IPV6 messages at the receiving end by modifying the destination MAC address at the sending end of the data message.

[0162] For example, Figure 5 is a flowchart of a method for sending a na message provided by an embodiment of the present invention, which is applied to a second network end, such as Figure 5 As shown, the method includes:

[0163] Step S401, enter the na message sending process.

[0164] In the embodiment of the present invention, when the first NS message is received, the first NA message may be created and then the NA message sending process may be entered.

[0165] Step S402: Calculate hash_index according to the destination IP address.

[0166] It should be noted that the destination IP address is the destination IP address of the first ns message, and the hash_index corresponds to the hash value of the above-mentioned destination IP address; specifically, the hash value of the destination IP address is obtained according to the destination IP address.

[0167] Step S403, obtain struct rlb_client_info in rx6_hashtbl according to hash_index.

[0168] Specifically, based on the hash value (hash_index), the second client information table (struct rlb_client_info) is searched in a preset hash table (rx6_hashtbl).

[0169] It should be noted that the hash table may include several different second customer information tables and hash values ​​of different destination IP addresses corresponding to the several second customer information tables; wherein the second customer information table and the hash value of the destination IP address are in a one-to-one correspondence, and based on the hash value, the second customer information table that uniquely corresponds to the hash value can be found in the preset hash table.

[0170] Step S404: Determine whether a sending interface is allocated.

[0171] Specifically, it is determined whether a sending interface is allocated for the destination IP address of the first ns message. If it is determined that a sending interface is allocated, step S407 is executed; if it is determined that no sending interface is allocated, step S405 is executed.

[0172] In an embodiment of the present invention, a method for determining whether a sending interface is assigned to the destination IP address of the first ns message can specifically be to search the second customer information table in a preset hash table based on a hash value corresponding to the destination IP address; if the sending interface information about the destination IP address is found in the second customer information table corresponding to the destination IP address, it means that a sending interface is assigned; if the sending interface information about the destination IP address is not found in the second customer information table corresponding to the destination IP address, it means that no sending interface is assigned.

[0173] Step S405: Select the slave port with the maximum bandwidth as the sending interface.

[0174] In the case where no sending interface is allocated, the slave port with the largest bandwidth can be used as the sending interface to send the na message. It should be noted that the slave port is a subordinate port of the second network end binding port.

[0175] Step S406: fill the source IP address, destination IP address, source MAC address, destination MAC address, sending interface, etc. into struct rlb_client_info.

[0176] In the embodiment of the present invention, the source IP address, source MAC address, destination IP address, and the second MAC address of the second sending interface can be stored in the second client information table (struct rlb_client_info) according to the ns message received by the second network end.

[0177] Step S407: Update the lladdr in the ICMPv6 Option of the na message to the MAC address of the sending interface.

[0178] In the embodiment of the present invention, the link layer address field in the option field of the first na message may be modified to the second MAC address of the second sending interface.

[0179] It should be noted that the ICMPv6 Option can be an option field of the na message based on the ICMPv6 protocol, and the Option field includes a link layer address field (lladdr), and the link layer address field can include the second MAC address information of the second sending interface, that is, the MAC address information of the receiving port of the receiving end.

[0180] Step S408: Send the message from the selected sending interface.

[0181] Specifically, the na message with the lladdr in the ICMPv6 Option updated is sent out from the selected sending interface.

[0182] Step S409, end.

[0183] Optionally, at the first network end, after step 170, a hash table constructed by applying for an array of a preset size in the memory may be deinitialized, that is, the memory of the first customer information table pointed to by the hash table is released.

[0184] For example, Figure 6 is a flowchart of a deinitialization method provided by an embodiment of the present invention, which is applied to a first network terminal, such as Figure 6 As shown, the method includes:

[0185] Step S501, enter the deinitialization process.

[0186] In the embodiment of the present invention, the deinitialization process may be entered after the first network end completes step 170 .

[0187] Step S502: Release the memory pointed to by rx6_hashtbl.

[0188] Specifically, it may be the memory of 256 struct rlb_client_info pointed to by rx6_hashtbl.

[0189] Step S503, end.

[0190] To summarize, in an embodiment of the present invention, the first network end creates a first ns message when it is determined that the destination IP address of the data message to be sent does not have a link layer address, and sends the first ns message based on the first sending interface, then receives the first na message sent by the opposite end for the first ns message, and obtains the destination MAC address corresponding to the destination IP address from the na message; finally, based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface, the data message is sent, and load balancing of the IPV6 message at the receiving end only needs to be modified at the message sending end, thereby improving the utilization rate of the network bandwidth and avoiding the waste of bandwidth resources; in addition, the technical solution provided in the embodiment of the present invention is applicable to all scenarios where bond interfaces are deployed, does not require changes to the original network architecture and other special configurations, and has a wide range of applications.

[0191] Figure 7 1 is an interactive step diagram of a load balancing method supporting IPV6 provided by an embodiment of the present invention, the method comprising:

[0192] Step S701: Create a first ns message and obtain a first customer information table corresponding to the destination IP address.

[0193] Specifically, when it is determined that the destination IP address of the data message to be sent does not have a link layer address, a first ns message is created, and a first client information table corresponding to the destination IP address is obtained.

[0194] Step S702: Determine whether a first sending interface is allocated for the destination IP address.

[0195] In an embodiment of the present invention, if it is determined according to the first customer information table that the first sending interface is not allocated for the destination IP address, step S703 is executed; if it is determined according to the first customer information table that the first sending interface is allocated for the destination IP address, step S705 is executed.

[0196] Step S703: Select a network card interface from multiple network interfaces as the first sending interface of the destination IP address according to a preset load balancing strategy.

[0197] Specifically, when it is determined according to the first client information table that no first sending interface is allocated for the destination IP address, a network card interface is selected from a plurality of network interfaces as the first sending interface for the destination IP address according to a preset load balancing strategy.

[0198] In an embodiment of the present invention, selecting a network card interface from multiple network interfaces as the first sending interface for the destination IP address according to a preset load balancing strategy may include: selecting the network card interface with the largest bandwidth as the first sending interface; or, selecting a network card interface from multiple network interfaces as the first sending interface in sequential polling; or, selecting the network card interface with the lowest load as the first sending interface.

[0199] Step S704: Store the first MAC address of the first sending interface into the first customer information table.

[0200] Specifically, according to the data message, the source IP address, the source MAC address, the destination IP address, and the first MAC address of the first sending interface may be stored in the first client information table.

[0201] Step S705: Modify the link layer address in the option field of the first ns message.

[0202] In the embodiment of the present invention, the modifying the link layer address in the option field of the first ns message may specifically include modifying the link layer address field in the option field of the first ns message to the first MAC address of the first sending interface.

[0203] Step S706: Based on the first sending interface, send out the first ns message with the link layer address field modified.

[0204] Specifically, the first network end sends the first ns message with the link layer address field modified to the neighbor network end, the second network end, based on the first sending interface.

[0205] Step S707: Create a first na message, and obtain a destination IP address from the first ns message.

[0206] Specifically, after receiving the first ns message sent by the first network end, the second network end creates a first na message and obtains the destination IP address from the first ns message.

[0207] Step S708: Determine whether there is a destination MAC address corresponding to the destination IP address locally.

[0208] It should be noted that after obtaining the destination IP address from the first ns message, a search is performed on the local network end to determine whether there is a destination MAC address corresponding to the destination IP address. If it is determined that the destination MAC address corresponding to the destination IP address exists locally, the second customer information table corresponding to the destination IP address is obtained; if it is determined that the destination MAC address corresponding to the destination IP address does not exist locally, the first ns message is ignored, and there is no need to reply to the first ns message.

[0209] Specifically, if it is determined that the destination MAC address corresponding to the destination IP address exists locally, step S709 is executed; if it is determined that the destination MAC address corresponding to the destination IP address does not exist locally, step S717 is executed.

[0210] Step S709: Obtain a second customer information table corresponding to the destination IP address.

[0211] Specifically, when it is determined that the destination MAC address corresponding to the destination IP address exists locally, a second client information table corresponding to the destination IP address is obtained.

[0212] Step S710: Determine whether a second sending interface is allocated for the destination IP address.

[0213] In the embodiment of the present invention, if it is determined that the second sending interface is not allocated for the destination IP address, step S711 is executed; if it is determined that the second sending interface is not allocated for the destination IP address, step S713 is executed.

[0214] Step S711: Select a network interface from multiple network interfaces as the second sending interface of the destination IP address according to a preset load balancing strategy.

[0215] In an embodiment of the present invention, when it is determined that no second transmission interface is allocated for the destination IP address, a network interface is selected from multiple network interfaces according to a preset load balancing strategy as the second transmission interface for the destination IP address. The selecting of a network card interface from multiple network interfaces according to a preset load balancing strategy as the second transmission interface for the destination IP address may include selecting a network card interface with the largest bandwidth as the second transmission interface; or selecting a network card interface from multiple network interfaces according to sequential polling as the second transmission interface; or selecting the network card interface with the lowest load as the second transmission interface.

[0216] Step S712: Store the second MAC address of the second sending interface into the second customer information table.

[0217] Specifically, after completing the step of selecting a network interface from multiple network interfaces as the second sending interface of the destination IP address according to a preset load balancing strategy, the source IP address, source MAC address, destination IP address, destination MAC address, and the second MAC address of the second sending interface can be stored in the second customer information table according to the first ns message.

[0218] Step S713: Modify the link layer address in the option field of the first na message.

[0219] Specifically, the modifying the link layer address in the option field of the first na message may include modifying the link layer address field in the option field of the first na message to the second MAC address of the second sending interface.

[0220] Step S714: Based on the second sending interface, send the first na message with the link layer address field modified.

[0221] Specifically, the second network end replies to the first network end the first na message with the link layer address field modified based on the second sending interface.

[0222] Step S715: Obtain the destination MAC address corresponding to the destination IP address from the link layer address field of the na message.

[0223] Specifically, after the first network end receives the first na message from the second network end in response to the first ns message, the destination MAC address corresponding to the destination IP address is acquired from the link layer address field of the na message.

[0224] Step S716: Send the data message based on the source IP address, the source MAC address, the destination IP address, the destination MAC address and the first MAC address of the first sending interface.

[0225] Specifically, after the first network end obtains the destination MAC address corresponding to the destination IP address from the link layer address field of the na message, the data message can be sent to the second sending interface of the second network end based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface.

[0226] Step S717, end.

[0227] Figure 8It is a logic block diagram of a load balancing device supporting IPV6 provided by an embodiment of the present invention, which is applied to a first network end. The load balancing device supporting IPV6 800 may include:

[0228] A first creation module 810 is used to create a first ns message and obtain a first client information table corresponding to the destination IP address when it is determined that the destination IP address of the data message to be sent does not have a link layer address;

[0229] A first selection module 820 is used to select a network card interface from multiple network interfaces as the first sending interface of the destination IP address according to a preset load balancing strategy when it is determined according to the first client information table that no first sending interface is allocated for the destination IP address;

[0230] A first storage module 830 is used to store the source IP address, the source MAC address, the destination IP address, and the first MAC address of the first sending interface into the first customer information table according to the data message;

[0231] A first modifying module 840, configured to modify the link layer address field in the option field of the first ns message to the first MAC address of the first sending interface;

[0232] A first sending module 850, configured to send, based on the first sending interface, a first ns message in which the link layer address field is modified;

[0233] A first receiving module 860 is used to receive a first na message for the first ns message, and obtain a destination MAC address corresponding to the destination IP address from a link layer address field of the na message;

[0234] The second sending module 870 is used to send the data message based on the source IP address, the source MAC address, the destination IP address, the destination MAC address and the first MAC address of the first sending interface.

[0235] Optionally, the first creation module 810 may include:

[0236] A first acquisition submodule is used to obtain a hash value of the destination IP address;

[0237] The first search submodule is used to search the first customer information table in a preset hash table based on the hash value.

[0238] Optionally, the first creation module 810 may further include:

[0239] A first binding submodule, used to create a binding port through a binding driver, and bind multiple network card interfaces as slave interfaces of the binding port;

[0240] The first construction submodule is used to apply for an array of a preset size in the memory to construct a hash table; in the hash table: the key is the hash value of the IP address, and the value corresponding to the key stores the first customer information table.

[0241] Optionally, the first creation module 810 may further include:

[0242] The first clearing submodule is used to clear the first customer information table corresponding to the key when it is determined that a hash conflict occurs.

[0243] Optionally, the load balancing device 800 supporting IPV6 may further include:

[0244] An update module is used to receive a second NA message sent by the opposite end based on the second customer information table when the multiple network cards are updated, and to update the MAC address corresponding to the destination IP address in the first customer information table based on the second NA message; wherein the update includes deleting at least one network card from the multiple network cards, or adding a new network card bound to the binding port.

[0245] Optionally, the first selection module 820 may include:

[0246] A first selection submodule, used to select the network card interface with the largest bandwidth as the first sending interface;

[0247] A second selection submodule, used for sequentially polling to select a network card interface from a plurality of network interfaces as a first sending interface;

[0248] The third selection submodule is used to select the network card interface with the lowest load as the first sending interface.

[0249] Fig. 9 It is a logic block diagram of another load balancing device supporting IPV6 provided by an embodiment of the present invention, which is applied to a second network end. The load balancing device supporting IPV6 900 may include:

[0250] A second creation module 910 is used to create a first na message when receiving a first ns message, and obtain a destination IP address from the first ns message;

[0251] A first acquisition module 920 is used to acquire a second client information table corresponding to the destination IP address when it is determined that the destination MAC address corresponding to the destination IP address exists locally;

[0252] A second selection module 930 is used to select a network card interface from multiple network interfaces as the second sending interface of the destination IP address according to a preset load balancing strategy when it is determined according to the second customer information table that no second sending interface is allocated for the destination IP address;

[0253] A second storage module 940 is used to store the source IP address, the source MAC address, the destination IP address, the destination MAC address, and the second MAC address of the second sending interface into the second customer information table according to the first ns message;

[0254] A second modification module 950 is used to modify the link layer address field in the option field of the first na message to the second MAC address of the second sending interface;

[0255] The third sending module 960 is used to send out the first na message with the link layer address field modified based on the second sending interface, so that the other end can obtain the destination MAC address corresponding to the destination IP address from the link layer address field of the na message, and send the data message based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface.

[0256] Optionally, the first acquisition module 920 may include:

[0257] A second acquisition submodule is used to obtain a hash value of the destination IP address;

[0258] The second search submodule is used to search the second customer information table in a preset hash table based on the hash value.

[0259] Optionally, the first acquisition module 920 may further include:

[0260] A second binding submodule, used to create a binding port through a binding driver, and bind multiple network card interfaces as slave interfaces of the binding port;

[0261] The second construction submodule is used to apply for an array of a preset size in the memory to construct a hash table; in the hash table: the key is the hash value of the IP address, and the value corresponding to the key stores the second customer information table.

[0262] Optionally, the second selection module 930 may include:

[0263] A fourth selection submodule, used to select the network card interface with the largest bandwidth as the second sending interface;

[0264] A fifth selection submodule, used for sequentially polling to select a network card interface from a plurality of network interfaces as a second sending interface;

[0265] The sixth selection submodule is used to select the network card interface with the lowest load as the second sending interface.

[0266] Optionally, the first acquisition module 920 may further include:

[0267] The second clearing submodule is used to clear the second customer information table corresponding to the key when it is determined that a hash conflict occurs.

[0268] To summarize, in an embodiment of the present invention, the first network end creates a first ns message when it is determined that the destination IP address of the data message to be sent does not have a link layer address, and sends the first ns message based on the first sending interface, then receives the first na message sent by the opposite end for the first ns message, and obtains the destination MAC address corresponding to the destination IP address from the na message; finally, based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface, the data message is sent, and load balancing of the IPV6 message at the receiving end only needs to be modified at the message sending end, thereby improving the utilization rate of the network bandwidth and avoiding the waste of bandwidth resources; in addition, the technical solution provided in the embodiment of the present invention is applicable to all scenarios where bond interfaces are deployed, does not require changes to the original network architecture and other special configurations, and has a wide range of applications.

[0269] The present invention also provides an electronic device, see Fig.10 , including: a processor 1001, a memory 1002, and a computer program 10021 stored in the memory and executable on the processor, wherein when the processor executes the program, the load balancing method supporting IPV6 of the aforementioned embodiment is implemented.

[0270] The present invention also provides a readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the load balancing method supporting IPV6 of the aforementioned embodiment.

[0271] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0272] It should be noted that the various information and data obtained in the embodiments of the present invention are all obtained with the authorization of the information / data holder.

[0273] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages ​​can be utilized to realize the content of the present invention described herein, and the description of the above specific languages ​​is for disclosing the best mode of the present invention.

[0274] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0275] Similarly, it should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed invention requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.

[0276] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0277] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the sorting device according to the present invention. The present invention may also be implemented as a device or apparatus program for executing part or all of the methods described herein. Such a program for implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0278] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.

[0279] The user information (including but not limited to the user's device information, user personal information, etc.) and related data involved in the present invention are all information authorized by the user or by all parties.

[0280] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0281] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

[0282] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A load balancing method supporting IPV6, characterized in that: Applied to a first network end, the first network end includes a plurality of bound network cards, and the network card interfaces of the plurality of network cards serve as slave interfaces of the bound ports, the method includes: When it is determined that the destination IP address of the data message to be sent does not have a link layer address, create a first ns message and obtain a first client information table corresponding to the destination IP address; When it is determined according to the first client information table that no first sending interface is allocated for the destination IP address, selecting a network card interface from a plurality of network interfaces as the first sending interface for the destination IP address according to a preset load balancing strategy; According to the data message, the source IP address, the source MAC address, the destination IP address, and the first MAC address of the first sending interface are stored in the first customer information table; Modify the link layer address field in the option field of the first ns message to the first MAC address of the first sending interface; Based on the first sending interface, sending the first ns message with the link layer address field modified; receiving a first na message for the first ns message, and acquiring a destination MAC address corresponding to the destination IP address from a link layer address field of the na message; The data message is sent based on the source IP address, the source MAC address, the destination IP address, the destination MAC address and the first MAC address of the first sending interface.

2. The method according to claim 1, characterized in that: The obtaining of a first client information table corresponding to the destination IP address includes: Obtaining a hash value of the destination IP address; Based on the hash value, the first customer information table is searched in a preset hash table.

3. The method according to claim 2, characterized in that Before obtaining the hash value of the destination IP address, the method further includes: Create a binding port through a binding driver, and bind multiple network card interfaces as slave interfaces of the binding port; An array of a preset size is applied for in the memory to construct a hash table; in the hash table: the key is the hash value of the IP address, and the value corresponding to the key stores the first customer information table.

4. The method according to claim 2, characterized in that: After searching the first customer information table in a preset hash table based on the hash value, the method further includes: When it is determined that a hash conflict occurs, the first customer information table corresponding to the key is cleared.

5. The method according to claim 1, characterized in that After storing the source IP address, the source MAC address, the destination IP address, and the first MAC address of the first sending interface into the first customer information table according to the first ns message, the method further includes: The receiving end sends a second NA message based on the second customer information table when the multiple network cards are updated, and updates the MAC address corresponding to the destination IP address in the first customer information table based on the second NA message; wherein the update includes deleting at least one network card from the multiple network cards, or adding a new network card bound to the binding port.

6. The method according to claim 1, characterized in that The selecting a network card interface from a plurality of network interfaces as a first sending interface of the destination IP address according to a preset load balancing strategy includes: Selecting the network card interface with the largest bandwidth as the first sending interface; Or, select a network card interface from multiple network interfaces in order of polling as the first sending interface; Or, the network card interface with the lowest load is used as the first sending interface.

7. A load balancing method supporting IPV6, characterized in that: Applied to a second network end, the second network end includes a plurality of bound network cards, and the network card interfaces of the plurality of network cards serve as slave interfaces of the bound port, the method includes: When receiving the first ns message, creating a first na message and obtaining the destination IP address from the first ns message; If it is determined that a destination MAC address corresponding to the destination IP address exists locally, obtaining a second client information table corresponding to the destination IP address; When it is determined according to the second client information table that no second sending interface is allocated for the destination IP address, selecting a network card interface from a plurality of network interfaces as the second sending interface for the destination IP address according to a preset load balancing strategy; According to the first ns message, the source IP address, the source MAC address, the destination IP address, the destination MAC address, and the second MAC address of the second sending interface are stored in the second customer information table; Modify the link layer address field in the option field of the first na message to the second MAC address of the second sending interface; Based on the second sending interface, the first na message with the link layer address field modified is sent out so that the other end can obtain the destination MAC address corresponding to the destination IP address from the link layer address field of the na message, and send a data message based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface.

8. The method according to claim 7, characterized in that The obtaining of the second client information table corresponding to the destination IP address includes: Obtaining a hash value of the destination IP address; Based on the hash value, the second customer information table is searched in a preset hash table.

9. The method according to claim 8, characterized in that Before obtaining the hash value of the destination IP address, the method further includes: Create a binding port through a binding driver, and bind multiple network card interfaces as slave interfaces of the binding port; An array of a preset size is applied for in the memory to construct a hash table; in the hash table: the key is the hash value of the IP address, and the value corresponding to the key stores the second customer information table.

10. The method according to claim 7, characterized in that The selecting a network card interface from a plurality of network interfaces as the second sending interface of the destination IP address according to a preset load balancing strategy includes: Selecting the network card interface with the largest bandwidth as the second sending interface; Or, select a network card interface from multiple network interfaces in order of polling as the second sending interface; Or, use the network card interface with the lowest load as the second sending interface.

11. The method according to claim 8, characterized in that After searching the second customer information table in a preset hash table based on the hash value, the method further includes: When it is determined that a hash conflict occurs, the second customer information table corresponding to the key is cleared.

12. A load balancing device supporting IPV6, characterized in that: Applied to a first network end, the first network end includes a plurality of bound network cards, and the network card interfaces of the plurality of network cards serve as slave interfaces of the bound ports, the device includes: A first creation module, configured to create a first ns message when it is determined that the destination IP address of the data message to be sent does not have a link layer address, and obtain a first customer information table corresponding to the destination IP address; A first selection module is used to select a network card interface from multiple network interfaces as the first sending interface of the destination IP address according to a preset load balancing strategy when it is determined according to the first customer information table that no first sending interface is allocated for the destination IP address; A first storage module, configured to store a source IP address, a source MAC address, a destination IP address, and a first MAC address of a first sending interface into the first customer information table according to the data message; A first modification module, configured to modify the link layer address field in the option field of the first ns message to the first MAC address of the first sending interface; A first sending module, configured to send out, based on the first sending interface, a first ns message in which the link layer address field is modified; A first receiving module, configured to receive a first na message for the first ns message, and obtain a destination MAC address corresponding to the destination IP address from a link layer address field of the na message; The second sending module is used to send the data message based on the source IP address, the source MAC address, the destination IP address, the destination MAC address and the first MAC address of the first sending interface.

13. A load balancing device supporting IPV6, characterized in that: Applied to a second network end, the second network end includes a plurality of bound network cards, and the network card interfaces of the plurality of network cards serve as slave interfaces of the bound ports, the device includes: A second creation module is used to create a first na message when receiving the first ns message, and obtain a destination IP address from the first ns message; A first acquisition module, configured to acquire a second customer information table corresponding to the destination IP address when it is determined that a destination MAC address corresponding to the destination IP address exists locally; A second selection module is used to select a network card interface from multiple network interfaces as the second sending interface of the destination IP address according to a preset load balancing strategy when it is determined according to the second customer information table that no second sending interface is allocated for the destination IP address; A second storage module, used for storing the source IP address, the source MAC address, the destination IP address, the destination MAC address, and the second MAC address of the second sending interface into the second customer information table according to the first ns message; A second modification module, used to modify the link layer address field in the option field of the first na message to the second MAC address of the second sending interface; The third sending module is used to send out the first na message with the link layer address field modified based on the second sending interface, so that the other end can obtain the destination MAC address corresponding to the destination IP address from the link layer address field of the na message, and send the data message based on the source IP address, source MAC address, destination IP address, destination MAC address and the first MAC address of the first sending interface.

14. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the load balancing method supporting IPv6 as described in any one of claims 1 to 11 is implemented.

15. A readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the load balancing method supporting IPv6 as described in any one of claims 1-11.

Citation Information

Patent Citations

  • Method and device of load balancing

    CN103200117A

  • ND Snooping binding table updating method and device and medium

    CN111131545A

  • Hash-based load balancing for bonded network interfaces

    US20160048402A1