Summary of the invention
In view of this, the invention provides a kind of method and a kind of device of realizing load balancing based on many network ports of realizing load balancing based on many network ports, can make the terminal equipment of not network enabled port trunking realize load balancing.
A kind of method that realizes load balancing based on many network ports provided by the invention, the method is applied to provide in the terminal equipment of flow data, this terminal equipment comprises at least two network ports and an internal port, described at least two network ports same switching equipment outer with terminal equipment is connected, and an internal port is connected with the processor in terminal equipment;
At least two network ports are divided to respectively different VLAN, internal port and are divided to the VLAN under the all-network port simultaneously; And the method comprises:
The flow data request message of a1, the destination that flows automatically that will receive from the arbitrary network port internally port repeat to processor; Wherein, the flow data request message can identify to mean that the flow data of its request needs load balancing by carrying a load balancing, so that processor determines whether to carry out load balancing and carry VLAN mark head in determining to carry out the flow data encapsulated message of load balancing according to this sign;
A2, while carrying VLAN mark head in the flow data encapsulated message, the network port that is subordinated to corresponding VLAN after the VLAN mark head that the flow data encapsulated message is carried divests forwards.
When described step a2 does not further carry described VLAN mark head in the flow data encapsulated message, the flow data encapsulated message is transmitted from corresponding network port forwarding by searching MAC.
The method further comprised before described step a1: a0, the registration request message that port receives are internally transmitted from corresponding network port forwarding by searching MAC; Wherein, in this registration request message, carry for meaning information that the terminal equipment holding load shares, to allow the flow data request message, carrying described load balancing sign.
The method further comprises after described step a0: b0, only have one when available in all network interface ports, port receives internally fault notification message is transmitted from only available network port and forwarded by searching MAC; Wherein, in this fault notification message, carry for meaning the terminal equipment information that holding load is not shared, to forbid the flow data request message, carrying described load balancing sign.
A kind of device of realizing load balancing based on many network ports provided by the invention, this device is carried in the terminal equipment that flow data can be provided, this terminal equipment comprises at least two network ports and an internal port, described at least two network ports same switching equipment outer with terminal equipment is connected, and an internal port is connected with the processor in terminal equipment;
At least two network ports are divided to respectively different VLAN, internal port and are divided to the VLAN under the all-network port simultaneously; And this device comprises:
The request forwarding module, the flow data request message of the destination that flows automatically that will receive from the arbitrary network port internally port repeat to processor; Wherein, the flow data request message can identify to mean that the flow data of its request needs load balancing by carrying a load balancing, so that processor determines whether to carry out load balancing and carry VLAN mark head in determining to carry out the flow data encapsulated message of load balancing according to this sign;
Data forwarding module, while carrying VLAN mark head in the flow data encapsulated message, the network port that is subordinated to corresponding VLAN after the VLAN mark head that the flow data encapsulated message is carried divests forwards.
When described data forwarding module further carries described VLAN mark head in the flow data encapsulated message, the flow data encapsulated message is not transmitted from corresponding network port forwarding by searching MAC.
This device further comprises: the registration forwarding module, the registration request message that port receives is internally transmitted from corresponding network port forwarding by searching MAC; Wherein, in this registration request message, carry for meaning information that the terminal equipment holding load shares, to allow the flow data request message, carrying described load balancing sign.
This device further comprises: the announcement forwarding module, only there is one when available in all network interface ports, and port receives internally fault notification message is transmitted from only available network port and forwarded by searching MAC; Wherein, in this fault notification message, carry for meaning the terminal equipment information that holding load is not shared, to forbid the flow data request message, carrying described load balancing sign.
A kind of method that realizes load balancing based on many network ports provided by the invention, the method provides flow data for terminal equipment to server, described terminal equipment has at least two network ports, described at least two network ports with same for realizing that the server switching equipment mutual with terminal equipment is connected;
At least two network ports are divided to respectively different VLAN; And the method comprises:
A1, reception server are sent to the flow data request message of arbitrary network port by switching equipment; Wherein, the flow data request message can identify to mean that the flow data of its request needs load balancing by carrying a load balancing;
A2, while carrying described load balancing sign in the flow data request message, carry VLAN mark head in the flow data encapsulated message obtained in encapsulation and be sent to the network port that belongs to this VLAN, forward to server by switching equipment from this network port after VLAN mark head is divested again by VLAN corresponding to this VLAN mark head.
When described steps A 2 is not further carried described load balancing sign in the flow data request message, the flow data encapsulated message that encapsulation is obtained is transmitted and is sent to the corresponding network port, forwards to server by switching equipment from this network port by searching MAC.
The method further comprised before described steps A 1: A0, the registration request message of generation is transmitted and is sent to the corresponding network port, forwards to server by switching equipment from this network port by searching MAC; Wherein, in this registration request message, carry for meaning information that the terminal equipment holding load shares, to allow the flow data request message, carrying described load balancing sign.
The method further comprises after described steps A 0: B0, only have one when available in all network interface ports, the fault notification message of generation is transmitted and is sent to only available network port and forwards to server by switching equipment from this network port by searching MAC; Wherein, in this fault notification message, carry for meaning the terminal equipment information that holding load is not shared, to forbid the flow data request message, carrying described load balancing sign.
A kind of system that realizes load balancing based on many network ports provided by the invention, this system comprises server, terminal equipment and the switching equipment for realizing that server and terminal equipment are mutual for flow data is provided to server, and described terminal equipment has at least two network ports, described at least two network ports are connected with same switching equipment;
At least two network ports are divided to respectively different VLAN;
Server, for sending the flow data request message to switching equipment; Wherein, the flow data request message can identify to mean that the flow data of its request needs load balancing by carrying a load balancing;
Switching equipment, for being sent to the flow data request message arbitrary network port of terminal equipment;
Terminal equipment, when carrying described load balancing sign at the flow data request message, carry VLAN mark head in the flow data encapsulated message obtained in encapsulation and be sent to the network port that belongs to this VLAN, forward to server by switching equipment from this network port after VLAN mark head is divested again by VLAN corresponding to this VLAN mark head.
When terminal equipment does not further carry described load balancing sign in the flow data request message, the flow data encapsulated message that encapsulation is obtained is transmitted and is sent to the corresponding network port, forwards to server by switching equipment from this network port by searching MAC.
Terminal equipment was further transmitted the registration request message of generation to be sent to the corresponding network port, to forward to server by switching equipment from this network port by being searched MAC before the receiving stream-oriented data request message; Wherein, in this registration request message, carry for meaning information that the terminal equipment holding load shares, to allow the flow data request message, carrying described load balancing sign.
Terminal equipment further only has one the fault notification message of generation to be transmitted and is sent to only available network port and forwards to server by switching equipment from this network port by searching MAC when available in all network interface ports; Wherein, in this fault notification message, carry for meaning the terminal equipment information that holding load is not shared, to forbid the flow data request message, carrying described load balancing sign.
As seen from the above technical solution, in the present invention, at least two network ports connect outside switching equipment and are divided to different VLAN, thereby can utilize different VLAN to avoid each network port and outside switching equipment to form loop to the isolation of each network port and can avoid the broadcast storm caused by loop, and, can also utilize between corresponding VLAN and arbitrary network port and realize forwarding.Like this, for normal forwarding, still can realize by searching the usual manner that MAC transmits; And, for the forwarding that needs load balancing, can realize by the forwarding by force in corresponding VLAN.Thus, can realize reliable load balancing without correlation properties such as utilizing Smart-link, port trunking.
Embodiment
For making purpose of the present invention, technical scheme and advantage clearer, referring to the accompanying drawing embodiment that develops simultaneously, the present invention is described in more detail.
Fig. 1 a to Fig. 1 e is the principle schematic diagram in the embodiment of the present invention.In Fig. 1 a to Fig. 1 e: can provide such as EC etc. in the terminal equipment of flow data and be provided with an exchange chip.This exchange chip provides at least two network port P1~Pn (n is greater than 1 positive integer) and an internal port P0 for terminal equipment.
At least two network port P1~Pn belong to respectively different VLAN1~VLANn and are connected with the corresponding ports SP1~SPn on terminal equipment same switching equipment outward, that is, each network port Pi belong to corresponding VLANi (i be more than or equal to 1 and be less than or equal to the positive integer of n) and be connected with the corresponding ports SPi on switching equipment.Like this, due to isolation mutually between the network port P1 that belongs to different VLAN~Pn network port, therefore, even if the arbitrary port SPi on switching equipment has sent broadcasting packet to corresponding network port Pi, the broadcasting packet that corresponding network port Pi receives can not forward to switching equipment from other network ports more yet, thereby avoids the broadcast storm that forms loop and caused by loop with network port P1~Pn and switching equipment.
An internal port P0 belongs to the VLAN1~VLANn under all-network port P1~Pn simultaneously and is connected with the processor in terminal equipment.Like this, can carry out ARP study by internal port P0 by processor and guarantee that internal port P0 can utilize realization between corresponding VLANi and arbitrary network port Pi to forward.
After terminal equipment powers on, ask successively referring to Fig. 1 a and Fig. 1 b:
1) in processor not yet study to the ARP list item of any three layers, therefore, to the internal port P0 of exchange chip, send and take the ARP request message that the terminal equipment MAC Address is source address; Wherein, because exchange chip is now also not yet learnt the MAC forwarding-table item of any two layers, therefore, the source address of ARP request message is that terminal equipment MAC Address, destination address are broadcast address;
2) exchange chip internally port P0 receive ARP request message that processor sends and in the source address of internal port P0 study ARP request message, that is, according to index and the terminal equipment MAC Address of internal port P0, set up down direction MAC forwarding-table item (" down direction " as herein described refers to the direction from the switching equipment side to terminal equipment side).And exchange chip, according to the broadcast address of the destination address as the ARP request message, forwards the ARP request message successively from each network port P0~Pn.
3) because the ARP request message is to forward from each network port P0~Pn successively, thus the time that the corresponding ports of switching equipment SP1~SPn receives the ARP request message have certain interval.So, if the corresponding ports SP1~SPn of switching equipment does not carry out polymerization, finally in the end a port SPi learning that receives the ARP request message to the terminal equipment MAC Address; If the corresponding ports SP1~SPn of switching equipment is aggregated, can be at the logic port learning of polymerization to the terminal equipment MAC Address.
4) switching equipment continues broadcast by the ARP request message, makes the ARP request message finally can arrive the stream destination.Wherein, for terminal equipment and for example VM (Video Management, video management) server etc., need to obtain the situation of server in same IP network section of flow data, the stream destination can be exactly this server; And for terminal equipment the situation disconnected in different IP networks from server, the stream destination can be gateway.
5) the switching equipment arp response message of destination that receives to flow automatically, the source address of this arp response message is the terminal equipment MAC Address for stream destination MAC Address, destination address.If the corresponding ports SP1~SPn of switching equipment does not carry out polymerization, switching equipment utilizes its final study to the corresponding ports SPi of terminal equipment MAC Address, the arp response message to be forwarded to terminal equipment; If the corresponding ports SP1~SPn of switching equipment is aggregated, the predetermined optional corresponding ports SPi of algorithm of switching equipment utilization forwards the arp response message to terminal equipment.
6) exchange chip receives the arp response message and in the source address of the network port Pi study arp response message that receives the arp response message from the arbitrary network port Pi corresponding to corresponding ports SPi, that is, according to index and the stream destination MAC Address of the network port Pi that receives the arp response message, set up up direction MAC forwarding-table item (" up direction " as herein described refers to the direction from terminal equipment side to the switching equipment side).And, because the destination address of arp response message is the terminal equipment MAC Address, therefore, utilize the down direction MAC forwarding-table item corresponding with internal port P0 set up can by the arp response message internally port P0 be forwarded to processor.
7) processor utilizes the arp response message to carry out the ARP study of three layers, set up the ARP list item.
Through above-mentioned process as shown in Fig. 1 a and Fig. 1 b, realized in the exchange chip in the study of MAC forwarding-table item of two layers and processor the study of the ARP list item of three layers.
Based on the exchange chip learning to the MAC forwarding-table item of two layers and the ARP list item of three layers that arrives of processor learning, exchange chip can utilize study to realize normal flow data forwarding to the network port Pi of stream destination MAC Address; And, the ARP list item of three layers that each VLAN based on dividing in exchange chip and processor learning arrive, exchange chip can also utilize not study to realize that to other network ports Pj of stream destination MAC Address the flow data of load balancing forwards.
In order to make to need the server that obtains flow data can know that terminal equipment has the ability of load balancing the load balancing of triggering terminal equipment, also need to realize that by optimizing existing login mechanism terminal equipment reports its ability with load balancing, please again referring to Fig. 1 c:
8) processor sends to flow the registration request message that the destination MAC Address is destination address, in this registration request message, carries for meaning information that the terminal equipment holding load shares, carrying for meaning to need the load balancing sign of load balancing at the flow data request message to allow server.
9), exchange chip is after section's port P0 receives the registration request message within it, can utilize its destination address, flow the destination MAC Address and find the up direction MAC forwarding-table item corresponding with network port Pi, and according to the up direction MAC forwarding-table item found, the registration request message be forwarded from corresponding network port Pi.
10), due to server, can know terminal equipment and there is the ability of load balancing, therefore, server both can send conventional flow data request message so that terminal equipment is realized normal the forwarding, also can send carry the load balancing sign the flow data request message so that terminal equipment is realized the forwarding of load balancing.
According to the requirement of server, terminal equipment can be realized normal the forwarding or the load balancing forwarding, and specific implementation refers to Fig. 1 d and Fig. 1 e:
11) switching equipment receives the flow data request message of the server that needs the acquisition flow data from the stream destination, and the source address of this flow data request message is the terminal equipment MAC Address for stream destination MAC Address, destination address.If the corresponding ports SP1~SPn of switching equipment does not carry out polymerization, for the flow data request message received from the stream destination at every turn, switching equipment all can utilize its final study to forward to terminal equipment to the corresponding ports SPi of terminal equipment MAC Address; If the corresponding ports SP1~SPn of switching equipment is aggregated,, for the flow data request message received from the stream destination at every turn, switching equipment all can utilize a corresponding ports SPi who selectes when forwarding the arp response message before it to forward to terminal equipment usually.
12) exchange chip is from its network port Pi receiving stream-oriented data request message.Wherein, due to the corresponding ports SPi of switching equipment forwarding flow request of data message and the corresponding ports SPi that forwards before arp response message same port normally, therefore, exchange chip receive the network port Pi of flow data request message with receive before the arp response message, and the network port Pi that has learnt stream destination MAC Address can be also same port usually.So, exchange chip utilize the flow data request message destination address, be that the terminal equipment MAC Address is searched MAC and transmitted, then, according to the down direction MAC forwarding-table item corresponding with internal port P0 that find by the flow data request message internally port P0 be forwarded to processor.
13) processor receives after the flow data request message and knows and need to send flow data, and according to whether carrying load balancing in the flow data request identifies to identify and need whether load balancing of the data flow that sends.
For the situation that does not need load balancing, processor only needs in a conventional manner, utilize its study to flow automatically the in the future flow data of data source of ARP forwarding-table item be encapsulated as the flow data encapsulated message, and MAC Address, the destination address that the source address of flow data encapsulated message is terminal equipment is set is stream destination MAC Address.Like this, owing to only there being a network port Pi to learn stream destination MAC Address in exchange chip, so the flow data encapsulated message that processor encapsulates in a conventional manner can carry out conventional forwarding from network port Pi.
For the situation that needs load balancing, processor still need to first encapsulate out according to above-mentioned usual manner the flow data encapsulated message, but also can further in the flow data encapsulated message, carry Tag (mark) head of VLANj so that carry VLANj the Tag head the flow data encapsulated message can from other network ports Pj (j be more than or equal to 1 and the positive integer, the j that are less than or equal to n be not equal to i) forward, with load balancing.
Suppose, server is that VM server, the network equipment are EC, the network port of EC has 2, one of them learns the gateway MAC Address, another does not learn the gateway MAC Address, and the VM server is after receiving the registration request message carried for meaning the information that network equipment holding load is shared:
The VM server is received the request 1 of obtaining live video to EC, if this fashion of EC has no basis, any request provides the flow data encapsulated message, and the VM server sends the flow data request message 1 of the routine of not carrying mark;
The VM server is received the request 2 of obtaining live video to EC, EC now provides the flow data encapsulated message for flow data request message 1, the VM server is thought and need to be carried out load balancing, therefore sends the flow data request message 2 that the expression of carrying mark needs load balancing;
After this, the VM server sends conventional data flow request message, for the request of even number time, sends the flow data request message that means to need load balancing for the request of odd number time, with require EC alternately utilize study to a network port of gateway MAC Address realize normal forward, utilize learn the forwarding that another network port of gateway MAC Address is realized load balancing.
14), after the exchange chip flow data encapsulated message that port P0 receiving processor sends internally, first judge whether this flow data encapsulated message carries the Tag head for the VLANj of load balancing sign;
While not carrying Tag of VLANj in the flow data encapsulated message, exchange chip utilizes the destination address of flow data encapsulated message, flow the destination MAC Address searches MAC and transmits, then, according to the up direction MAC forwarding-table item corresponding with Pi found, the flow data encapsulated message is normally forwarded from corresponding network port Pi;
While carrying Tag of VLANj in the flow data encapsulated message, exchange chip utilizes the destination address of flow data encapsulated message, flows the MAC forwarding-table item that the destination MAC Address can't find any coupling, therefore, the network port Pj that the flow data encapsulated message is subordinated to corresponding VLANj forwards by force, and, also needed to divest the Tag head of the VLANj that the flow data encapsulated message carries before forwarding so that switching equipment without the Tag head of identification VLANj, and the flow data encapsulated message that can forward network port Pj in a conventional manner be processed.
In practical application, in order to make internal port P0, can allow the flow data encapsulated message to carry the Tag head of VLANj, can be set to Trunk (main line) attribute or hybrid (mixing) attribute by internal port P0; And, for the Tag head of VLANj that the flow data encapsulated message is carried can be divested before forwarding, all-network port P1~Pn all can be set to Access (access) attribute.
15) the corresponding ports SPi of switching equipment or SPj are receiving the flow data encapsulated message, can to the stream destination, forward in a conventional manner.
If the corresponding ports SP1~SPn of switching equipment does not carry out polymerization:
In the situation that load balancing, switching equipment can receive the flow data encapsulated message from corresponding port SPj, now, switching equipment will be deleted the terminal equipment MAC Address of learning at port SPi and relearn the terminal equipment MAC Address at corresponding port SPj, that is its final study that refreshes, makes that, switching equipment need to carry out the terminal equipment MAC Address changes to SPj to port of terminal equipment MAC Address by SPi; After this, switching equipment, when the flow data request message received from the stream destination, will utilize port SPj to be forwarded;
Correspondingly, when exchange chip is not at the network port Pj that receives the data flow request message up direction MAC forwarding-table item corresponding networking port Pi set up, need to be flowed refreshing of destination MAC Address equally, make its study change to Pj to the network port of stream destination MAC Address by Pi, , delete the corresponding up direction MAC of network port Pi forwarding-table item, and according to the index that receives the network port Pj of flow data request message, and re-establish new up direction MAC forwarding-table item as the stream destination MAC Address of the source address of flow data request message, so, follow-up normal forwarding realizes by Pj exactly, network port Pi is used in the forwarding of load balancing.
That is to say, in the situation that the corresponding ports SP1~SPn of switching equipment does not carry out polymerization, the flow data that utilizes Pj to carry out load balancing forwards and usually can cause switching equipment and exchange chip generation MAC Address to refresh, but can't affect the realization of load balancing.
If the corresponding ports SP1~SPn of switching equipment is polymerized to a logic port:
In the situation that load balancing can not cause switching equipment to carry out refreshing of terminal equipment MAC Address; But nonetheless, switching equipment is when forwarding the flow data request message received from the stream destination, also still likely use other corresponding ports SPk except corresponding ports SPi selected when forwarding the arp response message (k be more than or equal to 1 and the positive integer, the k that are less than or equal to n be not equal to i), the corresponding ports SPk that even each forwarding flow request of data message is used is difference likely;
Correspondingly, even if switching equipment does not carry out refreshing of terminal equipment MAC Address, but not the up direction MAC forwarding-table item corresponding networking port Pi set up as long as exchange chip receives the network port Pk of data flow request message, also still need to be flowed refreshing of destination MAC Address, make its study change to Pk to the network port of stream destination MAC Address by Pi, , delete the corresponding up direction MAC of network port Pi forwarding-table item, and according to the index that receives the network port Pk of flow data request message, and re-establish new up direction MAC forwarding-table item as the stream destination MAC Address of the source address of flow data request message, so, follow-up normal forwarding realizes by Pk exactly, network port Pi is used in the forwarding of load balancing.
That is to say, in the situation that the corresponding ports SP1~SPn of switching equipment is polymerized to a logic port, MAC Address also likely occurs and refreshes in exchange chip at any time, but can't affect the realization of load balancing.
As above visible, mutually in the all-network port P1~Pn of isolation, there is a network port Pi can learn stream destination MAC Address, thereby utilize the usual manner of searching the MAC forwarding-table item to arrive a network port Pi who flows the destination MAC Address by study and realize normal the forwarding; Although and network port Pj other not study to stream destination MAC Address, can realize load balancing by the forwarding by force in corresponding VLANj.Thereby, due to all-network port P1~Pn all can by search that MAC forwarding-table item or VLAN realize forwarding and all-network port P1~Pn between owing to by VLAN, not isolated broadcast storm can occur, thereby can realize reliable load balancing without correlation properties such as utilizing port trunking, Smart-link.
In addition, network port P1~Pn all likely can be because link failure etc. is former thereby become unavailable (by " Up ", becoming " Down ") by available.
If it is unavailable that study becomes to the network port Pi that flows the destination MAC Address, exchange chip can be not again by network port Pi place link forwarding flow request of data message and delete the corresponding up direction MAC of network port Pi forwarding-table item.Correspondingly, switching equipment can not pass through network port Pi place link forwarding flow request of data message more yet, but need to be from other network port Pk place link forwarding flow request of data message, so, after other network port Pk receives the flow data request message, can learn the stream destination MAC Address as the source address of flow data request message at the network port Pk that receives the flow data request message, , according to the index that receives the network port Pk of flow data request message, and set up new up direction MAC forwarding-table item as the stream destination MAC Address of the source address of flow data request message.That is to say, after study is unavailable to the network port Pi of stream destination MAC Address, can causes switching equipment and exchange chip generation MAC Address to refresh, but can't affect the realization of load balancing.
If study does not become unavailable to other network ports Pj of stream destination MAC Address, because processor can be known by the state-detection to all-network port P1~Pn, thereby processor can guarantee can not recycle this network port Pj and carry out load balancing after other network ports Pj that does not learn stream destination MAC Address is unavailable.Therefore, while disabled network port Pi or Pj occurring in network port P1~Pn, but as long as available sum is at least two, just can not affect normal forwarding and for the forwarding of load balancing.
But in all network interface port P1~Pn only surplus one when available, even if server requirement carries out load balancing, terminal equipment also can't be realized the forwarding of load balancing.Therefore, the present embodiment also provides a kind of fault notification mechanism.
Specifically, processor need to send to flow the fault notification that the destination MAC Address is destination address, carries in this fault notification message for meaning the terminal equipment information that holding load is not shared so that above-mentioned server or client are cancelled at the flow data request message and carries the load balancing sign; Exchange chip, after port P0 receives the fault notification message internally, can forward from an only surplus available network port Pk according to the up direction MAC forwarding-table item found (relearning on an only surplus network port according to foregoing mode).
Still suppose that server is that VM server, terminal equipment are EC, the network port of EC has 2, and one of them learns stream destination MAC Address, another does not learn stream destination MAC Address.After study is unavailable to a network port of stream destination MAC Address, can delete the stream destination MAC Address of learning at this network port, and send the fault notification message by an only surplus available network port to the VM server, can't realize at present the forwarding of load balancing and forbid that the VM server carries the load balancing sign in the flow data request message to inform this EC of VM server.
Basic principle based on above, the present embodiment provides a kind of method that realizes load balancing based on many network ports, and the method is applied to as Fig. 1 a to the exchange chip in the terminal equipment of provided flow data shown in Fig. 1 c.As shown in Figure 2, the method, for flow data request each time, includes the following steps in this exchange chip trip:
Step 231, from arbitrary network port Pi receive to flow automatically flow data request message of destination, this flow data request message can identify to mean that the flow data of its request needs load balancing by carrying a load balancing.Wherein, load balancing that the flow data request message carries sign is exactly that the server that obtains flow data by needs is added, this server can be flow destination, also can be to be used as flowing destination by gateway.
If in this step, the network port Pi of receiving stream-oriented data request message is not and the current corresponding network port of up direction MAC forwarding-table item of having set up, the up direction MAC forwarding-table item that needs further deletion to set up, and set up new up direction MAC forwarding-table item according to index and the stream destination MAC Address of the network port Pi that receives the flow data request message in this step.
In addition, if the corresponding network port of up direction MAC forwarding-table item of having set up is unavailable before this step, before step, can delete the up direction MAC forwarding-table item of having set up, and set up new up direction MAC forwarding-table item according to index and the stream destination MAC Address of the network port Pi that receives the flow data request message in this step.
Step 232, due to the request of data message received take stream destination MAC Address as source address, take the terminal equipment MAC Address as destination address, the flow data request message that therefore, will receive from arbitrary network port Pi is forwarded to processor by the usual manner of searching MAC and transmitting from the corresponding internal port P0 of down direction MAC forwarding-table item.
After this step, the ARP list item that processor arrives according to its study, the flow data of the data source of flowing automatically in the future is encapsulated as the flow data encapsulated message.
And, because the flow data request message received can identify to mean that the flow data of its request needs load balancing by carrying a load balancing, therefore, if further carrying, the flow data request message means the load balancing sign, processor also can carry the Tag head of VLANj in the flow data message, to mean not utilize the corresponding network port Pi of current up direction MAC forwarding-table item, realizes forwarding but utilizing study to carry out the forwarding of load balancing to other network ports Pj that flows the destination MAC Address normally.Wherein, VLANj is the arbitrary VLAN except the described VLANi of network port Pi corresponding to up direction MAC forwarding-table item.
Step 233, port receives to flow the flow data encapsulated message that the destination MAC Address is destination address internally, and judges in the flow data encapsulated message Tag head whether carried for the VLANj of load balancing sign, if, perform step 235, otherwise perform step 234.
Step 234, while not carrying Tag of VLANj in the flow data encapsulated message, adopt the conventional mode that MAC transmits of searching, according to the up direction MAC forwarding-table item found, the flow data encapsulated message is forwarded from corresponding network port Pi, then finish the flow process for this flow data request.
Step 235, while carrying Tag of VLANj in the flow data encapsulated message, the network port Pj that is subordinated to corresponding VLANj after the Tag head of the VLANj that the flow data encapsulated message is carried divests forwards, and then finishes the flow process for this flow data request.Wherein, the network port j that belongs to corresponding VLANj is the arbitrary network port except network port Pi corresponding to up direction MAC forwarding-table item.
So far, the flow process for a flow data request finishes.
Certainly, for the normal forwarding that does not need load balancing, processor also can carry the Tag head of VLANi in the flow data encapsulated message, still can guarantee this flow data message at the Tag head carried by after divesting, from up direction MAC forwarding-table item, corresponding network port Pi forwards.
The up direction MAC forwarding-table item and the down direction MAC forwarding-table item that below use in flow process as shown in Figure 2 can be to set up in flow process as shown in Figure 3.As shown in Figure 3, the method that realizes load balancing based on many network ports in the present embodiment, before carrying out as shown in Figure 2 flow process, also need to be carried out the following steps that can be used for setting up the MAC forwarding-table item at exchange chip:
Step 211, the ARP request message that port P0 receiving processor sends internally.
Step 212, set up down direction MAC forwarding-table item according to the index of internal port P0 and as the terminal equipment MAC Address of the source address of ARP request message.
Step 213, the broadcast address according to the destination address as the ARP request message, be forwarded to switching equipment from each network port P1~Pn successively by the ARP request message.
Step 214, receive the arp response message from switching equipment from arbitrary network port Pi.Wherein, this step receive the network port Pi of step 231 receiving stream-oriented data request message in the network port Pi of arp response message and Fig. 2 may be same, also may not be same.
Step 215, set up up direction MAC forwarding-table item according to the index of the network port Pi that receives the arp response message and as the stream destination MAC Address of the source address of arp response message.
Step 216, the arp response message that is the terminal equipment MAC Address by destination address according to down direction MAC forwarding-table item port P0 internally is forwarded to processor, for processor, utilizes arp response message study ARP list item.
So far, above-mentioned flow process finishes.
Certainly, the up direction MAC forwarding-table item used in flow process as shown in Figure 2 and down direction MAC forwarding-table item, also can set up not according to mode as shown in Figure 3, but other modes that adopt those skilled in the art to realize are set up.
In addition, after setting up up direction MAC forwarding-table item and down direction MAC forwarding-table item, can know that in order to make the server that need to obtain flow data terminal equipment possesses the ability of load balancing, can utilize to the login mechanism of this server and announce this server.Therefore, realize that based on many network ports the method for load balancing can also, according to flow process as shown in Figure 4, be used for utilizing registration to realize the following steps of load balancing capability advertisement in the exchange chip execution in the present embodiment:
Step 221, port P0 receiving processor sends internally take the registration request message that stream destination MAC Address is destination address, in this registration request message, carries for meaning information that the terminal equipment holding load shares, to allow the flow data request message, carrying the load balancing sign.
Step 222, be forwarded to switching equipment by the registration request message from corresponding network port Pi according to the up direction MAC forwarding-table item found, so that the registration request message can arrive the server that need to obtain flow data.
So far, above-mentioned flow process finishes.
After above-mentioned flow process as shown in Figure 4, if in the network port P1~Pn of terminal equipment only surplus one available, need to make server to know the current ability that does not possess load balancing of terminal equipment, can utilize a new fault notification mechanism to inform this server.Therefore, realize that based on many network ports the method for load balancing can also, according to flow process as shown in Figure 5, be used for realizing the following steps of fault notification in the exchange chip execution in the present embodiment:
Step 241, only there is one when available in all network interface port P1~Pn, port P0 receives that processor sends internally take the fault notification message that stream destination MAC Address is destination address, in this fault notification message, carries for meaning the terminal equipment information that holding load is not shared, carrying for meaning that the flow data encapsulated message needs the sign of load balancing to cancel the flow data request message.
Step 242, according to the up direction MAC forwarding-table item that finds (refreshing and a corresponding only available map network port Pk through MAC Address repeatedly), the fault notification message fault notification message is forwarded to switching equipment from an only available map network port Pk, so that can arrive the server that need to obtain flow data.
In addition, only have one when available in all network interface port P1~Pn, the VLAN that can also cancel all-network port P1~Pn and internal port P0 divides.
So far, above-mentioned flow process finishes.
The present embodiment provides above-mentionedly realizes that based on many network ports the method for load balancing can utilize computer program to realize.Correspondingly, what the present embodiment also provided a kind of correspondence realizes that based on many network ports the device of load balancing, this device are carried on as Fig. 1 a to the exchange chip in the terminal equipment of the provided flow data shown in Fig. 1 e, and comprises:
The request forwarding module, the flow data request message that flow automatically destination the terminal equipment MAC Address of take that will receive from arbitrary network port Pi is destination address, be forwarded to processor by searching the mode that MAC transmits from the corresponding internal port P0 of down direction MAC forwarding-table item.Wherein, the flow data request message can identify to mean that the flow data of its request needs load balancing by carrying a load balancing, so that processor determines whether to carry out load balancing and carry VLAN mark head in determining to carry out the flow data encapsulated message of load balancing according to this sign.
In addition, if the network port Pi of request of data receiver module receiving stream-oriented data request message is not and the current corresponding network port of up direction MAC forwarding-table item of having set up, need a list item removing module to delete the up direction MAC forwarding-table item set up, and by a list item refresh module, according to the request of data receiver module, received the flow data request message network port Pi index and set up new up direction MAC forwarding-table item as the stream destination MAC Address of the source address of flow data request message.
In addition, if the corresponding network port of up direction MAC forwarding-table item of having set up becomes unavailable, the list item removing module also can be deleted the up direction MAC forwarding-table item of having set up, and still by the list item refresh module, according to the request of data receiver module, received the flow data request message network port Pi index and set up new up direction MAC forwarding-table item as the stream destination MAC Address of the source address of flow data request message.
Forward judge module, decision processor sends in the flow data encapsulated message of internal port P0 whether carry the Tag head for the VLANj of load balancing sign.Wherein, while carrying the load balancing sign in the flow data request message, processor can carry the Tag head of VLANj in the flow data encapsulated message corresponding with this flow data request message.
Data forwarding module, while carrying VLAN mark head in the flow data encapsulated message, the network port Pj that is subordinated to corresponding VLANj after the Tag head of the VLANj that the flow data encapsulated message is carried divests forwards; The network port Pj that belongs to corresponding VLANj is the arbitrary network port except network port Pi corresponding to up direction MAC forwarding-table item.
Data forwarding module, while also further in the flow data encapsulated message, not carrying Tag of VLANj, by the flow data encapsulated message of Tag head that do not carry VLANj, according to the usual manner of searching MAC and transmitting, the network port Pi corresponding from up direction MAC forwarding-table item forwards.Certainly, for the normal forwarding that does not need load balancing, processor also can carry the Tag head of VLANi in the flow data encapsulated message, still can guarantee this flow data message at the Tag head carried by after divesting, from up direction MAC forwarding-table item, corresponding network port Pi forwards.
And, for the study to the ARP list item of the foundation that realizes up MAC forwarding-table item and descending MAC forwarding-table item and processor, this device also comprises:
The ARP forwarding module, the ARP request message that the terminal equipment MAC Address is destination address as source address, the broadcast address of take of take that port P0 receiving processor is internally sent forwards from each network port P1~Pn successively.
The first entry module, set up down direction MAC forwarding-table item according to the index of internal port P0 and as the network equipment MAC Address of the source address of ARP request message.
The ARP forwarding module, the arp response message that the destination MAC Address is destination address as source address, the terminal equipment MAC Address of take is flowed in take of also receiving from arbitrary network port Pi, by searching the mode that MAC transmits, from down direction MAC forwarding-table item, corresponding internal port P0 is forwarded to processor, for processor, utilizes arp response message study ARP list item; Wherein, the network port Pi that receives the network port Pi of arp response message and request of data receiver module receiving stream-oriented data request message may be same, also may not be same.
The second entry module, set up up direction MAC forwarding-table item according to the index of the network port Pi that receives the arp response message and as the stream destination MAC Address of the source address of arp response message.
Whether in order can in network, to need to obtain the server registration of flow data and can to share by holding load to this server announcement terminal equipment, this device can also comprise:
The registration forwarding module, receive to flow by port P0 internally the registration request message that the destination MAC Address is destination address, to search the mode network port Pi corresponding from up direction MAC forwarding-table item that MAC transmits, forwards.Wherein, in this registration request message, carry for meaning information that the terminal equipment holding load shares, to allow the flow data request message, carrying the load balancing sign.
The announcement forwarding module, only there is one when available in all network interface port P1~Pn, take of port P0 receiving processor transmission internally flowed to the fault notification message that the destination MAC Address is destination address, a mode available network port Pk forwarding only remaining corresponding from up direction MAC forwarding-table item of transmitting to search MAC.Wherein, in this fault notification message, carry for meaning the terminal equipment information that holding load is not shared, to cancel the flow data request message, carrying the load balancing sign.
Above-described embodiment is all that the internal structure of take in terminal equipment comprises that exchange chip and processor are example, and in practical application, terminal equipment also can adopt structure arbitrarily.So, in order to be applicable to the terminal equipment of various structures, the basic principle based on same also in the embodiment of the present invention, provide more general a kind of method and a kind of system that realizes load balancing based on many network ports that realizes load balancing based on many network ports.
A kind of method that realizes load balancing based on many network ports that the present embodiment provides, the method for example, for example, provides flow data to server (VM server) for terminal equipment (EC), this terminal equipment has at least two network port P1~Pn, at least two network port P1~Pn with same for realizing that the server switching equipment mutual with terminal equipment is connected;
And at least two network port P1~Pn are divided to respectively different VLAN1~VLANn, and preferably all are set to the Access attribute; And the method is included in the following steps that terminal equipment is carried out:
A1, reception server are sent to the flow data request message of arbitrary network port Pi by switching equipment; Wherein, down direction MAC forwarding-table item (mode of setting up this down direction MAC forwarding-table item adopts identical principle with previously described mode), this down direction MAC forwarding-table item can be found from MAC transmits and any position for the treatment of the flow data request message in terminal equipment can be pointed to.
If in this step, the network port Pi of receiving stream-oriented data request message is not and the corresponding network port of the current up direction MAC forwarding-table item of having set up (mode and the previously described mode of setting up this up direction MAC forwarding-table item adopt identical principle), the up direction MAC forwarding-table item that needs further deletion to set up, and set up new up direction MAC forwarding-table item for the network port Pi that receives the flow data request message in this step.
In addition, if the corresponding network port of up direction MAC forwarding-table item of having set up is unavailable before this step, before step, can delete the up direction MAC forwarding-table item of having set up, and set up new up direction MAC forwarding-table item for the network port Pi that this step receives the flow data request message.
After steps A 1, terminal equipment can judge in the flow data request message load balancing sign that whether has the flow data that means its request to need load balancing.
A2, while carrying described load balancing sign in the flow data request message, carry the Tag head of VLANj in the flow data encapsulated message obtained in encapsulation and flow data encapsulated message that encapsulation the is obtained VLANj by this Tag head correspondence is sent to the network port j that belongs to this VLANj, forwards to server by switching equipment from this network port j after this Tag head is divested.
When above-mentioned steps A2 can also further not carry described load balancing sign in the flow data request message, the flow data encapsulated message that encapsulation is obtained is transmitted and is sent to corresponding network port Pi, forwards to server by switching equipment from this network port Pi by searching MAC; Wherein, the up direction MAC forwarding-table item found from MAC transmits points to this network port Pi.Certainly, for the normal forwarding that does not need load balancing, processor also can carry the Tag head of VLANi in the flow data encapsulated message, still can guarantee this flow data message at the Tag head carried by after divesting, from up direction MAC forwarding-table item, corresponding network port Pi forwards.
The method further comprised for reporting the step of load balancing ability: A0 by login mechanism to server, the registration request message of generation being transmitted and is sent to corresponding network port Pi, forwards to server by switching equipment from this network port Pi by searching MAC before steps A 1; Wherein, in this registration request message, carry for meaning information that the terminal equipment holding load shares, to allow the flow data request message, carrying described load balancing sign.
The method further comprises for the step to server announcement fault: B0, at all network interface port P1~Pn, only has one when available after described steps A 0, and the fault notification message of generation is transmitted and is sent to an only available network port Pk and forwards to server by switching equipment from this network port Pk by searching MAC; Wherein, in this fault notification message, carry for meaning the terminal equipment information that holding load is not shared, to forbid the flow data request message, carrying described load balancing sign.
A kind of system that realizes load balancing based on many network ports provided in the embodiment of the present invention, this system comprises server (for example VM server), terminal equipment (for example EC) and the switching equipment for realizing that server and terminal equipment are mutual for flow data is provided to server, and described terminal equipment has at least two network port Pi~Pn, described at least two network port Pi~Pn are connected with same switching equipment;
At least two network port Pi~Pn are divided to respectively different VLAN1~VLANn, and preferably all are set to the Access attribute;
Server, for sending the flow data request message to switching equipment; Wherein, the flow data request message can identify to mean that the flow data of its request needs load balancing by carrying a load balancing;
Switching equipment, for being sent to the flow data request message arbitrary network port Pi of terminal equipment;
Terminal equipment, be sent to the flow data request message of arbitrary network port Pi by switching equipment for reception server; Wherein, down direction MAC forwarding-table item (mode of setting up this down direction MAC forwarding-table item adopts identical principle with previously described mode), this down direction MAC forwarding-table item can be found from MAC transmits and any position for the treatment of the flow data request message in terminal equipment can be pointed to.
If the network port Pi of current receiving stream-oriented data request message is not and the corresponding network port of the current up direction MAC forwarding-table item of having set up (mode and the previously described mode of setting up this up direction MAC forwarding-table item adopt identical principle), terminal equipment needs the up direction MAC forwarding-table item that further deletion has been set up, and sets up new up direction MAC forwarding-table item for the current network port Pi that receives the flow data request message.
In addition, if the corresponding network port of up direction MAC forwarding-table item of having set up is unavailable before current receiving stream-oriented data request message, can delete before this up direction MAC forwarding-table item of having set up, and need terminal equipment further for the current network port Pi that receives the flow data request message, to set up new up direction MAC forwarding-table item.
Terminal equipment is also for judging whether the flow data request message has the flow data that means its request to need the load balancing sign of load balancing.
While carrying described load balancing sign in the flow data request message, carry the Tag head of VLANj the VLANj by this Tag head correspondence in the flow data encapsulated message that terminal equipment obtains in encapsulation and be sent to the network port Pj that belongs to this VLANj, forward to server by switching equipment from this network port Pj after this Tag head is divested again;
And, while not carrying described load balancing sign in the flow data request message, the flow data encapsulated message that terminal equipment obtains encapsulation is transmitted and is sent to corresponding network port Pi, forwards to server by switching equipment from this network port Pi by searching MAC.Wherein, the up direction MAC forwarding-table item found from MAC transmits points to this network port Pi.Certainly, for the normal forwarding that does not need load balancing, processor also can carry the Tag head of VLANi in the flow data encapsulated message, still can guarantee this flow data message at the Tag head carried by after divesting, from up direction MAC forwarding-table item, corresponding network port Pi forwards.
In order to report the load balancing ability to server, before the receiving stream-oriented data request message, terminal equipment can also be further transmitted the registration request message of generation to be sent to corresponding network port Pi, to forward to server by switching equipment from this network port Pi by being searched MAC; Wherein, in this registration request message, carry for meaning information that the terminal equipment holding load shares, to allow the flow data request message, carrying described load balancing sign.
In order to circulate a notice of fault to server, after by login mechanism, reporting the load balancing ability, terminal equipment can also further only have one when available in all network interface port P1~Pn, and the fault notification message of generation is transmitted and is sent to an only available network port Pk and forwards to server by switching equipment from this network port Pk by searching MAC; Wherein, in this fault notification message, carry for meaning the terminal equipment information that holding load is not shared, to forbid the flow data request message, carrying described load balancing sign.
The foregoing is only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of doing, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.