Background
At a certain node in the network, there may be more than 2 equivalent links during route forwarding, and in order to ensure that the traffic of each link is uniform, the traffic generally needs to be uniformly distributed on each link according to some method.
The prior art generally uses a HASH algorithm. The method is based on the flow attributes, such as: an IP address of an IPv4(Internet Protocol version 4) packet, a Media Access Control (MAC) address of a two-layer ethernet packet, and the like may identify a parameter of a certain flow, and hash flows with different attributes onto different links. Moreover, in most cases, the traffic needs to be guaranteed to be sequential in transmission, so that the same flow must select the same link in the HASH process to avoid disorder.
Tunneling is a technique that uses one protocol to encapsulate another protocol packet, and the encapsulation protocol itself may also be encapsulated or carried by another encapsulation protocol. A tunnel is a logical extension of its PSTN (public switched Telephone Network)/ISDN (Integrated services digital Network) link to the user, and is the same as the actual physical link in use.
The tunnel based on the IPv4 network is a tunnel technology carried in the IPv4 network, and in the technology, user messages are all encapsulated inside the IPv4 protocol for transmission.
In the prior art, a node in a network receives an IPv4 message, and when there are multiple forwarding paths and the sequence of the message needs to be guaranteed, a data stream is usually identified by using a source IP (Internet Protocol) and a destination IP in an IPv4 header. Therefore, for various user messages carried in the tunnel of the IPv4 network, the network side only uses the public network IPv4 address of the tunnel to perform HASH.
By adopting the method, if the number of tunnels is small or the addresses of the tunnels are discontinuous due to the network layout, when the situation that load sharing is required is met on the IPv4 network side, the result of HASH is uneven, and all or most of the traffic of users is selected to one or a few links, while the other links are still idle. When the user traffic is large, the selected link is likely to be congested, and packet loss occurs.
The prior art provides a method for tunnel load sharing, which can resolve an internal tunnel protocol packet at a load sharing node (e.g., IPv4 core node), and then perform HASH according to an IP address of an internal user to select a forwarding link. For example: for an L2TP (Layer Two Tunneling Protocol) tunnel, the load sharing node needs to analyze information such as a UDP (user datagram Protocol) port number, an L2TP header, and an internal private network IPv4 address in an IPv4 message, perform HASH according to the internal private network IPv4 address, and select a forwarding link.
However, the above tunnel load sharing method determines that the branch of the internal tunnel Protocol is relatively complicated, for example, one user packet may encapsulate user packets of multiple tunnels such as L2TP, GRE (Generic Routing Encapsulation), IPSec (Internet Protocol Security extensions, IP Protocol Security extensions), and the like. If the load sharing node analyzes all the messages encapsulated in the message, the algorithm complexity is very high, and the message length which needs to be read from the external memory and analyzed is very large when the internal protocol is analyzed, so that the forwarding performance of the core router at the public network side is greatly influenced.
If the IPv4 message on the public network side is fragmented, the use of the scheme can cause the disorder of the message (the sequence of receiving the message does not accord with the sequence of sending the message). Taking the GRE message as an example, as shown in fig. 1. The message which is not fragmented and the first fragment of the fragmented message can be hashed according to the protocol message inside the user; since the subsequent segment does not have the GRE header, HASH cannot be performed according to the internal protocol, HASH can be performed only according to the IPv4 address on the public network side, and a forwarding path different from that of the first segment may be selected. If the subsequent slice arrives late, the reassembly of the fragmented messages is delayed on the reassembly side, and the non-fragmented messages arrive in advance, so that the messages are out of order.
Disclosure of Invention
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
The embodiment of the invention provides a method for sharing tunnel load, which is used for uniformly distributing flow to each link when the number of tunnels is limited or the addresses of the tunnels are scattered.
To achieve the above object, an aspect of the embodiments of the present invention provides a method for tunnel load sharing, including:
receiving a message sent by an entrance node of a tunnel, wherein a message header of the message comprises user information;
and selecting a route according to the user information and the public network Internet protocol IP address in the message header, and forwarding the message.
On the other hand, an embodiment of the present invention further provides a system for tunnel load sharing, including:
the tunnel entrance node is used for acquiring user information of a user, packaging the user information in a message header and sending a message carrying the message header;
and the load sharing node is used for receiving the message sent by the entrance node of the tunnel, selecting a route according to the user information in the message header and the public network IP address, and forwarding the message.
In another aspect, an embodiment of the present invention further provides an ingress node of a tunnel, where the ingress node includes:
the acquisition module is used for acquiring user information of a user;
the encapsulation module is used for encapsulating the user information acquired by the acquisition module in a message header;
a sending module for sending the message carrying the message header packaged by the packaging module
In another aspect, an embodiment of the present invention further provides a load sharing node, including:
the receiving module is used for receiving a message sent by an entrance node of a tunnel, and the message header of the message contains user information;
and the message forwarding module is used for carrying out route selection and forwarding the message according to the user information and the public network IP address in the message header received by the receiving module.
Compared with the prior art, the embodiment of the invention has the following advantages: through the embodiment of the invention, the load sharing node receives the message containing the user information, and performs routing according to the IP address in the message header and the user information, and forwards the message. Therefore, when the number of tunnels is limited or the addresses of the tunnels are scattered, the load sharing node can also distribute the traffic evenly on each link.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a tunnel load sharing method, which brings user information to a public network side, and a public network side load sharing node combines and considers an outer public network IP address of a message and the user information carried by the message and selects a forwarding path.
As shown in fig. 2, a flowchart of a method for tunnel load sharing according to an embodiment of the present invention specifically includes:
step S201, receiving a message sent by an entry node of a tunnel, where a message header of the message includes user information.
In the embodiment of the invention, the entrance node of the tunnel performs hash according to one or more of the IP address, the MAC address and the session identification of the user to obtain the user information of the user, and encapsulates the user information in the Options domain of the message header.
The Options field comprises an option type field, an option length field and an option data field, wherein the option data field bears the acquired user information.
However, the embodiment of the present invention is not limited to this, and may perform hash on other identification information of the user to obtain the user information of the user.
Step S202, according to the user information and the public network IP address in the message header, the route selection is carried out, and the message is forwarded.
When the packet needs to be fragmented, the load sharing node copies the Options domain containing the user information to the header of each fragmented packet.
In the method for sharing tunnel load, the load sharing node receives the message containing the user information, and performs routing according to the IP address in the message header and the user information, and forwards the message. Therefore, when the number of tunnels is limited or the addresses of the tunnels are scattered, the load sharing node can also distribute the traffic evenly on each link. And when the message is fragmented, the Options domain containing the user information is copied to the message header of each fragmented message, thereby avoiding the problem of message disorder.
Fig. 3 is a schematic networking diagram of a tunnel load sharing method according to an embodiment of the present invention, where an IPv4 network is taken as an example in the embodiment of the present invention, and in fig. 3, a router a is an entry node of a tunnel, a router B is a load sharing node on a public network side, a router C is a common forwarding node on the public network side, and a router D is an exit node of the tunnel. The operation performed by each router will be described in detail below.
Fig. 4 is a schematic diagram illustrating an operation flow of an entry node of a tunnel according to an embodiment of the present invention, where the entry node of the tunnel is a router a in the embodiment of the present invention. The method specifically comprises the following steps:
step S401, configuring, by the entry node of the tunnel, indication information indicating whether to carry the user information to the public network side. The indication information indicates whether the entrance node of the tunnel carries the user information to the public network side, and when the indication information indicates that the entrance node of the tunnel carries the user information to the public network side, the indication information can further indicate the acquisition mode of the user information. The method specifically comprises the following steps:
(1) HASH is carried out according to the IP address of the user to obtain user information; or,
(2) HASH is carried out according to the MAC address of the user to obtain user information; or,
(3) the user information is acquired by performing HASH according to the session identifier (for example, the L2TP tunnel) when the tunnel is established.
In addition, when the user information is obtained, the 3 manners may be combined pairwise, or the 3 manners may be used to obtain the user information at the same time, that is, in the embodiment of the present invention, HASH may be performed according to one or more of the IP address, the MAC address, and the session identifier of the user to obtain the user information.
However, the embodiment of the present invention is not limited to the above 3 manners when acquiring the user information, and may also perform HASH on other identification information of the user to acquire the user information.
Step S402, when the user message is encapsulated in the tunnel, the user information is obtained.
When the user packet is encapsulated in the tunnel, and when the indication information configured in step S401 indicates the entry node of the tunnel to carry the user information to the public network side, the entry node of the tunnel acquires the user information according to the manner indicated by the indication information.
And S403, when the IPv4 address of the public network side is encapsulated, encapsulating the user information obtained by the calculation in the step S402 into the IPv4 message header of the public network side. In the embodiment of the present invention, an option (Options) field in an IPv4 header is used to carry user information, and a structure of an IPv4 header including the option (Options) field is shown in fig. 5.
The structure of the Options field in the embodiment of the present invention is shown in fig. 6, and the Options field has an Option type (Option-type) field of one byte, an Option length (Option-length) field of one byte, and an Option data field of a plurality of bytes.
Wherein, the Option type (Option-type) field contains 3 fields:
(1) copy (copied) field: length is 1 bit, and when there is a slice, it indicates whether to copy the Options field into the slice message, for example: when the value of the copy domain is 1, indicating to copy the Options domain into the fragment message; when the value of the copy field is 0, it indicates that the Options field is not copied into the slice message.
(2) Class (class) field: the length is 2 bits, and when the value of the category field is 0, control is represented; when the value of the category field is 2, representing debugging and measurement; 1 and 3 are reserved values for future use.
(3) Option number (number) field: the length is 5 bits, and an option number is set for each option to identify the option.
In the embodiment of the present invention, the copy field is set to 1, the category field is set to 0, and the option number is defined as 6. Therefore, in the embodiment of the present invention, the value of the option type field is 134, which indicates that the Options field contains the load sharing parameter.
Wherein the value of the option length field is the sum of the option type field, the option length field and the option data field length. Because the user INFORMATION carried in the embodiment of the present invention is for routing at the load sharing node, the number of links in the actual networking is not large, and meanwhile, in order to ensure that the IP header is an integer multiple of 32 bits, the length of the option data field is set to 8 bits, and the option data field carries hashed user INFORMATION (HASH _ INFORMATION). At this time, the option length field has a value of 4.
For the load sharing node router B on the public network side, after receiving the IPv4 message sent by the router A, the router B analyzes the message header of the IPv4 message, searches for a route, and when finding that load sharing is needed, the router B judges whether the IPv4 message header has an Options domain. When the header of the IPv4 message contains an Options field, the router B further determines whether the option type field of the Options field contains a load sharing parameter, and if so, the router B performs routing according to hashed user INFORMATION (HASH _ INFORMATION) in the option data field of the Options field and the public network IPv4 address, forwards the message, and does not modify the Options field.
When the IPv4 message needs to be fragmented, the Options field in the IPv4 message header is also copied into the IPv4 message header of the fragmented message.
For a common forwarding node router C at the public network side, the analysis of an IPv4 message header containing an Options domain is supported, the IPv4 message containing the IPv4 message header is normally forwarded, the Options domain in the IPv4 message header is not required to be considered, the Options domain is not modified, and the IPv4 message containing the IPv4 message header is transmitted to the next node.
When the IPv4 message needs to be fragmented, the Options field in the IPv4 message header is also copied into the IPv4 message header of the fragmented message.
For the exit router D of the tunnel, it supports the analysis of the IPv4 header containing the Options domain, and normally analyzes the IPv4 packet containing the IPv4 header, and when the IPv4 packet is an outgoing tunnel packet, the exit router D decapsulates the IPv4 packet, strips the outer IPv4 header, and then performs outgoing tunnel processing on the IPv4 packet.
As shown in fig. 7, a structure diagram of a tunnel load sharing system according to an embodiment of the present invention includes:
the tunnel entrance node 71 is configured to acquire user information of a user, encapsulate the user information in a packet header, and send a packet with the packet header;
and the load sharing node 72 is configured to receive a packet sent by the entry node 71 of the tunnel, select a route according to the user information and the public network IP address in the packet header, and forward the packet.
The load sharing system may further include: a forwarding node 73, configured to transparently transmit the packet forwarded by the load sharing node 72;
and the tunnel exit node 74 is configured to receive the packet transparently transmitted by the forwarding node 73, parse the packet, decapsulate the packet, remove a packet header of the packet, and perform tunnel exit processing on the packet when the packet is a tunnel exit packet.
In the tunnel load sharing system, the load sharing node 72 receives a message containing user information sent by the entry node 71 of the tunnel, and performs routing according to the IP address and the user information in the header of the message, and forwards the message. Thus, when the number of tunnels is limited or the tunnel addresses are scattered, the load sharing node 72 may also distribute traffic evenly over each link.
As shown in fig. 8, a structure diagram of an entry node of a tunnel according to an embodiment of the present invention includes:
an obtaining module 711, configured to obtain user information of a user;
an encapsulating module 712, configured to encapsulate the user information acquired by the acquiring module 711 in a message header;
a sending module 713, configured to send a message carrying the header encapsulated by the encapsulating module 712.
The obtaining module 711 may include: and the hash submodule 7111 is configured to perform hash according to one or more of an IP address, an MAC address, and a session identifier of the user to obtain user information of the user.
The tunnel entry node, the obtaining module 711 obtains the user information of the user, the encapsulating module 712 encapsulates the user information obtained by the obtaining module 711 in the packet header, and the sending module 713 sends the packet carrying the packet header, thereby implementing carrying of the user information to the public network side, and enabling the load sharing node 72 on the public network side to select a route according to the user information and the public network IP address when performing load sharing.
As shown in fig. 9, a structure diagram of a load sharing node according to an embodiment of the present invention includes:
a receiving module 721, configured to receive a message sent by the ingress node 71 of the tunnel, where a message header of the message includes user information;
the message forwarding module 722 is configured to perform routing and forward the message according to the user information and the public network IP address in the message header received by the receiving module 721.
The load sharing node 72 may further include: the copying module 723 is configured to copy an Options domain in a header of the packet received by the receiving module 721 to a header of each fragmented packet when the packet received by the receiving module 721 is fragmented, where the Options domain carries the user information.
In the load sharing node, the receiving module 721 receives the message containing the user information, and the message forwarding module 722 performs routing according to the IP address in the message header and the user information, and forwards the message. Thus, when the number of tunnels is limited or the tunnel addresses are scattered, the load sharing node 72 may also distribute traffic evenly over each link. When the packet is fragmented, the copy module 723 copies the Options domain containing the user information to the header of each fragmented packet, thereby avoiding the problem of packet disorder.
The embodiment of the invention solves the problem that the load sharing node can not uniformly distribute the flow to each link due to the limited number of tunnels or the dispersed addresses of the tunnels on the IPv4 public network side. The embodiment of the invention brings the user information to the public network side, so that the user information becomes one of the bases for load sharing, and the secret attribute of the tunnel to the user message is not changed. Meanwhile, the embodiment of the invention does not limit the concrete model of the tunnel and aims at all tunnels loaded in the IPv4 network. In the embodiment of the invention, the load sharing node can flexibly use the information of the user such as IP address, MAC address, session identification and the like to select a route according to the requirement of the user or a tunnel model, thereby realizing the flexible load sharing of the IPv4 public network side.
From the above description of the embodiments, it is clear for those skilled in the art that the present invention can be implemented by hardware, or by software plus a necessary general hardware platform, and based on such understanding, the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the method described in the embodiments of the present invention.
Those skilled in the art will appreciate that the drawings are merely schematic representations of one preferred embodiment and that the blocks or flow diagrams in the drawings are not necessarily required to practice the present invention.
Those skilled in the art will appreciate that the modules in the devices in the embodiments may be distributed in the devices in the embodiments according to the description of the embodiments, and may be correspondingly changed in one or more devices different from the embodiments. The modules of the above embodiments may be combined into one module, or further split into multiple sub-modules.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The above disclosure is only for a few specific embodiments of the present invention, but the present invention is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present invention.