The system and method that asymmetric NAT carries out P2P communication is passed through between intelligent router
Technical field
The present invention relates to the technical field of router, particularly relate to and to pass through asymmetric NAT between a kind of intelligent router and carry out the system and method that point-to-point (PointtoPoint, P2P) communicate.
Background technology
The terminal equipment relevant along with router gets more and more, and the distribution of public network IP address will become relatively exhausted, and the equipment simultaneously with public network IP address also becomes fewer and feweri.In order to solve the inadequate problem of public network IP address, network address translation (NetworkAddressTranslation, NAT) technology is arisen at the historic moment, and it has all played machine and important effect thereof in alleviation IPv4 address problem in short supply and guarantee network security etc.But the extensive existence of NAT device type is but to the main frame on Internet, and the main frame be particularly in different Intranet carries out P2P communication and brings obstacle, limits the application of P2P.
The main cause of carrying out P2P communication between NAT obstruction main frame is: NAT does not allow public network main frame initiatively to access intranet host, this make main frame Internet with public network IP address initiatively can not access NAT after main frame, and cannot mutually identify especially between main frame after being positioned at different N AT, thus can not direct exchange message.And in actual use, a lot of routers does not have public network IP address, and after most of router is all present in NAT.
The router of intelligent router i.e. intelligent management, usually there is independently operating system, by user, various application can be installed voluntarily, control bandwidth voluntarily, control online number voluntarily, control browsing page voluntarily, control line duration voluntarily, have powerful USB sharing functionality simultaneously, really accomplish the intelligent management of network and equipment.
In today that intelligent router is more and more ripe, such as, when checking at far-end the family's monitor video stored by router in family by mobile phone, if the public network IP address of home intelligent router do not known by mobile phone, also just family's monitor video cannot be had access to.
Therefore, need the public network IP address being obtained peer by a kind of negotiation mechanism, can the direct public network IP address of access router after going out NAT by mobile phone to make, thus have access to router.
Summary of the invention
The shortcoming of prior art in view of the above, the object of the present invention is to provide between a kind of intelligent router and pass through the system and method that asymmetric NAT carries out P2P communication, the communication can being undertaken between two routers by a signaling negotiation server between two routers making all to be in asymmetric NAT type.
For achieving the above object and other relevant objects, the invention provides between a kind of intelligent router and pass through the system that asymmetric NAT carries out P2P communication, comprise two intelligent routers and signaling negotiation server; Described intelligent router comprises heartbeat client modules and scheduling request module; Described heartbeat client modules is for reporting the public network IP address of current intelligent router; Described scheduling request module for sending public network IP request to obtain the public network IP address of opposite end, and sends connection request to opposite end by the public network IP address of the opposite end obtained; And receive the scheduling request that will carry out with it communicating to connect in opposite end; Described signaling negotiation server comprises heartbeat server module, public network IP database module and signaling negotiation module; The public network IP address of the intelligent router that described heartbeat server module is sent for the heartbeat client modules receiving intelligent router; Described public network IP database module is connected with described heartbeat server module, for storing the public network IP address that heartbeat server module obtains; Described signaling negotiation module is connected with described public network IP database module, for the public network IP request that the scheduling request module responding the first intelligent router is sent, the concurrent scheduling request module sending scheduling request to the second intelligent router, informs that the first intelligent router will communicate to connect with it.
Meanwhile, the present invention also provides between a kind of intelligent router and passes through the method that asymmetric NAT carries out P2P communication, comprises the following steps:
The public network IP address of step S11, signaling negotiation collects first intelligent router and the second intelligent router;
The public network IP address of step S12, signaling negotiation server stores first intelligent router and the second intelligent router;
Step S13, signaling negotiation server receive the public network IP request that the first intelligent router sends, and described public network IP request is used for the public network IP address of acquisition request second intelligent router;
Step S14, signaling negotiation server send the public network IP address of the second intelligent router to the first intelligent router, make the first intelligent router according to the public network IP address of the second intelligent router obtained, initiate connection request to the second intelligent router; Send scheduling request to the second intelligent router simultaneously, inform that the first intelligent router will establish a communications link with it, make the second intelligent router obtain the public network IP address of the first intelligent router, and initiate connection request to the first intelligent router.
According to passing through the method that asymmetric NAT carries out P2P communication between above-mentioned intelligent router, wherein: in described step S11, the public network IP address of each intelligent router of signaling negotiation server by each heartbeat client modules of the heartbeat server module collection on it is offered.
According to passing through the method that asymmetric NAT carries out P2P communication between above-mentioned intelligent router, wherein: in described step S12, signaling negotiation server stores the public network IP address of the first intelligent router and the second intelligent router by the public network IP database module on it.
According to passing through the method that asymmetric NAT carries out P2P communication between above-mentioned intelligent router, wherein: in described step S13, the signaling negotiation server public network IP request of being sent by the scheduling request module that the signaling negotiation module on it receives the first intelligent router.
According to passing through the method that asymmetric NAT carries out P2P communication between above-mentioned intelligent router, wherein: in described step S14, signaling negotiation server sends the public network IP address of the second intelligent router to the first intelligent router by the signaling negotiation module on it; Scheduling request to the second intelligent router is sent by the signaling negotiation module on it.
In addition, the present invention also provides between a kind of intelligent router and passes through the method that asymmetric NAT carries out P2P communication, comprises the following steps:
Step S21, the first intelligent router and the second intelligent router report the public network IP address of self to signaling negotiation server, so that signaling negotiation server stores;
Step S22, the first intelligent router send public network IP request to obtain the public network IP address of the second intelligent router to signaling negotiation server;
Step S23, the first intelligent router receive the public network IP address of the second intelligent router that signaling negotiation server sends, and initiate connection request to the second intelligent router; The scheduling request that the first intelligent router that second intelligent router reception signaling negotiation server sends will establish a communications link with it, obtains the public network IP address of the first intelligent router, and initiates connection request to the first intelligent router.
According to passing through the method that asymmetric NAT carries out P2P communication between above-mentioned intelligent router, wherein: in described step S21, intelligent router reports the public network IP address of self to signaling negotiation server by the heartbeat client modules on it.
According to passing through the method that asymmetric NAT carries out P2P communication between above-mentioned intelligent router, wherein: in described step S22, the first intelligent router is by the signaling negotiation module transmission public network IP request of the scheduling request module on it to signaling negotiation server.
According to passing through the method that asymmetric NAT carries out P2P communication between above-mentioned intelligent router, wherein: in described step S23, first intelligent router receives the public network IP address of the second intelligent router that signaling negotiation server sends by the scheduling request module on it, and initiates connection request to the second intelligent router; The scheduling request that second intelligent router is sent by the signaling receiver module reception signaling negotiation server on it.
As mentioned above, pass through the system and method that asymmetric NAT carries out P2P communication between intelligent router of the present invention, there is following beneficial effect:
(1) by introducing signaling negotiation server, the intelligent router making to be under different N AT can find the public network IP address of the other side's intelligent router after NAT, then pass through the public network IP address after the NAT of access the other side intelligent router, set up the connection communication of the P2P between two intelligent routers;
(2) be applicable to burrow based on the NAT of UDP/TCP pass through negotiation.
Accompanying drawing explanation
Fig. 1 is shown as between intelligent router of the present invention and passes through the system configuration schematic diagram that asymmetric NAT carries out P2P communication;
Fig. 2 is shown as between intelligent router of the present invention and passes through the systematic difference scene schematic diagram that asymmetric NAT carries out P2P communication;
Fig. 3 is shown as between intelligent router of the present invention and passes through the flow chart that asymmetric NAT carries out the method for P2P communication.
Element numbers explanation
1 intelligent router
11 heartbeat client modules
12 scheduling request modules
2 signaling negotiation servers
21 heartbeat server modules
22 public network IP database module
23 signaling negotiation modules
Embodiment
Below by way of specific instantiation, embodiments of the present invention are described, those skilled in the art the content disclosed by this specification can understand other advantages of the present invention and effect easily.The present invention can also be implemented or be applied by embodiments different in addition, and the every details in this specification also can based on different viewpoints and application, carries out various modification or change not deviating under spirit of the present invention.
It should be noted that, the diagram provided in the present embodiment only illustrates basic conception of the present invention in a schematic way, then only the assembly relevant with the present invention is shown in graphic but not component count, shape and size when implementing according to reality is drawn, it is actual when implementing, and the kenel of each assembly, quantity and ratio can be a kind of change arbitrarily, and its assembly layout kenel also may be more complicated.
Pass through asymmetric NAT between intelligent router of the present invention and carry out the system and method for P2P communication by introducing signaling negotiation server, the intelligent router making to be under different N AT can find the public network IP address of the other side's intelligent router after NAT, then pass through the public network IP address after the NAT of access the other side intelligent router, set up the connection communication of the P2P between two intelligent routers.Particularly, be no matter burrow based on the NAT of UDP to pass through negotiation, or burrow based on the NAT of TCP and pass through negotiation, can signaling negotiation server be passed through, well find their public network IP address.
With reference to Fig. 1, pass through the system that asymmetric NAT carries out P2P communication between intelligent router of the present invention and comprise two intelligent routers 1 and signaling negotiation server 2.
The structure of two intelligent routers 1 is identical, includes heartbeat client modules 11 and scheduling request module 12.
Wherein, heartbeat client mould 11 pieces is for reporting operating state and the public network IP address of current intelligent router.Wherein, operating state comprises online and not online two kinds.
Scheduling request module 12 for sending public network IP request to obtain the public network IP address of opposite end, and sends connection request to opposite end by the public network IP address of the opposite end obtained; And receive the scheduling request that will carry out with it communicating to connect in opposite end.
Signaling negotiation server 2 comprises heartbeat server module 21, public network IP database module 22 and signaling negotiation module 23.
Wherein, heartbeat server module 21 operating state of intelligent router of sending for the heartbeat client modules 11 receiving intelligent router and public network IP address.
Public network IP database module 22 is connected with heartbeat server module 21, for storing the public network IP address that heartbeat server module 21 obtains.
Signaling negotiation module 23 is connected with public network IP database module 22, for the public network IP request that the scheduling request module 22 responding the first intelligent router is sent, the concurrent scheduling request module 12 sending scheduling request to the second intelligent router, informs that the first intelligent router will communicate to connect with it.
Particularly, the public network IP request that signaling negotiation module is sent according to the scheduling request module of the first intelligent router received, inquires about corresponding public network IP address, and is back to the scheduling request module of the first intelligent router in public network IP database; Send the scheduling request module of scheduling request to the second intelligent router simultaneously, inform that the first intelligent router will communicate to connect with it.
As shown in Figure 2, intelligent router A sets up signalling communication by the data channel on the left side in figure and signaling negotiation server, and intelligent router B sets up signalling communication by the data channel on the right in figure and signaling negotiation server.Dotted portion in figure is the direct communication passage that intelligent router A and intelligent router B set up.
Therefore, between intelligent router of the present invention, pass through asymmetric NAT carries out in the system of P2P communication, and intelligent router A and intelligent router B all reports self operating state and public network IP address to the heartbeat server module in signaling negotiation server by self heartbeat client modules; The public network IP address of intelligent router A and B received is sent in public network IP database module and stores by heartbeat server module again.When intelligent router A need to set up with intelligent router B communicate time, intelligent router A obtains the public network IP address of intelligent router B by the scheduling request module transmission public network IP request of self; Signaling negotiation module inquires about public network IP address corresponding to intelligent router B according to public network IP request in public network IP database, and the public network IP address of intelligent router B is back to the scheduling request module of intelligent router A, send the scheduling request module of scheduling request to intelligent router B simultaneously, notice intelligent router B, intelligent router A will communicate to connect with it; The scheduling request module of intelligent router A, after the public network IP address receiving the intelligent router B that signaling negotiation module is sent, initiatively sends connection request to intelligent router B; Intelligent router B, according to the scheduling request received, obtains the public network IP address of intelligent router A, sends connection request to intelligent router A, so far, sets up the communication connection of the P2P between intelligent router A and intelligent router B.Similarly, intelligent router B also initiatively can set up with intelligent router A the P2P that communicates and communicate to connect, and implementation step is the same, therefore does not repeat them here.
With reference to Fig. 3, based on passing through the system that asymmetric NAT carries out P2P communication between intelligent router of the present invention, passing through the method that asymmetric NAT carries out P2P communication between intelligent router and comprising the following steps:
Step S1, heartbeat client modules report the public network IP address of the first intelligent router A and the second intelligent router B, and heartbeat service module collects the public network IP address of the first intelligent router A and the second intelligent router B.
Particularly, heartbeat client modules reports operating state and the public network IP address of current intelligent router, the public network IP address after NAT passes through of each intelligent router that each heartbeat client modules of heartbeat server module collection is offered.
The public network IP address of the first intelligent router A that step S2, public network IP database module storage heartbeat server is collected and the second intelligent router B.
The scheduling request module of step S3, the first intelligent router A sends public network IP request to signaling negotiation module, the public network IP address of acquisition request second intelligent router B.
Step S4, signaling negotiation module inquire about the public network IP address of the second intelligent router B in public network IP database module, and the public network IP address of the second intelligent router B is sent to the first intelligent router A, send scheduling request to the second intelligent router B simultaneously, inform that the first intelligent router A will establish a communications link with it.
The scheduling request module of step S5, the first intelligent router A, according to the public network IP address of the second intelligent router B obtained, initiates connection request to the second intelligent router B.
Particularly, the path of the first intelligent router A to the second intelligent router B just starts to set up in this step, and that namely often says burrows.And whether the path of the first intelligent router A to the second intelligent router B is successfully established and also depends on that the second intelligent router B receives the time difference that signaling negotiation module sends to the scheduling request of the second intelligent router B.That is, if before the second intelligent router B receives the first intelligent router A scheduling request that will establish a communications link with it that signaling negotiation module sends, first intelligent router A establishes a communications link with regard to the public network IP address attempted to the second intelligent router B, then communicate to connect unsuccessful; If after the second intelligent router B receives the first intelligent router A scheduling request that will establish a communications link with it that signaling negotiation module sends, first intelligent router A establishes a communications link with regard to the public network IP address attempted to the second intelligent router B, then communicate to connect likely success.
After the scheduling request module of step S6, the second intelligent router B receives the scheduling request that signaling negotiation module sends, obtain the public network IP address of the first intelligent router A, and initiate connection request to the first intelligent router A, thus set up the communication connection between the first intelligent router A and the second intelligent router B.
Particularly, the second router B initiates connection request to the first router A, the process that burrows that namely NAT passes through.If the first intelligent router A attempts setting up being connected with the second intelligent router B before this, that connection that at this moment the second intelligent router B attempts just can success.
That is, when the first intelligent router A initiatively establishes communication connection with the second intelligent router B, and second intelligent router B also initiatively establish communication connection with the second intelligent router A, then the P2P between the first intelligent router A and the second intelligent router B communicates to connect and is just successfully established.
In sum, pass through asymmetric NAT between intelligent router of the present invention and carry out the system and method for P2P communication by introducing signaling negotiation server, the intelligent router making to be under different N AT can find the public network IP address of the other side's intelligent router after NAT, then pass through the public network IP address after the NAT of access the other side intelligent router, set up the connection communication of the P2P between two intelligent routers; Being applicable to burrows based on the NAT of UDP/TCP simultaneously passes through negotiation.So the present invention effectively overcomes various shortcoming of the prior art and tool high industrial utilization.
Above-described embodiment is illustrative principle of the present invention and effect thereof only, but not for limiting the present invention.Any person skilled in the art scholar all without prejudice under spirit of the present invention and category, can modify above-described embodiment or changes.Therefore, such as have in art usually know the knowledgeable do not depart from complete under disclosed spirit and technological thought all equivalence modify or change, must be contained by claim of the present invention.