The system and method that asymmetric NAT carries out P2P communications is passed through between intelligent router
Technical field
The present invention relates to the technical field of router, more particularly to passed through between a kind of intelligent router asymmetric NAT into
The system and method for row point-to-point (Point to Point, P2P) communication.
Background technology
As the relevant terminal device of router is more and more, the distribution of public network IP address will become relatively exhausted, together
When the equipment with public network IP address also become fewer and fewer.In order to solve the problems, such as that public network IP address is inadequate, network address turns
(Network Address Translation, NAT) technology is changed to come into being, alleviate IPv4 addresses problem in short supply and
Ensure that network security etc. has all played machine and its important role.However, NAT device type be widely present but to
Host on Internet, the host being especially in different Intranets carry out P2P communications and bring obstacle, limit P2P's
Using.
It is the main reason for progress P2P communications between NAT obstruction hosts:NAT does not allow host in the active access of public network host
Machine, this so that the host with public network IP address is from the host after actively accessing NAT on Internet, and positioned at difference
It is even more that can not be mutually distinguishable between host after NAT, thus cannot directly exchanges information.And in actual use, many roads
All do not have public network IP address, and most of routers are all present in after NAT by device.
The router of intelligent router i.e. intelligent management, can be by user usually with independent operating system
Various applications are voluntarily installed, voluntarily control bandwidth, voluntarily control online number, voluntarily control browsing webpage, voluntarily control is online
Time, while possess powerful USB sharing functionalities, it is truly realized network and the intelligent management of equipment.
In today that intelligent router is more and more ripe, such as when being deposited by router by mobile phone distally checking in family
During family's monitor video of storage, if mobile phone does not know the public network IP address of family's intelligent router, family also can not just be accessed
Monitor video.
Therefore, it is necessary to obtain the public network IP address of peer by a kind of negotiation mechanism, so that passing through mobile phone
Can direct public network IP address of the access router after NAT is gone out, so as to which router be accessed.
Invention content
In view of the foregoing deficiencies of prior art, it is non-the purpose of the present invention is to provide being passed through between a kind of intelligent router
Symmetric NAT carries out the system and method for P2P communications so that can lead to all between two routers of asymmetric NAT types
A signaling negotiation server is crossed to carry out the communication between two routers.
In order to achieve the above objects and other related objects, the present invention passes through asymmetric NAT between providing a kind of intelligent router
The system for carrying out P2P communications, including two intelligent routers and signaling negotiation server;The intelligent router includes heartbeat visitor
Family end module and scheduling request module;The heartbeat client modules are used to report the public network IP address of current intelligent router;
The scheduling request module asks to obtain the public network IP address of opposite end, and pass through the public affairs of the opposite end of acquisition for sending public network IP
Net IP address sends connection request to opposite end;And reception opposite end will be in communication with the scheduling request of connection;The signaling
Negotiation service device includes heartbeat server module, public network IP database module and signaling negotiation module;The heartbeat server mould
Block is used to receive the public network IP address of intelligent router that the heartbeat client modules of intelligent router are sent;The public network IP
Database module is connected with the heartbeat server module, for storing the public network IP address of heartbeat server module acquisition;Institute
It states signaling negotiation module with the public network IP database module to be connected, for responding the scheduling request module of the first intelligent router
The public network IP request sent, concurrently send scheduling request to the scheduling request module of the second intelligent router, informs the first intelligence
Router will be in communication with connecting.
Meanwhile the present invention also provides a kind of method asymmetric NAT is passed through between intelligent router carried out P2P communications, including
Following steps:
Step S11, signaling negotiation server collects the public network IP address of the first intelligent router and the second intelligent router;
Step S12, the public network IP address of the first intelligent router of signaling negotiation server storage and the second intelligent router;
Step S13, signaling negotiation server receives the public network IP request that the first intelligent router is sent, the public network IP
Request is used for the public network IP address of the second intelligent router of acquisition request;
Step S14, signaling negotiation server sends the public network IP address of the second intelligent router to the first intelligent router,
So that public network IP address of first intelligent router according to the second intelligent router of acquisition, initiates to connect to the second intelligent router
Connect request;Scheduling request is sent simultaneously to the second intelligent router, informs that the first intelligent router will establish communication connection,
So that the second intelligent router obtains the public network IP address of the first intelligent router, and initiate the connection and ask to the first intelligent router
It asks.
The method for carrying out P2P communications according to asymmetric NAT is passed through between above-mentioned intelligent router, wherein:The step S11
In, signaling negotiation server passes through each intelligence for being offered on each heartbeat client modules of heartbeat server module collection thereon
The public network IP address of energy router.
The method for carrying out P2P communications according to asymmetric NAT is passed through between above-mentioned intelligent router, wherein:The step S12
In, signaling negotiation server stores the first intelligent router and the second intelligent router by public network IP database module thereon
Public network IP address.
The method for carrying out P2P communications according to asymmetric NAT is passed through between above-mentioned intelligent router, wherein:The step S13
In, the scheduling request module that signaling negotiation server receives the first intelligent router by signaling negotiation module thereon is sent
Public network IP request.
The method for carrying out P2P communications according to asymmetric NAT is passed through between above-mentioned intelligent router, wherein:The step S14
In, signaling negotiation server sends the public affairs of the second intelligent router by signaling negotiation module thereon to the first intelligent router
Net IP address;Scheduling request is sent to the second intelligent router by signaling negotiation module thereon.
In addition, the present invention also provides a kind of method that asymmetric NAT progress P2P communications are passed through between intelligent router, including
Following steps:
Step S21, the first intelligent router and the second intelligent router report the public network of itself to signaling negotiation server
IP address, so that signaling negotiation server is stored;
Step S22, the first intelligent router sends public network IP request to obtain the second intelligent road to signaling negotiation server
By the public network IP address of device;
Step S23, the first intelligent router receives the public network of the second intelligent router that signaling negotiation server is sent
IP address initiates the connection request to the second intelligent router;Second intelligent router receives what signaling negotiation server was sent
First intelligent router will establish communication the scheduling request of connection, obtain the public network IP address of the first intelligent router, and
Request is initiated the connection to the first intelligent router.
The method for carrying out P2P communications according to asymmetric NAT is passed through between above-mentioned intelligent router, wherein:The step S21
In, intelligent router reports the public network IP address of itself to signaling negotiation server by heartbeat client modules thereon.
The method for carrying out P2P communications according to asymmetric NAT is passed through between above-mentioned intelligent router, wherein:The step S22
In, the first intelligent router sends public network by scheduling request module thereon to the signaling negotiation module of signaling negotiation server
IP is asked.
The method for carrying out P2P communications according to asymmetric NAT is passed through between above-mentioned intelligent router, wherein:The step S23
In, the first intelligent router receives the second Intelligent routing that signaling negotiation server sends by scheduling request module thereon
The public network IP address of device, and initiate the connection request to the second intelligent router;Second intelligent router is connect by signaling thereon
It receives module and receives the scheduling request that signaling negotiation server is sent.
As described above, the system and method that asymmetric NAT carries out P2P communications is passed through between the intelligent router of the present invention, tool
There is following advantageous effect:
(1) by introducing signaling negotiation server so that the intelligent router under different NAT can find other side's intelligence
Can public network IP address of the router after NAT, the then public network IP address after the NAT by accessing other side's intelligent router,
Establish the connection communication of the P2P between two intelligent routers;
(2) it burrows suitable for the NAT based on UDP/TCP and passes through negotiation.
Description of the drawings
Fig. 1 is shown as passing through the system structure signal that asymmetric NAT carries out P2P communications between the intelligent router of the present invention
Figure;
Fig. 2 is shown as passing through the systematic difference scene that asymmetric NAT carries out P2P communications between the intelligent router of the present invention
Schematic diagram;
Fig. 3 is shown as passing through the flow chart that asymmetric NAT carries out the method for P2P communications between the intelligent router of the present invention.
Component label instructions
1 intelligent router
11 heartbeat client modules
12 scheduling request modules
2 signaling negotiation servers
21 heartbeat server modules
22 public network IP database modules
23 signaling negotiation modules
Specific embodiment
Illustrate embodiments of the present invention below by way of specific specific example, those skilled in the art can be by this specification
Disclosed content understands other advantages and effect of the present invention easily.The present invention can also pass through in addition different specific realities
The mode of applying is embodied or practiced, the various details in this specification can also be based on different viewpoints with application, without departing from
Various modifications or alterations are carried out under the spirit of the present invention.
It should be noted that the diagram provided in the present embodiment only illustrates the basic conception of the present invention in a schematic way,
Then in schema only display with it is of the invention in related component rather than component count, shape and size during according to actual implementation paint
System, kenel, quantity and the ratio of each component can be a kind of random change, and its assembly layout kenel also may be used during actual implementation
It can be increasingly complex.
Asymmetric NAT is passed through between the intelligent router of the present invention and carries out the system and method for P2P communications by introducing signaling
Negotiation service device so that the intelligent router under different NAT can find public network IP of other side's intelligent router after NAT
Address, then the public network IP address after the NAT by accessing other side's intelligent router, is established between two intelligent routers
The connection communication of P2P.Specifically, the either NAT based on UDP burrow pass through negotiation or the NAT based on TCP burrow and pass through
Negotiate, can be transferred through signaling negotiation server, find their public network IP address well.
With reference to Fig. 1, the system that asymmetric NAT carries out P2P communications is passed through between intelligent router of the invention and includes two intelligence
It can router 1 and signaling negotiation server 2.
The structure of two intelligent routers 1 is identical, including heartbeat client modules 11 and scheduling request module 12.
Wherein, 11 pieces of heartbeat client mould is used to report the working condition and public network IP address of current intelligent router.Its
In, working condition includes online and two kinds not online.
Scheduling request module 12 asks to obtain the public network IP address of opposite end, and pass through pair of acquisition for sending public network IP
The public network IP address at end sends connection request to opposite end;And reception opposite end will be in communication with the scheduling request of connection.
Signaling negotiation server 2 includes heartbeat server module 21, public network IP database module 22 and signaling negotiation module
23。
Wherein, heartbeat server module 21 is used to receive the intelligence that the heartbeat client modules 11 of intelligent router are sent
The working condition and public network IP address of router.
Public network IP database module 22 is connected with heartbeat server module 21, is obtained for storing heartbeat server module 21
Public network IP address.
Signaling negotiation module 23 is connected with public network IP database module 22, and the signaling for responding the first intelligent router please
The public network IP request that modulus block 22 is sent concurrently send scheduling request to be accused to the scheduling request module 12 of the second intelligent router
Know that the first intelligent router will be in communication with connecting.
Specifically, the public affairs that signaling negotiation module is sent according to the scheduling request module of the first intelligent router received
IP requests are netted, corresponding public network IP address is inquired in public network IP database, and the signaling for being back to the first intelligent router please
Modulus block;Scheduling request is sent simultaneously to the scheduling request module of the second intelligent router, informs that the first intelligent router will be with
It is communicatively coupled.
Lead to as shown in Fig. 2, intelligent router A establishes signaling by the data channel on the left side in figure with signaling negotiation server
Letter, intelligent router B establish signalling communication by the data channel on the right in figure with signaling negotiation server.Dotted line part in figure
It is divided into the direct communication channel that intelligent router A and intelligent router B is established.
Therefore, it is passed through between the intelligent router of the present invention in the system that asymmetric NAT carries out P2P communications, Intelligent routing
Heartbeat server modules of the device A and intelligent router B by the heartbeat client modules of itself into signaling negotiation server
Report the working condition and public network IP address of itself;The public network of intelligent router A and B that heartbeat server module will receive again
IP address is sent in public network IP database module and is stored.When intelligent router A needs to communicate with intelligent router B foundation
When, intelligent router A sends public network IP request with obtaining the public network IP of intelligent router B by the scheduling request module of itself
Location;Signaling negotiation module asks to inquire the corresponding public network IP address of intelligent router B in public network IP database according to public network IP,
And the public network IP address of intelligent router B is back to the scheduling request module of intelligent router A, while send scheduling request extremely
The scheduling request module of intelligent router B notifies intelligent router B, intelligent router A to be in communication with connecting;Intelligence
The scheduling request module of router A is main after the public network IP address of intelligent router B that signaling negotiation module is sent is received
The dynamic connection request that sends is to intelligent router B;Intelligent router B obtains intelligent router A's according to the scheduling request received
Public network IP address sends connection request to intelligent router A, so far, establishes between intelligent router A and intelligent router B
The communication connection of P2P.Similarly, intelligent router B can also actively establish the P2P communication connections that communicate with intelligent router A,
Realize that step is same as above, therefore details are not described herein.
With reference to Fig. 3, the system that asymmetric NAT carries out P2P communications, intelligent road are passed through between the intelligent router based on the present invention
The method for carrying out P2P communications by passing through asymmetric NAT between device includes the following steps:
Step S1, heartbeat client modules are with reporting the public network IP of the first intelligent router A and the second intelligent router B
The public network IP address of location, heartbeat service module collection the first intelligent router A and the second intelligent router B.
Specifically, heartbeat client modules report the working condition and public network IP address of current intelligent router, heartbeat clothes
The public network IP after NAT is passed through of each intelligent router offered on the business each heartbeat client modules of device module collection
Location.
Step S2, the first intelligent router A and the second intelligence that public network IP database module storage heartbeat server is collected into
The public network IP address of energy router B.
Step S3, the scheduling request module of the first intelligent router A sends public network IP and asks to signaling negotiation module, request
Obtain the public network IP address of the second intelligent router B.
Step S4, signaling negotiation module is with inquiring the public network IP of the second intelligent router B in public network IP database module
Location, and to the public network IP address of the second intelligent router B of the first intelligent router A transmissions, while scheduling request is sent to second
Intelligent router B informs that the first intelligent router A will establish communication connection.
Step S5, the scheduling request module of the first intelligent router A is according to the public network IP of the second intelligent router B of acquisition
Address initiates the connection request to the second intelligent router B.
Specifically, the access of the first intelligent router A to the second intelligent router B are just begun setting up in this step,
It is exactly burrowing of often saying.And whether the access of the first intelligent router A to the second intelligent router B are successfully established and additionally depend on
Two intelligent router B receive the time difference that signaling negotiation module is sent to the scheduling request of the second intelligent router B.Namely
It says, if the first intelligent router A that the transmission of signaling negotiation module is received in the second intelligent router B will establish communication connection
Scheduling request before, the first intelligent router A attempts to establish communication link to the public network IP address of the second intelligent router B
It connects, then communicates to connect unsuccessful;If receive the first intelligent router A of signaling negotiation module transmission in the second intelligent router B
After the scheduling request for establishing communication connection, the first intelligent router A attempts to the public network to the second intelligent router B
IP address establishes communication connection, then communication connection is it is possible that success.
Step S6, the scheduling request module of the second intelligent router B receives the signaling that signaling negotiation module is sent and asks
After asking, the public network IP address of the first intelligent router A is obtained, and request is initiated the connection to the first intelligent router A, so as to establish
Communication connection between first intelligent router A and the second intelligent router B.
Specifically, the second router B initiates the connection request, that is, the process that burrows that NAT is passed through to the first router A.
It is connect if the first intelligent router A was established with the second intelligent router B trials before this, at this moment second is intelligent for that
The connection that router B is attempted just can success.
That is, when the first intelligent router A actively establishes communication connection, Yi Ji with the second intelligent router B
Two intelligent router B also actively establish communication connection with the second intelligent router A, then the first intelligent router A and the second intelligence
P2P communication connections between energy router B are just successfully established.
In conclusion the system and method that asymmetric NAT progress P2P communications are passed through between the intelligent router of the present invention passes through
Introduce signaling negotiation server so that the intelligent router under different NAT can find other side's intelligent router after NAT
Public network IP address, then the public network IP address after the NAT by accessing other side's intelligent router, establishes two Intelligent routings
The connection communication of P2P between device;It burrows simultaneously suitable for the NAT based on UDP/TCP and passes through negotiation.So effective gram of present invention
It has taken various shortcoming of the prior art and has had high industrial utilization.
The above-described embodiments merely illustrate the principles and effects of the present invention, and is not intended to limit the present invention.It is any ripe
The personage for knowing this technology all can carry out modifications and changes under the spirit and scope without prejudice to the present invention to above-described embodiment.Cause
This, those of ordinary skill in the art is complete without departing from disclosed spirit and institute under technological thought such as
Into all equivalent modifications or change, should by the present invention claim be covered.