Summary of the invention
The technical problem to be solved, it is simply that providing a kind of multilink tunnel message transmission method and system, balanced each bar chain-circuit time delay, the bandwidth that branches out realizes the order transfer of message。
This invention address that described technical problem, employed technical scheme comprise that, multilink tunnel message transmission method, it is characterised in that include step:
Configure a virtual L2TP Tunnel between A, sender and recipient, and configure the address of sender's virtual L2TP Tunnel outgoing interface and the address of the virtual L2TP Tunnel incoming interface of recipient;Each link in multilink between the virtual L2TP Tunnel incoming interface of described sender virtual L2TP Tunnel outgoing interface and described recipient sets up L2TP Tunnel respectively;The multilink bundle setting up L2TP Tunnel and is identified together;
B, set up for described sender virtual L2TP Tunnel outgoing interface one send total queue, for described recipient virtual L2TP Tunnel incoming interface set up one receive total queue, initialize the total queue of described transmission and receive total queue;
C, arrive after the virtual L2TP Tunnel outgoing interface of described sender when message to be forwarded, described message to be forwarded is judged by sender by local Message processing rule, for meeting the message assigned sequence number of forwarding condition, send into and send total queue, sender configures according to QOS, after selecting a certain outgoing interface in multilink, the L2TP message that the message of assigned sequence number carries out correspondence is encapsulated and is sent by the L2TP Tunnel of described outgoing interface, and described serial number is encapsulated in L2TP message;
After D, described L2TP message arrive the virtual L2TP Tunnel incoming interface of described recipient and decapsulate, message after described decapsulation and sequence number information are sent into and receives total queue, the message meeting number order is sequentially carried out forwarding by recipient, after the delay conditions to be placed such as the message not meeting number order, if not also being received in compliance with the L2TP message of number order, then send the message of next serial number meeting number order, and the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described sender;
After E, described sender virtual L2TP Tunnel outgoing interface receive the message information of deletion sequence number of described recipient's loopback, calculate packet loss according to each outgoing interface statistical information in QOS configuration and multilink;
F, described sender are according to packet loss computation bandwidth, and the transmission rate according to Bandwidth adjustment QOS and each bar link。
Preferably, in described step A, the configuration of described virtual L2TP Tunnel is applied on each link described the L2TP Tunnel set up respectively。
Preferably, in described step D, the delay condition of described setting refers to sliding window interval or the message number of setting。
Preferably, in described step F, described sender periodically calculates the bandwidth of each outgoing interface in multilink according to packet loss。
Another object of the present invention, it is provided that a kind of multilink tunnel message transmission system, including sender and recipient;
Described sender, for setting up a virtual L2TP Tunnel with described recipient, and sets up L2TP Tunnel on each link in the multilink between described virtual L2TP Tunnel outgoing interface and described recipient's L2TP Tunnel incoming interface respectively;Set up and initialize one and send total queue, after receiving message to be forwarded and being routed to virtual L2TP Tunnel outgoing interface, by local Message processing rule, described message to be forwarded is judged, for meeting the message assigned sequence number of forwarding condition, send into and send total queue, configure according to QOS, after selecting a certain outgoing interface in multilink, the L2TP message that the message of assigned sequence number carries out correspondence is encapsulated and is sent by the L2TP Tunnel of described outgoing interface, and described serial number is encapsulated into L2TP message;And after receiving the message information of deletion sequence number of described recipient's loopback, calculate packet loss according to each outgoing interface statistical information in QOS configuration and multilink;According to packet loss computation bandwidth, and the transmission rate according to Bandwidth adjustment QOS and each bar link;
Described recipient, for setting up a virtual L2TP Tunnel with described sender, and sets up L2TP Tunnel on each link in the multilink between described virtual L2TP Tunnel outgoing interface and described sender's L2TP Tunnel incoming interface respectively;Set up and initialize one and receive total queue, after receiving L2TP message from described virtual L2TP Tunnel incoming interface and decapsulating, message after described decapsulation and sequence number information are sent into and receives total queue, the message meeting number order is sequentially carried out forwarding, after the delay conditions to be placed such as the message not meeting number order, if not also being received in compliance with the L2TP message of number order, then send the message of Next Sequence number meeting number order, and the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described sender。
Further, described sender includes the first link processing module, the first packet sending and receiving module and bandwidth adjustment module;
First link distribution module, for setting up a virtual L2TP Tunnel with described recipient, and sets up L2TP Tunnel on each link at described virtual L2TP Tunnel outgoing interface place, and the multilink bundle establishing L2TP Tunnel and is identified together;
First packet sending and receiving module, is used for setting up one and sends total queue and initialize;When having to message to be forwarded and after being routed to virtual L2TP Tunnel outgoing interface, by local Message processing rule, described message to be forwarded is judged, for meeting the message assigned sequence number of forwarding condition, send into and send total queue, configure according to QOS, after selecting a certain outgoing interface in multilink, the L2TP message encapsulation that the message of assigned sequence number carries out correspondence is sent by the L2TP Tunnel of described outgoing interface, and described serial number is encapsulated into L2TP message;And after receiving the message information of deletion sequence number of sender's loopback, notify bandwidth adjustment module;
Bandwidth adjustment module, for calculating packet loss according to each outgoing interface statistical information in QOS configuration and multilink;According to packet loss computation bandwidth, and the transmission rate according to Bandwidth adjustment QOS and each bar link。
Preferably, described recipient includes the second link distribution module and the second message transceiver module;
Second link distribution module, for setting up a virtual L2TP Tunnel with described sender, and sets up L2TP Tunnel on each link at described virtual L2TP Tunnel incoming interface place, and the multilink bundle establishing L2TP Tunnel and is identified together;
Second message transceiver module, total queue is received for setting up and initialize one, after receiving L2TP message from described virtual L2TP Tunnel incoming interface and decapsulating, message after described decapsulation and sequence number information are sent into and receives total queue, the message meeting number order is sequentially carried out forwarding, after the delay conditions to be placed such as the message not meeting number order, if not also being received in compliance with the L2TP message of number order, then send the message of the next serial number meeting number order, and the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described sender。
Preferably, described first link distribution module, it is additionally operable to the configuration of described virtual L2TP Tunnel is applied on each link described the L2TP Tunnel set up respectively;
Described second link distribution module, is additionally operable to the configuration of described virtual L2TP Tunnel is applied on each link described the L2TP Tunnel set up respectively。
Preferably, the delay condition of described setting refers to sliding window interval or the message number of setting。
Preferably, described bandwidth adjustment module periodically acts on QOS according to packet loss computation bandwidth its result。
The invention has the beneficial effects as follows, it is possible to strengthen link order transfer and anti-packet loss ability, when certain link disconnects, it is possible to be rapidly switched to an other link。Part has the particular service of packet loss, delay requirement and bandwidth requirement, and the such as business such as video, voice, by binding multilink, and dynamically find out carrier network bandwidth, the transmission rate of each bar circuit of Reasonable adjustment, thus reaching balanced time delay, the purpose of the bandwidth that branches out。
Detailed description of the invention
Below in conjunction with the drawings and the specific embodiments, technical scheme is described in detail。
The multilink tunnel message transmission method of the present invention, flow process is as it is shown in figure 1, include step:
Configure a virtual L2TP Tunnel (the Internet tunnel protocol of a kind of industrial standard) between S101, sender and recipient, and configure the address of sender's virtual L2TP Tunnel outgoing interface and the address of the virtual L2TP Tunnel incoming interface of recipient;Each link in multilink between the virtual L2TP Tunnel incoming interface of described sender virtual L2TP Tunnel outgoing interface and described recipient sets up L2TP Tunnel respectively;The multilink bundle setting up L2TP Tunnel and is identified together.
The configuration in tunnel is it should be noted that the address of all opposite ends passage, when L2TP Tunnel is initiated, according to address, opposite end Route Selection outgoing interface and local address (also can specify by hand), then send L2TP respectively set up message, recommend here to adopt L2TPv2 tunnel。In this step, configuring a virtual Layer 2 Tunneling Protocol L2TP Tunnel between sender and recipient, the configuration of this virtual L2TP is applied on each link in multilink the L2TP Tunnel set up respectively。By ppp negotiation, the multilink bundling establishing L2TP Tunnel and is identified together。When L2TP Tunnel is consulted, the LCP message of PPP is by carrying endisc mark, and recipient, by supporting this characteristic, can bundle two L2TP passages。
S102, set up for the virtual L2TP Tunnel outgoing interface of described sender one send army unit, for described recipient virtual L2TP Tunnel incoming interface set up one receive total queue, initialize the total queue of described transmission and receive total queue。
Virtual L2TP Tunnel interface on sender or recipient, and between L2TP, there is load route。Initializing queue when such configuration: set up one and send total queue, one receives total queue。Every outgoing interface transmit queue and receiving queue, send sliding window and receive sliding window, after message is sent, can preserve one and send sliding window interval, it is possible to be interval or message number in interface transmit queue。Recipient does not also receive message within the reception sliding window time, will send repeat requests。
S103, after message to be forwarded arrives the virtual L2TP Tunnel outgoing interface of described sender, described message to be forwarded is judged by sender by local Message processing rule, for meeting the message assigned sequence number of forwarding condition, send into and send total queue, sender configures according to service quality (QOS), after selecting a certain outgoing interface in multilink, the L2TP message encapsulation that the message of assigned sequence number carries out correspondence is sent by the L2TP Tunnel of described outgoing interface, and described serial number is encapsulated in L2TP message。In this step, after message to be forwarded arrives sender, being routed to the outgoing interface of virtual L2TP Tunnel, virtual L2TP Tunnel discharge coupling controls list by the access set and judges, the message being unsatisfactory for condition is directly abandoned, and other message assigned sequence number also send into the total queue of transmission。
To the serial number distribution sending total queue messages, need the data message of order transfer that NS is set according to configuration >=the numbering of 1, it is not necessary to the message numbering NS=0 of order transfer。After the message sending total queue is numbered, configures according to QOS, after selecting interface, encapsulate the serial number of different L2TP heading identification message;QOS is the QOS on virtual interface, its band width in physical, should be initialized all sub-interface bandwidth or the bandwidth sum by each sub-interface after calculating under virtual interface, QOS is when scheduling, should send according to the size order of each sub-interface bandwidth, with the message (situation that serial number does not reverse) that roomy interface should preferentially transmit Sequence Number little。
The method of the present invention is to exchange the increase of the resource of line bandwidth transmission and bandwidth to carry out (even reliable) in order for the forwarding performance of equipment, the re-transmission of transmitting may consume more device resource, and therefore also not all carries out transmitting by the message of these links。The present invention arranging access control list and order transfer on this virtual interface access and control list, and the message for not meeting forwarding condition directly abandons, and other messages then enter to send total queue。
The basis that the embodiment of the present invention realizes is order transfer message and repeat requests in data link。Realizing order transfer, first have to the sender of link, message is carried out labelling, the data receiver at link judges, in the event of packet loss, with regard to sending notification back message。This mode realizes by initial data message is encapsulated L2TP head, and to this kind of packet, lengthbit and sequencebit is still worth 1 by L2TP head, and such data message just has the mark of length and serial number。Its serial number rule is as follows:
1, when L2TP Tunnel is set up, it is 1 that acquiescence two ends send first message of data, increases successively later;
If 2 NS receiving packet are 0, directly forward;
If the NR of 3 packets is 0, represent that recipient is but without packet loss;
4, serial number is from 1-65535, after arriving 65535, again from 1, when needs calculate message number, if it find that current serial number is less than the serial number of last time, just will calculate after current serial number+65535。No matter sender or recipient require data buffer storage message number not can exceed that 65535。
Receive the square end transmission to not packet loss, ack will not be occurred to confirm, only the message to packet loss, send the message of the NR=serial number lost, this value can be carried in reverse data message, and without data message, just sending length is the data message of 0。
S104, after described L2TP message arrives the virtual L2TP Tunnel incoming interface of described recipient and decapsulates, message after described decapsulation and sequence number information are sent into and receives total queue, the message meeting number order is sequentially carried out forwarding by recipient, after the delay conditions to be placed such as the message not meeting number order, if not also being received in compliance with the L2TP message of number order, then send the message of next serial number meeting number order, and the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described sender。
In this step, after message arrives recipient, recipient determines whether packet loss according to the serial number in message。If receiving the message of NR ≠ 0 inside message, just record the packet loss into corresponding sub-interface。Here can select to realize whether carrying out transmitting, to transmitting, it may be considered that retransmit, even retransmit from other sub-interface, but sending times should be restricted。Orderly message is directly forwarded by recipient, and the message of disappearance is waited 1 sliding window interval, if also do not received, continue to forward next orderly message and on corresponding sub-interface the message of loopback NR ≠ 0。
After recipient receives message, if serial number is discontinuous, do not send at once, and it is to wait for regular hour or message number (being generally 1 sliding window interval), if also not receiving message after a sliding window, then judging packet loss, the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described sender。
Retransmission operation should be optionally, upper layer application has been processed to the business that packet loss retransmits, has perhaps undesirably again retransmitted on this kind of link, but the program remains able to calculate the most rational transmission bandwidth, reduces packet loss and out of order。When only unidirectional message, recipient should the message that send NR=0 in cycle, it is to avoid link disconnects, and sending square end cannot perception。When selecting to realize retransmitting, sender side receives NR and is not equal to the message of 0 and should retransmit immediately, re-transmission should more alias, if receiving more than 2 times identical NR values and being not equal to the message of 0, record packet loss, can no longer retransmit。If receiving NR cannot find in current sliding window scope, just abandon this message, and log notices manager, it is possible to owing to network delay is too big thus causing that sliding window is unreasonable or is subject to network attack。When select unreal now retransmit time, when sender receives the NR message being not equal to 0, record packet loss。
S105, after described sender virtual L2TP Tunnel outgoing interface receives the message information of deletion sequence number of described recipient's loopback, calculates packet loss according to each outgoing interface statistical information in QOS configuration and multilink。
When data stream arrives sender, data bandwidth is also unaware of, therefore at the beginning with the transmission as possible of the interface bandwidth of acquiescence (relevant with the configuration of sender's equipment and QoS here, it is assumed that be bandwidth to be 100Kbps)。After packet loss occurs, the message of NR ≠ 0 will be received, assume that user sets with 5s as a cycle, if within a cycle, link have sent 500 messages, but have received 25 NR message being not equal to 0, such packet loss=25/500=5%, thus calculating optimum wideband is 100Kbps* (1-5%)=95Kbps。Thus calculate the bandwidth of a wherein link, utilized same method, it is possible to calculate the optimum wideband of other links。
Link should arrange a rational packet loss at the beginning, and such as 0.5%~1%, when this packet loss little, illustrate that bandwidth can increase, when more than this packet loss, illustrating that bandwidth needs to reduce。A severe bandwidth can also be set simultaneously, such as 50%, when calculating packet loss more than 50%, rational bandwidth cannot be calculated with regard to instruction sheet by NR, just be made directly Bandwidth adjustment by half, so several all after dates here, just can reach rational bandwidth。
S106, described sender is according to packet loss computation bandwidth, and the sub-interface bandwidth gone out according to Bandwidth adjustment QOS and the transmission rate 6 of each bar link, computation of Period acts on QOS, the QOS module of interface and each sub-interface carries out bandwidth distribution again。
When all after date, after sender has calculated the bandwidth of each bar link, the available bandwidth that addition must be found out up till now (notes, this bandwidth is not likely to be current maximum bandwidth, only when all links all congestion packet loss occur, the bandwidth calculated is only current maximum available bandwidth), the data traffic that each bar link sends can be adjusted, the method adjusted can do different realizations according to distinct device or business need, method by half such as can be adopted to carry out Bandwidth adjustment, it is exactly have 5% packet loss when link 1, and link 2 does not have packet loss, then the flow of the link 1 of 2.5% can be increased to link 2, transmit the cycle at the next one to continue to calculate。When there are both links all packet losses, the bandwidth calculated is exactly current total bandwidth, and namely this value can be applicable in the QoS on upper strata。
Following two situation is likely to affect packet loss:
Configuration
1, if middle line is less due to MTU, and abandon big message, or intermediate firewall, access is artificially set and is controlled list, NAT, QOS etc. are packet filtering or change thus causing the problem (i.e. the soluble packet loss problem of non-re-transmission) of packet loss, the calculating of link packet drop rate can be affected, also result in substantial amounts of re-transmission, thus affecting transfer capability, for solving such problem, when sending, IP message size is classified (as: 1-500 is designated 1, 501-1000 is designated 2, 1001-1500 is designated 3), former and the destination address protocol port of the message before adding encapsulation with class indication carries out hash, different hash values is carried out statistics packet loss and retransmission rate, message to continual data package dropout more than 95%, subsequent transmission does not just enter back into the queue of transmitting, but directly forward, when this kind of situation occurs, log notice manager should be recorded check network or distribute rationally。
2, network attack
Network attack is likely to simulate substantial amounts of repeat requests message and out of order message, this kind of message can be determined unreliable transmission queue after a certain time, when serial number is not within the scope of sliding window, just directly abandon such message, and print log is possible under attack or time slide window is less than network delay。
The present invention multilink tunnel message transmission system, structure as in figure 2 it is shown, include sender and recipient,
Described sender, for setting up a virtual L2TP Tunnel with described recipient, and sets up L2TP Tunnel on each link in the multilink between described virtual L2TP Tunnel outgoing interface and described recipient's L2TP Tunnel incoming interface respectively;Set up and initialize one and send total queue, after receiving message to be forwarded and being routed to virtual L2TP Tunnel outgoing interface, by local Message processing rule, described message to be forwarded is judged, for meeting the message assigned sequence number of forwarding condition, send into and send total queue, configure according to QOS, after selecting a certain outgoing interface in multilink, the L2TP message encapsulation that the message of assigned sequence number carries out correspondence is sent by the L2TP Tunnel of described outgoing interface, and described serial number is encapsulated into L2TP message;And after receiving the message information of deletion sequence number of described recipient's loopback, calculate packet loss according to each outgoing interface statistical information in QOS configuration and multilink;According to packet loss computation bandwidth, and the transmission rate according to Bandwidth adjustment QOS and each bar link;
Described recipient, for setting up a virtual L2TP Tunnel with described sender, and sets up L2TP Tunnel on each link in the multilink between described virtual L2TP Tunnel outgoing interface and described sender's L2TP Tunnel incoming interface respectively;Set up and initialize one and receive total queue, after receiving L2TP message from described virtual L2TP Tunnel incoming interface and decapsulating, message after described decapsulation and sequence number information are sent into and receives total queue, the message meeting number order is sequentially carried out forwarding, after the delay conditions to be placed such as the message not meeting number order, if not also being received in compliance with the L2TP message of number order, then send the message of Next Sequence number meeting number order, and the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described sender。
Referring to Fig. 3, sender includes the first link processing module the 301, first packet sending and receiving module 302 and bandwidth adjustment module 303;
First link distribution module 301, for setting up a virtual L2TP Tunnel with described recipient, and set up L2TP Tunnel on each link at described virtual L2TP Tunnel outgoing interface place, and the multilink bundle establishing L2TP Tunnel and is identified together;
First report transceiver module 302, is used for setting up one and sends total queue and initialize;When having to message to be forwarded and after being routed to virtual L2TP Tunnel outgoing interface, by local Message processing rule, described message to be forwarded is judged, for meeting the message assigned sequence number of forwarding condition, send into and send total queue, configure according to QOS, after selecting a certain outgoing interface in multilink, the L2TP message encapsulation that the message of assigned sequence number carries out correspondence is sent by the L2TP Tunnel of described outgoing interface, and described serial number is encapsulated into L2TP message;And after receiving the message information of deletion sequence number of sender's loopback, notify bandwidth adjustment module;
Bandwidth adjustment module 303, for calculating packet loss according to each outgoing interface statistical information in QOS configuration and multilink;According to packet loss computation bandwidth, and the transmission rate according to Bandwidth adjustment QOS and each bar link。
First link distribution module 301 and the second link module 401, for setting up L2TPV2 tunnel on each link, by ppp negotiation, and is identified the multilink bundling establishing tunnel together。Initialize sliding window size。Sliding window size represents with interval and message number。
First packet sending and receiving module 302, is used for setting up and initialize one and sends total queue。After message arrives sender, being routed to virtual interface, virtual interface controls list judgement by accessing, and directly abandons not meeting the message forwarding rule, and other messages enter to send total queue。To the message assigned sequence number sending total queue, the data message of order transfer is needed to carry out NS according to configuration >=the numbering of 1, it is not necessary to the message numbering NS=0 of order transfer。Configure according to QOS, after selecting interface, encapsulate the different L2TP headings serial number with identification message。
Bandwidth adjustment module 303 is periodically according to packet loss computation bandwidth, and the transmission rate according to each bar link of Bandwidth adjustment。If sender receives one section of continuous print packet loss, it is considered as link single-pass, disconnecting link;If a period of time does not receive any message, it is considered as link obstructed, disconnecting link;When link sends without message for a long time, just periodically sending length is the data message of 0;Not having message to send when needs can send NR information, just sending message length is the data message of 0。
Referring to Fig. 4, recipient includes the second link distribution module 401 and the second message transceiver module 402;
Second link distribution module 401, for setting up a virtual L2TP Tunnel with described sender, and sets up L2TP Tunnel on each link at described virtual L2TP Tunnel incoming interface place, and the multilink bundle establishing L2TP Tunnel and is identified together。
Second message transceiver module 402, total queue is received for setting up and initialize one, after receiving L2TP message from described virtual L2TP Tunnel incoming interface and decapsulating, message after described decapsulation and sequence number information are sent into and receives total queue, the message meeting number order is sequentially carried out forwarding, after the delay conditions to be placed such as the message not meeting number order, if not also being received in compliance with the L2TP message of number order, then send the message of the next serial number meeting number order, and the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described sender。
Second message transceiver module 402, after arriving recipient for message, determines whether packet loss according to serial number;Orderly message directly being forwarded, the message of disappearance is waited 1 sliding window interval, if also do not received, continuing to forward next message and loopback to carry the message of corresponding NR information to sender。
In the present invention program, sender, according to load configuration, after selecting the outgoing interface of multilink, encapsulates different L2TP headings;Port band width is calculated according to packet loss, and according to the transmission rate of each bar link of Bandwidth adjustment or QOS is carried out Dynamic parameter adjustment。