Summary of the invention
Main purpose of the present invention is to provide a kind of NAT device, NAPT equipment and TCP to use the processing method and the treatment system of drainage, can't realize that to solve TCP uses the problem of drainage under NAT or NAPT pattern.
To achieve these goals, according to an aspect of the present invention, provide a kind of TCP to use the processing method of drainage.
The processing method of using drainage according to TCP of the present invention comprises: NAT device is after receiving first message; TCP load in first message is discerned; And according to application type that identifies and the routing again of purpose IP address; Confirm the outgoing interface of correspondence when TCP uses by drainage, wherein, first message is the message with TCP load that client is sent to server via NAT device; NAT device carries out network address translation, and wherein, the source IP address after the conversion is the IP address of TCP corresponding outgoing interface when using by drainage; NAT device and server handshaking, wherein, the source IP address of handshake message is the source IP address after changing; And NAT device sends first message to server.
Further, first message be user end to server send first have the message of TCP load.
Further, NAT device and server handshaking comprise: NAT device sends the SYN signal to server; Server returns the SYN-ACK signal to NAT device; And NAT device sends ack signal to server.
Further; After server sent first message, this method also comprised at NAT device: NAT device is after receiving second message, and NAT device carries out network address translation and TCP sequence number conversion; Wherein, second message is the message that client is sent to server via NAT device; And NAT device is after receiving the 3rd message, and NAT device carries out the TCP sequence number conversion, and wherein, the 3rd message is the message that server sends to client via NAT device.
To achieve these goals, according to an aspect of the present invention, provide another kind of TCP to use the processing method of drainage.
The processing method of using drainage according to TCP of the present invention comprises: NAPT equipment is after receiving first message; Identification is used in TCP load in first message; And according to application type that identifies and the routing again of purpose IP address; Confirm the outgoing interface of correspondence when TCP uses by drainage, wherein, first message is the message with TCP load that client is sent via the NAPT device-to-server; NAPT equipment carries out the network address and port translation, and wherein, the source IP address after the conversion is the IP address of TCP corresponding outgoing interface when using by drainage, and the port numbers after the conversion is the port numbers of NAPT equipment dynamic assignment; NAPT equipment and server handshaking, wherein, the source IP address of handshake message is the source IP address after changing, the source port number of handshake message is the source port number after changing; And the NAPT device-to-server sends first message.
Further; After the NAPT device-to-server sends first message; This method also comprises: NAPT equipment is after receiving second message; NAPT equipment carries out the network address, port translation and TCP sequence number conversion, and wherein, second message is the message that client is sent via the NAPT device-to-server; And NAPT equipment is after receiving the 3rd message, and NAPT equipment carries out the TCP sequence number conversion, and wherein, the 3rd message is the message that server sends to client via NAPT equipment.
To achieve these goals, according to an aspect of the present invention, a kind of NAT device is provided.
NAT device according to the present invention comprises: receiver module, be used to receive first message, and wherein, first message is the message with TCP load that client is sent to server via NAT device; Application recognition module is used for discerning the application type of the first message TCP load; Use the drainage module, be used for, confirm the outgoing interface of correspondence when TCP uses by drainage according to the application type and the routing again of purpose IP address that identify; The IP modular converter is used to carry out network address translation, and wherein, the source IP address after the conversion is the IP address of TCP corresponding outgoing interface when using by drainage; Handshake module is used for and server handshaking, and wherein, the source IP address of handshake message is the source IP address after changing; And sending module, be used for sending first message to server.
To achieve these goals, according to an aspect of the present invention, a kind of NAPT equipment is provided.
NAPT equipment according to the present invention comprises: receiver module, be used to receive first message, and wherein, first message is the message with TCP load that client is sent via the NAPT device-to-server; Application recognition module is used for discerning the application type of the first message TCP load; Use the drainage module, be used for according to identify application type and the routing again of purpose IP address, the outgoing interface of correspondence when confirming that TCP uses by drainage; IP and port translation module are used to carry out the network address and port translation, and wherein, the source IP address after the conversion is the IP address of TCP corresponding outgoing interface when using by drainage, and the port numbers after the conversion is the port numbers of NAPT equipment dynamic assignment; Handshake module is used for and server handshaking, and wherein, the source IP address of handshake message is the source IP address after changing, and the source port number of handshake message is the source port number after changing; And sending module, be used for sending first message to server.
To achieve these goals, according to an aspect of the present invention, provide a kind of TCP to use the treatment system of drainage.
The treatment system of using drainage according to TCP of the present invention comprises: client, NAT device and server, and wherein, client is used for sending first message via NAT device to server, and wherein, first message is the message with TCP load; NAT device is used for after receiving first message, and identification is used in TCP load in first message, and according to application type that identifies and the routing again of purpose IP address, the outgoing interface of correspondence when using by drainage with definite TCP; NAT device also is used to carry out network address translation, and and server handshaking, wherein, the source IP address after the conversion is the IP address of TCP corresponding outgoing interface when using by drainage, the source IP address of the source IP address of handshake message after for conversion; NAT device also be used for server handshaking after, send first message to server; And after server is used for shaking hands with NAT device, receive first message.
To achieve these goals, according to an aspect of the present invention, provide another kind of TCP to use the treatment system of drainage.
The treatment system of using drainage according to TCP of the present invention comprises: client, NAPT equipment and server, and wherein, client is used for sending first message via the NAPT device-to-server, and wherein, first message is the message with TCP load; NAPT equipment is used for after receiving first message, and identification is used in TCP load in first message, and according to application type that identifies and the routing again of purpose IP address, the outgoing interface of correspondence when using by drainage with definite TCP; NAPT equipment also is used to carry out the network address and port translation; And and server handshaking; Wherein, the source IP address after the conversion is the IP address of TCP corresponding outgoing interface when using by drainage, and the source port number after the conversion is the port numbers of NAPT equipment dynamic assignment; The source IP address of handshake message is the source IP address after changing, and the source port number of handshake message is the source port number after changing; NAPT equipment also be used for server handshaking after, send first message to server; And after server is used for shaking hands with NAPT equipment, receive first message.
Through the present invention, adopt the TCP that may further comprise the steps to use the processing method of drainage: NAT device is receiving the message with TCP load that user end to server sends, after using identification and discerning routing again based on application; Be not sent to server after directly this message not being done network address translation, but on NAT device again with server handshaking, also promptly rebulid TCP and connect; And then this message with TCP load sent to server, wherein, NAT device is when carrying out network address translation; Source IP address after the conversion is the IP address of TCP corresponding outgoing interface when using by drainage; Can realize under the NAT pattern that TCP uses drainage, it is similar with the processing method of TCP application drainage under the NAT pattern to use the processing method of drainage at the TCP under the NAPT pattern, thereby; Through thought of the present invention; Can realize that also the TCP under the NAPT pattern uses drainage, thereby can help enterprise, operator effectively to utilize bandwidth resources, guarantee the service quality of important application; Solved and to have realized that under NAT or NAPT pattern TCP uses the problem of drainage, and then realized that TCP uses drainage under NAT and the NAPT pattern.
Embodiment
Need to prove that under the situation of not conflicting, embodiment and the characteristic among the embodiment among the application can make up each other.Below with reference to accompanying drawing and combine embodiment to specify the present invention.
Fig. 2 is a treatment system of using drainage according to the TCP of first embodiment of the invention; As shown in Figure 2; This treatment system comprises client 10, NAT device 30 and server 50, and three's reciprocal process is as shown in Figure 3, and client 10 has Intranet IP address C.IP; When access server 50, need NAT device to carry out the conversion of Intranet IP address to public network IP address; Wherein, the outgoing interface that public network is corresponding is e1 and e2, and the sequence of message table of the TCP reciprocal process of client 10 and server 50 is shown in the following table II.
Table II NAT sequence of message table
Wherein, client 10 is at first sent handshake SYN to server 50, wherein; When NAT device 30 carried out network address translation, the source IP address before the conversion was client Intranet IP address C.IP, the IP address e1.IP of the outgoing interface e1 of acquiescence when the source IP address after the conversion is client 10 access servers 50; Also promptly, the source IP address of this time handshake message is e1.IP, and server 50 returns client 10 answer signal SYN-ACK then; After client 10 receives answer signal SYN-ACK, to server 50 with the ACK message response, so far; Client 10 is set up TCP with server 50 and is connected, and client 10 can be via the outgoing interface e1 access server 50 of acquiescence.
In order to guarantee critical services such as normal web page browsing, mail, DNS; Can drainage be carried out in P2P class, application that this type of WEB video class occupied bandwidth is bigger; Drainage to another outgoing interface is e2; And the outgoing interface e1 of acquiescence is walked in other application, thereby guarantees that e1 goes up the application bandwidth-hogging that important application does not receive P2P class, WEB video class.
When client 10 is sent when having the message of load to server 50, as shown in Figure 3, be example with client 10 to first PUSH message that server 50 sends with load; NAT device 30 is when receiving the PUSH message; Directly PUSH is not sent to server 50, but TCP load in the PUSH message is discerned, determine whether that according to application type that identifies and purpose IP address needs are by drainage; When the TCP load is P2P class, the application of WEB video class; Confirm this TCP application need by drainage, then routing again confirms that the outgoing interface of correspondence was e2 when TCP used by drainage.
At this moment; When NAT device carried out network address translation, the source IP address before the conversion was client Intranet IP address C.IP, and the source IP address after the conversion is the IP address e2.IP of outgoing interface e2; In order to prevent to change owing to source IP; Server 50 link that resets, NAT device 30 is shaken hands with server 50, rebulids TCP and connects.Particularly, NAT device 30 sends handshake SYN to server 50, and the source IP address of this time handshake message is e2.IP; Server 50 returns NAT device 30 answer signal SYN-ACK then, after NAT device 30 receives answer signal SYN-ACK, to server 50 with the ACK message response; So far, NAT device 30 is set up new TCP with server 50 and is connected, and client 10 can be via outgoing interface e2 access server 50; Also be; To outgoing interface e2, NAT device 30 sends to server 50 with the PUSH message after shaking hands again with server 50 with the application drainage of P2P class, WEB video class.
Follow-up client 10 and the message between the server 50 except doing the conversion of IP address, are also done the TCP sequence alternation of signs.But just being connected between maintain customer end 10 and the server 50; Wherein, As above show shown in the II; The TCP sequence number difference of the message on client 10 to server 50 directions is NAT.Seq-C.Seq, and the TCP sequence number difference of the message on server 50 to client 10 directions is S.Seq2-S.Seq1.
The TCP that adopts this embodiment to provide uses the treatment system of drainage, can realize that TCP uses drainage under the NAT pattern, thereby can help enterprise, operator effectively to utilize bandwidth resources, guarantees the service quality of important application.
Fig. 4 is a treatment system of using drainage according to the TCP of second embodiment of the invention, and as shown in Figure 4, this treatment system comprises client 20, NAPT equipment 40 and server 60.
Client 20 is used for sending first message via NAPT equipment 40 to server 60, and wherein, first message is the message with TCP load; NAPT equipment 40 is used for after receiving first message, TCP load in first message is discerned, and according to application type that identifies and the routing again of purpose IP address, confirmed the outgoing interface of correspondence when TCP uses by drainage; NAPT equipment 40 also is used to carry out the network address and port translation; And shake hands with server 60; Wherein, the source IP address after the conversion is the IP address of TCP corresponding outgoing interface when using by drainage, and the source port number after the conversion is the port numbers of NAPT equipment dynamic assignment; The source IP address of handshake message is the source IP address after changing, and the source port number of handshake message is the source port number after changing; NAPT equipment 40 sends first message to server after also being used for shaking hands with server 60; And after server 60 is used for shaking hands with NAPT equipment 40, receive first message, wherein, the message interaction process between client 20 and the server 60 is shown in the table III.
Table III NAPT sequence of message table
Wherein, client 20 is at first sent handshake SYN to server 60, wherein; When NAPT equipment 40 carried out the network address and port translation, the source IP address before the conversion was client Intranet IP address C.IP, and the tcp source port before the conversion is the port C.Port1 that client 20 is distributed; The IP address e1.IP of the outgoing interface e1 of acquiescence when the source IP address after the conversion is client 20 access servers 60, the source port after the conversion is a port of NAPT equipment dynamic assignment, also is; The source IP address of this time handshake message is e1.IP; Source port is NAPT.Port1, and server 60 returns client 20 answer signal SYN-ACK then, after client 20 receives answer signal SYN-ACK; To server 60 with the ACK message response; So far, client 20 is set up TCP with server 60 and is connected, and client 20 can be via the outgoing interface e1 access server 60 of acquiescence.
In order to guarantee critical services such as normal web page browsing, mail, DNS; Can drainage be carried out in P2P class, application that this type of WEB video class occupied bandwidth is bigger; Drainage to another outgoing interface is e2; And the outgoing interface e1 of acquiescence is walked in other application, thereby guarantees that e1 goes up the application bandwidth-hogging that important application does not receive P2P class, WEB video class.
When client 20 is sent when having the message of load to server 60, as shown in Figure 5, be example with client 20 to first PUSH message that server 60 sends with load; NAPT equipment 40 is when receiving the PUSH message; Directly PUSH is not sent to server 60, but TCP load in the PUSH message is discerned, determine whether that according to application type that identifies and purpose IP address needs are by drainage; When the TCP load is P2P class, the application of WEB video class; Confirm this TCP application need by drainage, then routing again confirms that the outgoing interface of correspondence was e2 when TCP used by drainage.
At this moment, when NAPT equipment carried out network address translation and port translation, the source IP address before the conversion was client Intranet IP address C.IP; Source IP address after the conversion is the IP address e2.IP of outgoing interface e2, and the tcp source port before the conversion is the port C.Port1 that client computer is distributed, and the source port after the conversion is the port NAPT.Port1 of NAPT equipment dynamic assignment; In order to prevent to change owing to source IP; Server 60 link that resets, NAPT equipment 40 is shaken hands with server 60, rebulids TCP and connects.Particularly, NAPT equipment 40 sends handshake SYN to server 60, and the source IP address of this time handshake message is e2.IP; Server 60 returns NAPT equipment 40 answer signal SYN-ACK then, after NAPT equipment 40 receives answer signal SYN-ACK, to server 60 with the ACK message response; So far, NAPT equipment 40 is set up new TCP with server 60 and is connected, and client 20 can be via outgoing interface e2 access server 60; Also be; To outgoing interface e2, NAPT equipment 40 sends to server 60 with the PUSH message after shaking hands again with server 60 with the application drainage of P2P class, WEB video class.
Follow-up client 20 and the message between the server 60; Except doing the conversion of IP address, tcp port, also do the TCP sequence alternation of signs, but just being connected between maintain customer end 20 and the server 60; Wherein, As above show shown in the III, the TCP sequence number difference of the message on client 20 to server 60 directions is NAPT.Seq-C.Seq, and the TCP sequence number difference of the message on server 60 to client 20 directions is S.Seq2-S.Seq1.
The TCP that adopts this embodiment to provide uses the treatment system of drainage, can realize that TCP uses drainage under the NAPT pattern, thereby can help enterprise, operator effectively to utilize bandwidth resources, guarantees the service quality of important application.
Fig. 6 is the block diagram according to the NAT device of the embodiment of the invention, and is as shown in Figure 6, and this NAT device comprises receiver module 31, application recognition module 32, uses drainage module 33, IP modular converter 34, handshake module 35 and sending module 36.
In the TCP of client and server reciprocal process, in order to guarantee critical services such as normal web page browsing, mail, DNS, when part TCP application need during by drainage, the concrete course of work of above-mentioned each module is following:
Receiver module 31 receive client via NAT device to server send have first message of TCP load the time; The application type of TCP load in application recognition module 22 identifications first message; To confirm whether the application in the load need be by drainage; When the TCP load is P2P class, the application of WEB video class, confirm that this TCP application need is by drainage.Use drainage module 33 according to information routings again such as application type of confirming and purpose IP addresses; Confirm the outgoing interface of correspondence when TCP uses by drainage; IP modular converter 34 bases confirm by drainage the time corresponding outgoing interface carry out network address translation; Wherein, the source IP address after the conversion is the IP address of TCP corresponding outgoing interface when using by drainage.In order to prevent because source IP changes the server link that resets, handshake module 35 and server handshaking; Wherein, The source IP address of the source IP address of handshake message after for conversion, after then NAT device and server were set up new TCP and be connected, sending module 36 sent to server with first message.
Follow-up client 10 and the message between the server 50 are also done the TCP sequence alternation of signs except doing the conversion of IP address, but just being connected between maintain customer end 10 and the server 50.
The NAT device that adopts this embodiment to provide can be realized that TCP uses drainage under the NAT pattern, thereby can help enterprise, operator effectively to utilize bandwidth resources, guarantees the service quality of important application.
Preferably; Service quality for the real-time ensuring important application; First message be user end to server send first have the message of load since client initiate first have the message information amount of TCP load very big, but thereby accurate recognition to by the outgoing interface of drainage.
Adopt the NAT device of this embodiment, can be applicable in the network system as shown in Figure 7.As shown in Figure 7, PC1, PC2, PC3 ... Be the PC of corporate intranet, have Intranet IP address.Gateway has two WAN mouth: e0 and e1.Gateway is NAT simultaneously except doing basic access control.In order to guarantee critical services such as normal web page browsing, mail, DNS; Can P2P class, the bigger application of this type of Web video class occupied bandwidth be drained on the e0; And other uses away acquiescence except that interface e1, thereby the important application on the assurance e1 does not receive the application bandwidth-hogging of P2P, Web video class.
Fig. 8 is the block diagram according to the NAPT equipment of the embodiment of the invention, and is as shown in Figure 8, and this NAPT equipment comprises receiver module 41, application recognition module 42, uses drainage module 43, IP and port translation module 44, handshake module 45 and sending module 46.
In the TCP of client and server reciprocal process, in order to guarantee critical services such as normal web page browsing, mail, DNS, when part TCP application need during by drainage, the concrete course of work of above-mentioned each module is following:
Receiver module 41 receive client via the NAPT device-to-server send have first message of TCP load the time; The application type of TCP load in application recognition module 42 identifications first message; To confirm whether the application in the load need be by drainage; When the TCP load is P2P class, the application of WEB video class, confirm that this TCP application need is by drainage.Use drainage module 43 according to the application type and the routing again of purpose IP address that identify; Corresponding port when confirming the TCP application by drainage; IP and port translation module 44 bases confirm by drainage the time corresponding port carry out the IP address transition, carry out port translation according to the port numbers of NAPT equipment dynamic assignment, wherein; Source IP address after the conversion is the IP address of TCP corresponding outgoing interface when using by drainage, and the port numbers after the conversion is the port numbers of NAPT equipment dynamic assignment.In order to prevent to change owing to source port; The server link that resets, handshake module 45 and server handshaking, wherein; The source IP address of handshake message is the source IP address after changing; The port numbers of the source port of handshake message after for conversion, after then NAPT equipment and server were set up new TCP and be connected, sending module 36 sent to server with first message.
Follow-up client 10 and the message between the server 50 are also done the TCP sequence alternation of signs except doing the conversion of port numbers, but just being connected between maintain customer end 10 and the server 50.
The NAPT equipment that adopts this embodiment to provide can be realized that TCP uses drainage under the NAPT pattern, thereby can help enterprise, operator effectively to utilize bandwidth resources, guarantees the service quality of important application.
Preferably, for the service quality of real-time ensuring important application, first message be user end to server send first have the message of load.
Fig. 9 is a processing method of using drainage according to the TCP of first embodiment of the invention, and as shown in Figure 9, this method comprises that following step S102 is to step S108.
Step S102:NAT equipment is after receiving first message; The outgoing interface of correspondence when confirming that according to the application type of TCP load in first message TCP uses by drainage; Wherein, first message is a client via NAT device to the message with TCP load that server sends, and can preestablish different TCP and use the different outgoing interface that is cited; Particularly; Identification is used in TCP load in first message, and, confirm the outgoing interface of correspondence when TCP uses by drainage according to application type that identifies and the routing again of purpose IP address.
Step S104:NAT equipment carries out network address translation, and wherein, the source IP address after the conversion is the IP address of TCP corresponding outgoing interface when using by drainage.
Step S106:NAT equipment and server handshaking, wherein, the source IP address of handshake message makes NAT device and server set up new TCP is connected that for the source IP address after changing the IP address after the conversion obtains the trust of server.
Step S108:NAT device-to-server sends first message and since this moment first message source IP address be the IP address of server trust, through shaking hands, so server can not send the message that resets and resets.
The TCP that adopts this embodiment to provide uses the processing method of drainage, can realize that TCP uses drainage under the NAT pattern, thereby can help enterprise, operator effectively to utilize bandwidth resources, guarantees the service quality of important application.
Preferably, for the service quality of real-time ensuring important application, first message be user end to server send first have the message of TCP load.
Preferably, the step of NAT device and server handshaking comprises: NAT device sends the SYN signal to server; Server returns the SYN-ACK signal to NAT device; And NAT device sends ack signal to server.
Preferably; For normal TCP between maintenance server and the client communicates by letter; After server sent first message, behind the message that server sends, NAT device carried out network address translation and TCP sequence number conversion to NAT device reception client via NAT device at NAT device; NAT device receive server via NAT device behind the message that client is sent, NAT device carries out the TCP sequence number conversion.
Figure 10 is a processing method of using drainage according to the TCP of second embodiment of the invention, and shown in figure 10, this method comprises that following step S202 is to step S208.
Step S202:NAPT equipment is after receiving first message; The outgoing interface of correspondence when confirming that according to the application type of TCP load in first message TCP uses by drainage; Wherein, first message is the message with TCP load of client via the transmission of NAPT device-to-server, can preestablish different TCP and use the different port that is cited; Particularly; Identification is used in TCP load in first message, and according to application type that identifies and the routing again of purpose IP address, the outgoing interface of correspondence when using by drainage with definite TCP.
Step S204:NAPT equipment carries out the network address and port translation, and wherein, the source IP address after the conversion is the IP address of TCP corresponding outgoing interface when using by drainage, and the source port number after the conversion is the port numbers of NAPT equipment dynamic assignment.
Step S206:NAPT equipment and server handshaking; Wherein, the source IP address of handshake message is the source IP address after changing, and the source port number of handshake message is the port numbers after changing; Make NAPT equipment and server set up new TCP and be connected that the port numbers after the conversion obtains the trust of server.
Step S208:NAPT device-to-server sends first message and since this moment first message source IP address and the port numbers that source port number is server trust, pass through and shake hands, so server can not send the message that resets and resets.
The TCP that adopts this embodiment to provide uses the processing method of drainage, can realize that TCP uses drainage under the NAPT pattern, thereby can help enterprise, operator effectively to utilize bandwidth resources, guarantees the service quality of important application.
Preferably, for the service quality of real-time ensuring important application, first message be user end to server send first have the message of TCP load.
Preferably; For normal TCP between maintenance server and the client communicates by letter; After the NAPT device-to-server sent first message, after NAPT equipment received the message of client via the transmission of NAPT device-to-server, NAT device carried out the network address, port translation and TCP sequence number conversion; NAPT equipment receive server via NAPT equipment behind the message that client is sent, NAPT equipment carries out the TCP sequence number conversion.
From above description; Can find out; The present invention has realized following technique effect: can realize that TCP uses drainage under the NAT/NAPT pattern; Thereby can help enterprise, operator effectively to utilize bandwidth resources, guarantee the service quality of important application, solve and to have realized that under NAT or NAPT pattern TCP uses the problem of drainage.
Need to prove; Can in computer system, carry out in the step shown in the flow chart of accompanying drawing such as a set of computer-executable instructions; And; Though logical order has been shown in flow chart, in some cases, can have carried out step shown or that describe with the order that is different from here.
Obviously, it is apparent to those skilled in the art that above-mentioned each module of the present invention or each step can realize with the general calculation device; They can concentrate on the single calculation element; Perhaps be distributed on the network that a plurality of calculation element forms, alternatively, they can be realized with the executable program code of calculation element; Thereby; Can they be stored in the storage device and carry out, perhaps they are made into each integrated circuit modules respectively, perhaps a plurality of modules in them or step are made into the single integrated circuit module and realize by calculation element.Like this, the present invention is not restricted to any specific hardware and software combination.
The above is merely the preferred embodiments of the present invention, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.All within spirit of the present invention and principle, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.