Summary of the invention
Technical problem to be solved by this invention, just be to provide a kind of multilink channel message transmission method and system, balanced each chain-circuit time delay, and the bandwidth that branches out realizes the orderly transmission of message.
The present invention solve the technical problem, and the technical scheme of employing is that multilink channel message transmission method, is characterized in that, comprises step:
A virtual L2TP Tunnel of configuration between A, transmit leg and recipient, and the address of the virtual L2TP Tunnel outgoing interface of configuration transmit leg and the address of the virtual L2TP Tunnel incoming interface of recipient; Set up respectively L2TP Tunnel on each link in multilink between the virtual L2TP Tunnel outgoing interface of described transmit leg and the virtual L2TP Tunnel incoming interface of described recipient; By the multilink bundle of the setting up L2TP Tunnel line identifier of going forward side by side together;
B, set up one for the virtual L2TP Tunnel outgoing interface of described transmit leg and send total queue, set up one for the virtual L2TP Tunnel incoming interface of described recipient and receive total queue, the total queue of the described transmission of initialization and receive total queue;
C, after wait E-Packeting, arriving the virtual L2TP Tunnel outgoing interface of described transmit leg, transmit leg by local message processing rule to described wait to E-Packet judged, for the message distributing serial numbers that meets the forwarding condition, send into and send total queue, transmit leg configures according to QOS, after selecting a certain outgoing interface in multilink, the message of distributing serial numbers is carried out to corresponding L2TP message encapsulation and the L2TP Tunnel by described outgoing interface sends, described sequence number is encapsulated in the L2TP message;
After D, described L2TP message arrive the virtual L2TP Tunnel incoming interface of described recipient decapsulation, message after described decapsulation and sequence number information are sent into to the total queue of reception, the message that the recipient will meet number order is forwarded successively, after the message that does not meet number order is waited for to the delay condition arranged, if also do not receive the L2TP message that meets number order, send the message of the next sequence number meet number order, and the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described transmit leg;
E, the virtual L2TP Tunnel outgoing interface of described transmit leg calculate packet loss according to each outgoing interface statistical information in QOS configuration and multilink after receiving the message information of deletion sequence number of described recipient's loopback;
F, described transmit leg be according to the packet loss computation bandwidth, and adjust the transmission rate of QOS and each link according to bandwidth.
Preferably, in described steps A, the configuration of described virtual L2TP Tunnel is applied to the L2TP Tunnel of setting up respectively on described each link.
Preferably, in described step D, the delay condition of described setting refers to the sliding window time interval or the message number of setting.
Preferably, in described step F, described transmitting terminal periodically calculates the bandwidth of each outgoing interface in multilink according to packet loss.
Another object of the present invention, provide a kind of multilink channel message transmission system, comprises transmit leg and recipient;
Described transmit leg, for described recipient, setting up a virtual L2TP Tunnel, and set up respectively L2TP Tunnel on each link in the multilink between described virtual L2TP Tunnel outgoing interface and described recipient's L2TP Tunnel incoming interface; Set up and total queue of transmission of initialization, when receiving after E-Packeting and being routed to virtual L2TP Tunnel outgoing interface, by local message processing rule to described wait to E-Packet judged, for the message distributing serial numbers that meets the forwarding condition, send into and send total queue, according to QOS, configure, after selecting a certain outgoing interface in multilink, the message of distributing serial numbers is carried out to corresponding L2TP message encapsulation and the L2TP Tunnel by described outgoing interface sends, and described sequence number is encapsulated into the L2TP message; And, after the message information of the deletion sequence that receives described recipient's loopback number, according to each outgoing interface statistical information in QOS configuration and multilink, calculate packet loss; According to the packet loss computation bandwidth, and adjust the transmission rate of QOS and each link according to bandwidth;
Described recipient, for described transmit leg, setting up a virtual L2TP Tunnel, and set up respectively L2TP Tunnel on each link in the multilink between described virtual L2TP Tunnel outgoing interface and described transmit leg L2TP Tunnel incoming interface; Set up and total queue of reception of initialization, when from described virtual L2TP Tunnel incoming interface receives L2TP message decapsulation, message after described decapsulation and sequence number information are sent into to the total queue of reception, the message that will meet number order is forwarded successively, after the message that does not meet number order is waited for to the delay condition arranged, if also do not receive the L2TP message that meets number order, send the message of the Next Sequence number meet number order, and the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described transmit leg.
Further, described transmit leg comprises the first link processing module, the first packet sending and receiving module and bandwidth adjusting module;
The first link assignment module for described recipient, setting up a virtual L2TP Tunnel, and is set up L2TP Tunnel on each link at described virtual L2TP Tunnel outgoing interface place, and the multilink bundle that will the set up L2TP Tunnel line identifier of together going forward side by side;
The first newspaper transceiver module, send total queue initialization for setting up one; When having to after E-Packeting and being routed to virtual L2TP Tunnel outgoing interface, by local message processing rule to described wait to E-Packet judged, for the message distributing serial numbers that meets the forwarding condition, send into and send total queue, according to QOS, configure, after selecting a certain outgoing interface in multilink, the message of distributing serial numbers is carried out to the L2TP Tunnel of corresponding L2TP message encapsulation by described outgoing interface and send, described sequence number is encapsulated into the L2TP message; And after the message information of the deletion sequence of receiving end/sending end loopback number, notice bandwidth adjusting module;
The bandwidth adjusting module, for calculating packet loss according to QOS configuration and each outgoing interface statistical information of multilink; According to the packet loss computation bandwidth, and adjust the transmission rate of QOS and each link according to bandwidth.
Preferably, described recipient comprises the second link assignment module and the second message transceiver module;
The second link assignment module for described transmit leg, setting up a virtual L2TP Tunnel, and is set up L2TP Tunnel on each link at described virtual L2TP Tunnel incoming interface place, and the multilink bundle that will the set up L2TP Tunnel line identifier of together going forward side by side;
The second message transceiver module, for setting up and total queue of reception of initialization, when from described virtual L2TP Tunnel incoming interface receives L2TP message decapsulation, message after described decapsulation and sequence number information are sent into to the total queue of reception, the message that will meet number order is forwarded successively, after the message that does not meet number order is waited for to the delay condition arranged, if also do not receive the L2TP message that meets number order, send the message of the next sequence number that meets number order, and the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described transmit leg.
Preferably, described the first link assignment module, also be applied to for the configuration by described virtual L2TP Tunnel the L2TP Tunnel of setting up respectively on described each link;
Described the second link assignment module, also be applied to for the configuration by described virtual L2TP Tunnel the L2TP Tunnel of setting up respectively on described each link.
Preferably, the delay condition of described setting refers to the sliding window time interval or the message number of setting.
Preferably, described bandwidth adjusting module periodically acts on QOS according to packet loss computation bandwidth its result.
The invention has the beneficial effects as follows, can strengthen link transmission and anti-packet loss ability in order, when certain link disconnects, can be switched to rapidly an other link.The particular service that part is had to packet loss, delay requirement and bandwidth requirement, such as business such as video, voice, by the binding multilink, and dynamically find out the carrier network bandwidth, rationally adjust the transmission rate of each circuit, thereby reach balanced time delay, the purpose of the bandwidth that branches out.
Embodiment
Below in conjunction with the drawings and the specific embodiments, describe technical scheme of the present invention in detail.
Multilink channel message transmission method of the present invention, flow process as shown in Figure 1, comprises step:
A configuration virtual L2TP Tunnel (a kind of Internet tunnel protocol of industrial standard) between S101, transmit leg and recipient, and the address of the virtual L2TP Tunnel outgoing interface of configuration transmit leg and the address of the virtual L2TP Tunnel incoming interface of recipient; Set up respectively L2TP Tunnel on each link in multilink between the virtual L2TP Tunnel outgoing interface of described transmit leg and the virtual L2TP Tunnel incoming interface of described recipient; By the multilink bundle of the setting up L2TP Tunnel line identifier of going forward side by side together.
The configuration in tunnel should indicate 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 sends respectively the message of setting up of L2TP, here recommend adoption L2TP v2 tunnel.In this step, a virtual Layer 2 Tunneling Protocol L2TP Tunnel of configuration between transmit leg and recipient, the configuration of this virtual L2TP is applied to the L2TP Tunnel of setting up respectively on each link in multilink.By ppp negotiation, by the multilink bundling of the having set up L2TP Tunnel line identifier of going forward side by side together.When L2TP Tunnel is consulted, the LCP message of PPP is by carrying the endisc sign, and the recipient, by supporting this characteristic, can bundle two L2TP passages.
S102, set up one for the virtual L2TP Tunnel outgoing interface of described transmit leg and send army unit, set up one for the virtual L2TP Tunnel incoming interface of described recipient and receive total queue, the total queue of the described transmission of initialization and receive total queue.
Virtual L2TP Tunnel interface on transmit leg or recipient, and have the load route between L2TP.Initialize queue in 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, and after message is sent out, can preserves one in the interface transmit queue and send the sliding window interval, can be the time interval or message number.The recipient does not also receive message at the reception sliding window in the time, will send repeat requests.
S103, after wait E-Packeting, arriving the virtual L2TP Tunnel outgoing interface of described transmit leg, transmit leg by local message processing rule to described wait to E-Packet judged, for the message distributing serial numbers that meets the forwarding condition, send into and send total queue, transmit leg configures according to service quality (QOS), after selecting a certain outgoing interface in multilink, the message of distributing serial numbers is carried out to the L2TP Tunnel of corresponding L2TP message encapsulation by described outgoing interface and send, described sequence number is encapsulated in the L2TP message.In this step, after the message wait forwarding arrives transmit leg, be routed to the outgoing interface of virtual L2TP Tunnel, virtual L2TP Tunnel discharge coupling is by the Access Control List (ACL) judgement of setting, the message do not satisfied condition is directly abandoned, and other message distributing serial numbers are also sent into the total queue of transmission.
To sending the serial number assignment of total queue message, according to configuration, need the data message of transmission in order that NS is set >=1 numbering, without the need for the message numbering NS=0 of order transmission.After the message that sends total queue is numbered, according to the QOS configuration, after selecting interface, encapsulate the sequence number of different L2TP heading sign messages; QOS is the QOS on virtual interface, its band width in physical, should be initialized all sub-interface bandwidth or by the bandwidth sum of each sub-interface after calculating under virtual interface, QOS is in scheduling, should send according to the size order of each sub-interface bandwidth, with the roomy interface little message (sequence number not have the situation of reversing) that should preferentially transmit Sequence Number.
Method of the present invention is that the forwarding performance with equipment exchanges the resource of line bandwidth for to carry out the transmission of (even reliable) in order and the increase of bandwidth, the re-transmission of transmitting may consume more device resource, is not therefore that all messages by these links all carry out transmitting.The present invention is arranging access control list and orderly transmission Access Control List (ACL) on this virtual interface, for the message that does not meet the forwarding condition, directly abandons, and other messages enter to send total queue.
The basis that the embodiment of the present invention realizes is orderly message transmission and repeat requests on data link.Realize orderly transmission, at first will carry out mark at the transmitting terminal of link to message, judged the data receiver of link, if there is packet loss, with regard to loopback notice message.This mode is by initial data message encapsulation L2TP head is realized, to this class packet, the L2TP head is still by length bit and sequence bit value 1, and data message just has the sign of length and sequence number like this.Its sequence number rule is as follows:
When 1, L2TP Tunnel is set up, first message that the acquiescence two ends send data is 1, increases successively later;
If 2 receive that the NS of packet is 0, directly forward;
If the NR of 3 packets is 0, mean that the recipient does not also have packet loss;
4, sequence number is from 1-65535, after arriving 65535, again since 1, when needs calculating message is counted, if find that current sequence number is less than the sequence number of last time, just by the rear calculating in current sequence number+65535.No matter transmit leg or recipient require the data buffer storage message number can not be over 65535.
Receive square end to the not transmission of packet loss, ack can not occur and confirmed, a message to packet loss, send the message of the sequence number of NR=loss, this value can be carried in reverse data message, if there is no data message, just sends the data message that length is 0.
S104, after described L2TP message arrives the virtual L2TP Tunnel incoming interface of described recipient decapsulation, message after described decapsulation and sequence number information are sent into to the total queue of reception, the message that the recipient will meet number order is forwarded successively, after the message that does not meet number order is waited for to the delay condition arranged, if also do not receive the L2TP message that meets number order, send the message of the next sequence number meet number order, and the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described transmit leg.
In this step, after message arrives the recipient, the recipient determines whether packet loss according to the sequence number in message.If receive the message of NR ≠ 0, message the inside, just record the packet loss into corresponding sub-interface.Here can select to realize whether carrying out transmitting, to transmitting, can consider to retransmit, even retransmitted from other sub-interface, but sending times should be restricted.The recipient directly forwards orderly message, and the message of disappearance is waited for to 1 sliding window interval, if also do not receive, just continues to forward next orderly message and the message of loopback NR ≠ 0 on corresponding sub-interface.
After the recipient receives message, if sequence number is discontinuous, do not send at once, but wait for regular hour or message number (being generally 1 sliding window interval), if also do not receive message after a sliding window, judge packet loss, the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described transmit leg.
Retransmission operation should be optionally, for upper layer application, has processed the business that packet loss retransmits, and on this class link, perhaps do not expect again to be retransmitted, but this scheme still can calculate the most rational transmission bandwidth, reduces packet loss and out of order.When only having unidirectional message, the message of the transmission NR=0 that the recipient should the cycle, avoid link to disconnect, and sending square end can't perception.When select to realize retransmitting, the transmit leg side receives that NR is not equal to 0 message and should be retransmitted immediately, and re-transmission is alias more, if receive more than 2 times identical NR value and be not equal to 0 message, records packet loss, can no longer retransmit.If receive that NR can't find in current sliding window scope, just abandon this message, and log announcement keeper, thereby may cause too greatly sliding window unreasonable or be subject to network attack due to network delay.Unreal while now retransmitting when selecting, transmit leg is received when NR is not equal to 0 message, is recorded packet loss.
S105, the virtual L2TP Tunnel outgoing interface of described transmit leg calculates packet loss according to each outgoing interface statistical information in QOS configuration and multilink after receiving the message information of deletion sequence number of described recipient's loopback.
When data flow arrives transmit leg, data bandwidth is not known, the transmission of therefore doing the best with the interface bandwidth of acquiescence at the beginning (relevant with the configuration of transmit leg equipment and QoS here, as to suppose that bandwidth is 100Kbps).After packet loss occurring, will receive the message of NR ≠ 0, supposing that the user sets take 5s as one-period, if in one-period, 500 messages have been sent on link, but received that 25 NR are not equal to 0 message, packet loss=25/500=5%, be 100Kbps*(1-5% thereby calculate optimum wideband like this)=95Kbps.So just calculated the wherein bandwidth of a link, profit uses the same method, and can calculate the optimum wideband of other links.
Link, at the beginning a rational packet loss being set, such as 0.5%~1%, when little this packet loss, illustrates that bandwidth can increase, and when being greater than this packet loss, illustrates that bandwidth needs to reduce.Simultaneously a severe bandwidth can also be set, such as 50%, when calculating packet loss and be greater than 50%, with regard to instruction book, by NR, can't calculate rational bandwidth, just directly carry out the bandwidth adjustment of reducing by half here, several so all after dates, just can reach rational bandwidth.
S106, described transmit leg is according to the packet loss computation bandwidth, and adjusts according to bandwidth the QOS that the transmission rate 6 of QOS and each link, sub-interface bandwidth that computation of Period goes out act on interface, and the QOS module is carried out allocated bandwidth again to each sub-interface.
After one-period, after transmit leg has calculated the bandwidth of each link, the available bandwidth that addition must be found out up till now (is noted, this bandwidth may not be current maximum bandwidth, only have when all links all congestion packet loss occurs, the bandwidth of calculating is only current maximum available bandwidth), the data traffic that can send each link is adjusted, the method of adjusting can be done different realizations according to distinct device or business need, carry out the bandwidth adjustment such as adopting method by half, work as exactly link 1 5% packet loss is arranged, and link 2 does not have packet loss, can be increased to link 2 to the flow of 2.5% link 1, continue to do calculating in the next one transmission cycle.When occurring that two links are all during packet loss, the bandwidth calculated is exactly current total bandwidth, and this value can be applicable in the QoS on upper strata.
Below two kinds of situations may affect packet loss:
Configuration
1, if the mid line route is less in MTU, and abandon large message, fire compartment wall perhaps, Access Control List (ACL) artificially is set, NAT, thereby QOS etc. fall to cause the problem (being the soluble packet loss problem of non-re-transmission) of packet loss to packet filtering or conversion, can affect the calculating of link packet drop rate, also can cause a large amount of re-transmissions, thereby affect transfer capability, for solving such problem, when sending, the IP message size is classified, and (as: 1-500 is designated 1, 501-1000 is designated 2, 1001-1500 is designated 3), former and the destination address protocol port that adds the message that encapsulation is front with class indication carries out hash, different hash values is added up to packet loss and retransmission rate, message to continual data package dropout more than 95%, subsequent transmission just no longer enters the queue of transmitting, but directly forward, when this class situation occurs, should record log announcement keeper checks network or distributes rationally.
2, network attack
Network attack may be simulated a large amount of repeat requests messages and out of order message, this class message can be determined unreliable transmit queue after certain hour, when sequence number not in the sliding window scope, just directly abandon such message, and the print log possibility is under attack or time slide window is less than network delay.
Multilink channel message transmission system of the present invention, structure as shown in Figure 2, comprises transmit leg and recipient,
Described transmit leg, for described recipient, setting up a virtual L2TP Tunnel, and set up respectively L2TP Tunnel on each link in the multilink between described virtual L2TP Tunnel outgoing interface and described recipient's L2TP Tunnel incoming interface; Set up and total queue of transmission of initialization, when receiving after E-Packeting and being routed to virtual L2TP Tunnel outgoing interface, by local message processing rule to described wait to E-Packet judged, for the message distributing serial numbers that meets the forwarding condition, send into and send total queue, according to QOS, configure, after selecting a certain outgoing interface in multilink, the message of distributing serial numbers is carried out to the L2TP Tunnel of corresponding L2TP message encapsulation by described outgoing interface and send, described sequence number is encapsulated into the L2TP message; And, after the message information of the deletion sequence that receives described recipient's loopback number, according to each outgoing interface statistical information in QOS configuration and multilink, calculate packet loss; According to the packet loss computation bandwidth, and adjust the transmission rate of QOS and each link according to bandwidth;
Described recipient, for described transmit leg, setting up a virtual L2TP Tunnel, and set up respectively L2TP Tunnel on each link in the multilink between described virtual L2TP Tunnel outgoing interface and described transmit leg L2TP Tunnel incoming interface; Set up and total queue of reception of initialization, when from described virtual L2TP Tunnel incoming interface receives L2TP message decapsulation, message after described decapsulation and sequence number information are sent into to the total queue of reception, the message that will meet number order is forwarded successively, after the message that does not meet number order is waited for to the delay condition arranged, if also do not receive the L2TP message that meets number order, send the message of the Next Sequence number meet number order, and the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described transmit leg.
Referring to Fig. 3, transmit leg comprises the first link processing module 301, the first packet sending and receiving module 302 and bandwidth adjusting module 303;
The first link assignment module 301, for with described recipient, setting up a virtual L2TP Tunnel, and set up L2TP Tunnel on each link at described virtual L2TP Tunnel outgoing interface place, and the multilink bundle that will the set up L2TP Tunnel line identifier of together going forward side by side;
The first newspaper transceiver module 302, send total queue initialization for setting up one; When having to after E-Packeting and being routed to virtual L2TP Tunnel outgoing interface, by local message processing rule to described wait to E-Packet judged, for the message distributing serial numbers that meets the forwarding condition, send into and send total queue, according to QOS, configure, after selecting a certain outgoing interface in multilink, the message of distributing serial numbers is carried out to the L2TP Tunnel of corresponding L2TP message encapsulation by described outgoing interface and send, described sequence number is encapsulated into the L2TP message; And after the message information of the deletion sequence that receives the transmit leg loopback number, notice bandwidth adjusting module;
Bandwidth adjusting module 303, for calculating packet loss according to QOS configuration and each outgoing interface statistical information of multilink; According to the packet loss computation bandwidth, and adjust the transmission rate of QOS and each link according to bandwidth.
The first link assignment module 301 and the second link module 401, for set up L2TP V2 tunnel on each link, by ppp negotiation, by the multilink bundling of the having set up tunnel line identifier of going forward side by side together.Initialization sliding window size.The sliding window size means with the time interval and message number.
The first packet sending and receiving module 302, for setting up and total queue of transmission of initialization.After message arrives transmit leg, be routed to virtual interface, virtual interface judges by Access Control List (ACL), to meeting the regular message of forwarding, does not directly abandon, other messages enter to send total queue.To sending the message distributing serial numbers of total queue, according to configuration, need the data message of transmission in order to carry out NS >=1 numbering, without the need for the message numbering NS=0 of order transmission.According to the QOS configuration, after selecting interface, encapsulate the sequence number of different L2TP headings with the sign message.
Bandwidth adjusting module 303 is periodically according to the packet loss computation bandwidth, and adjusts the transmission rate of each link according to bandwidth.If transmit leg is received one section continuous packet loss, just think the link single-pass, disconnecting link; If a period of time is not received any message, just think that link is obstructed, disconnecting link; When link sends without message for a long time, just periodically send the data message that length is 0; When needs can send NR information, do not have message to send, just send the data message that message length is 0.
Referring to Fig. 4, the recipient comprises the second link assignment module 401 and the second message transceiver module 402;
The second link assignment module 401 for described transmit leg, setting up a virtual L2TP Tunnel, and is set up L2TP Tunnel on each link at described virtual L2TP Tunnel incoming interface place, and the multilink bundle that will the set up L2TP Tunnel line identifier of together going forward side by side.
The second message transceiver module 402, for setting up and total queue of reception of initialization, when from described virtual L2TP Tunnel incoming interface receives L2TP message decapsulation, message after described decapsulation and sequence number information are sent into to the total queue of reception, the message that will meet number order is forwarded successively, after the message that does not meet number order is waited for to the delay condition arranged, if also do not receive the L2TP message that meets number order, send the message of the next sequence number that meets number order, and the message information of loopback deletion sequence number is to the virtual L2TP Tunnel outgoing interface of described transmit leg.
The second message transceiver module 402, after arriving the recipient for message, determine whether packet loss according to sequence number; Orderly message is directly forwarded, the message of disappearance is waited for to 1 sliding window interval, if also do not receive, just continue the next message of forwarding and loopback and carry the message of corresponding NR information to transmit leg.
In the present invention program, transmit leg, according to load configuration, after selecting the outgoing interface of multilink, encapsulates different L2TP headings; Calculate port band width according to packet loss, and adjust the transmission rate of each link or QOS is carried out to Dynamic parameter adjustment according to bandwidth.