CN104660728B - NAT penetrating methods based on intelligent home control system - Google Patents
NAT penetrating methods based on intelligent home control system Download PDFInfo
- Publication number
- CN104660728B CN104660728B CN201510080442.6A CN201510080442A CN104660728B CN 104660728 B CN104660728 B CN 104660728B CN 201510080442 A CN201510080442 A CN 201510080442A CN 104660728 B CN104660728 B CN 104660728B
- Authority
- CN
- China
- Prior art keywords
- server
- client
- party
- port
- party server
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000011378 penetrating method Methods 0.000 title claims abstract description 11
- 230000004044 response Effects 0.000 claims abstract description 6
- 238000000034 method Methods 0.000 abstract description 5
- 230000008569 process Effects 0.000 abstract description 4
- 230000000149 penetrating effect Effects 0.000 description 5
- 238000004891 communication Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000035515 penetration Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000004870 electrical engineering Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/256—NAT traversal
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention provides a kind of NAT penetrating methods based on intelligent home control system, comprise the following steps:Step 1, client are directly connected to server;Step 2, the assistance of client request third-party server;Step 3, server are connected port used with third-party server toward client and send out a packet;Step 4, third-party server notice client;Step 5, after server receives the packet of client, if client receives third-party server response, the IP of server and port numbers are replied to client by third-party server, client can then record the port for receiving reply, be communicated using the port and server;If client does not receive third-party server response, then it is assumed that information is lost, and client sends to third-party server and assists request again, repeats since step 2.The present invention penetrates success rate height, and it is simple to penetrate process.
Description
Technical field
The present invention relates to electrical engineering field, in particular it relates to a kind of NAT sides of penetrating based on intelligent home control system
Method.
Background technology
The basic function of NAT technology (Network Address Translation, NAT) be with one or
Several IP address realize the communication of main frame in the All hosts and public network in an Intranet, make in-house all users
Internet is accessed by limited several (or one) legitimate ip address, not only can effectively save effective IP in Internet
Quantity, the security of network service can also be improved.
Intelligent home control system includes server, client, third-party server and hardware module etc..Wherein, client
Holding APP to carry out network service with the server of user could be to the operation of control relevant device.There is public network in server end
When IP or server end and client are in same LAN, it can successfully use a network for communicating.But if clothes
Business device end does not have public network IP and with client not in same LAN, then server end is can not be direct by client
Connection.Communication is realized in this case it is necessary to realize that effective NAT is penetrated.However, with the exhaustion of IPv4 addresses,
The Virtual network operator selection in many places gets involved in a large number of users in the Intranet of oneself, then allows these by carrier-class NAT
Users to share one or more public network IP is surfed the Net, therefore in order to which the intelligent home control system ensured in family can be in major part
In the case of normal work, must just solve NAT penetration problems.Conventional NAT, which is penetrated, usually penetrates that success rate is low, the process of penetrating is answered
The problem of miscellaneous.
The content of the invention
For in the prior art the defects of, it is an object of the invention to provide a kind of NAT based on intelligent home control system
Penetrating method, it penetrates success rate height, it is simple to penetrate process.
According to an aspect of the present invention, there is provided a kind of NAT penetrating methods based on intelligent home control system, its feature
It is, comprises the following steps:
Step 1, client are directly connected to server;If the IP of server is located in public network IP, success is directly connected to,
Otherwise client connection failure, then need to continue step 2, by the assistance of third-party server;
Step 2, the assistance of client request third-party server;
Step 3, server is connected port used with third-party server toward client and sends out a packet, then past
500 different ports of client are sent out each and send out a packet;
Step 4, third-party server notice client, server distribute packet to the 500 of client ports,
After client acknowledges receipt of information, port used is connected with third-party server to server and sends out packet multiple;If service
Device and client are all after the taper NAT of taper NAT or server in not restrictive ports, now successful connection, then with five
Hundred different ports are connected port hair packet used toward server with third-party server, and are asked to third-party server
The IP and port numbers of server;
Step 5, after server receives the packet of client, if client receives third-party server and responded, the 3rd
The IP of server and port numbers are replied to client by square server, and client then records the port for receiving reply, uses this
Port communicates with server;If client do not receive third-party server response, then it is assumed that information lose, client again to
Third-party server, which is sent, assists request, repeats since step 2.
Preferably, the third-party server refers to that one has public network IP to be used to assist both sides to carry out NAT penetrating
Server, client must ensure to connect the reliability of third-party server if necessary.
Preferably, the third-party server is in opening under conditions of normal work, is ready at all times to receive visitor
Family end and server info;After third-party server receives an information, first determine whether this information is client
The assistance request of transmission, if so, then replying client has been received by assistance request, and the IP address of client and port numbers are sent
To server;If it is not to assist request to judge this information, need to determine whether this information is that server sends number
According to the information after the completion of bag, if so, then replying server has been received by the message, and notify corresponding client, server to
Its 500 ports distribute packet, and client can continue to operate in next step;If it is not, then finally judge the information
Whether it is the information of client request return server ip and port numbers, if so, then sending IP and the end of server to client
Slogan, if it is not, then judging this information for garbage, throw aside and restart to receive message.
Compared with prior art, the present invention has following beneficial effect:
One, penetrate success rate height.It is computed, for server end in Port Restricted Cone NAT, client is in symmetric form
The theory that situation after NAT can reach 97.8% penetrates success rate.In the case of more penetrating readily through, server and client side
After being in taper NAT, or after server end is in the taper NAT of not restrictive ports, 100% can be reached by penetrating success rate.
Two, time of break-through is short, efficiency high.In the case that client and server is working properly, network condition is good,
NAT penetrates can complete in tens to hundreds of milliseconds.
Three, in the case of being in same public network IP at most common client and server end, it is not necessary to by the 3rd
The assistance of square server, it is quick, direct, simple and effective to penetrate process, and data transfer is stable and substantially no-delay.
Brief description of the drawings
The detailed description made by reading with reference to the following drawings to non-limiting example, further feature of the invention,
Objects and advantages will become more apparent upon:
Fig. 1 is the flow chart of the NAT penetrating methods of the invention based on intelligent home control system.
The operational flow diagram that it is third-party server that Fig. 2, which is,.
Embodiment
With reference to specific embodiment, the present invention is described in detail.Following examples will be helpful to the technology of this area
Personnel further understand the present invention, but the invention is not limited in any way.It should be pointed out that the ordinary skill to this area
For personnel, without departing from the inventive concept of the premise, various modifications and improvements can be made.These belong to the present invention
Protection domain.
As shown in figure 1, the NAT penetrating methods of the invention based on intelligent home control system comprise the following steps:
Step 1, after client (such as cell-phone customer terminal) is opened, server is directly connected to, judges whether to need to carry out
NAT is penetrated.Specifically, if the IP of server is located in public network IP, success can be directly connected to, network is carried out by public network
Communication, and do not need NAT to penetrate, otherwise client connection failure, then need to continue step 2, by third-party server
Assistance.
Step 2, the assistance of client request third-party server.Here " third-party server " refers to that one has
Public network IP is used to assist both sides to carry out the server that NAT is penetrated, and client must ensure to connect third-party server if necessary
Reliability.Here, client sends message to third-party server, and after third-party server receives message, client is carried out
Respond, inform that client assistance information has been received by, and the IP address of client and port numbers are sent to server, to service
Device sends packet.
Step 3, server is connected port used with third-party server toward client and sends out a packet, then past
500 different ports of client are sent out each and send out a packet.The purpose for the arrangement is that in order to be burrowed on the NAT of server,
It need not simultaneously be received by client, so respectively sending out a packet to each port.Send Inform when done third party
Server transmission process has been completed.
Step 4, third-party server notice client, server distribute packet to the 500 of client ports,
After client acknowledges receipt of information, port used is connected with third-party server to server and sends out packet multiple;If service
Device and client are all after the taper NAT of taper NAT or server in not restrictive ports, now successful connection, then client
The port used in being connected with 500 different ports with third-party server to server is held to send out packet, and to third party's service
The IP and port numbers of device request server.This is to penetrate successfully a most important step, why to send out packet several rather than
One is because to reduce the influence that packet loss is brought as far as possible.
Step 5, after server receives the packet of client, if client receives third-party server and responded, the 3rd
The IP of server and port numbers are replied to client by square server, and client can then record the port for receiving reply, make
Communicated with the port and server;If client does not receive third-party server response within a certain period of time, it is considered that
Information is lost, and client sends to third-party server and assists request again, repeats since step 2.
Third-party server operational flow diagram is as shown in Figure 2.Third-party server is non-in the running of whole system
It is often important, but its logic is relatively simple, and as long as according to the request received act accordingly, it is without the concern for NAT
The progress penetrated, and the correctness of NAT penetration steps is then mainly ensured by client.Under conditions of normal work, third party
Server is in opening, is ready at all times to receive client and server info;When third-party server receives a letter
After breath, first determine whether this information is that the assistance that client is sent is asked (when client is directly connected to take in step 1
It is engaged in after device failure, is sent to third-party server and assist request), if so, then replying client has been received by assistance request, and by visitor
The IP address and port numbers at family end are sent to server;If it is not to assist request to judge this information, need to determine whether this
Whether bar information is that (server is to 500 different ends of client in step 3 for information after the completion of server sends packet
Mouth is sent out each and sends out a packet), if so, then replying server has been received by the message, and corresponding client is notified, server is
Packet is distributed to its 500 ports, client can continue to operate in next step;If it is not, then finally judge the letter
Whether breath is that client request returns to the information of server ip and port numbers (client is asked to third-party server in step 4
The IP and port numbers of server), if so, then sending the IP and port numbers (third party's service in step 5 of server to client
The IP of server and port numbers are replied to client by device), if it is not, then judge this information for garbage, throw aside and again
Start to receive message.
The specific embodiment of the present invention is described above.It is to be appreciated that the invention is not limited in above-mentioned
Particular implementation, those skilled in the art can make various deformations or amendments within the scope of the claims, this not shadow
Ring the substantive content of the present invention.
Claims (4)
1. a kind of NAT penetrating methods based on intelligent home control system, it is characterised in that comprise the following steps:
Step 1, client are directly connected to server;If the IP of server is located in public network IP, success is directly connected to, otherwise
Client connection failure, then need to continue step 2, by the assistance of third-party server;
Step 2, the assistance of client request third-party server;
Step 3, server is connected port used with third-party server toward client and sends out a packet, then toward client
500 different ports at end respectively send out a packet;
Step 4, third-party server notice client, server distribute packet, client to the 500 of client ports
After end acknowledges receipt of information, be connected to server with third-party server used in port send out packet multiple;If server and
Client is all after the taper NAT of taper NAT or server in not restrictive ports, now successful connection, then with 500
Different port is connected port hair packet used toward server with third-party server, and asks to service to third-party server
The IP and port numbers of device;
Step 5, after server receives the packet of client, if client receives third-party server response, third party's clothes
The IP of server and port numbers are replied to client by business device, and client then records the port for receiving reply, uses the port
Communicated with server;If client does not receive third-party server response, then it is assumed that information is lost, and client is again to the 3rd
Square server, which is sent, assists request, repeats since step 2.
2. the NAT penetrating methods according to claim 1 based on intelligent home control system, it is characterised in that described
Tripartite's server refers to a server for being used to assist both sides' progress NAT to penetrate for having public network IP, and client must ensure to connect
Connect the reliability of third-party server.
3. the NAT penetrating methods according to claim 1 based on intelligent home control system, it is characterised in that the visitor
Family end is cell-phone customer terminal.
4. the NAT penetrating methods according to claim 1 based on intelligent home control system, it is characterised in that described
Tripartite's server is in opening under conditions of normal work, is ready at all times to receive client and server info;When
After tripartite's server receives an information, first determine whether this information is that the assistance that client is sent is asked, if so, then
Reply client and have been received by assistance request, and the IP address of client and port numbers are sent to server;If judging, this believes
Breath is not to assist request, then needs to determine whether this information is that server sends information after the completion of packet, if so,
Then reply server and have been received by the information, and notify corresponding client, server distributes data to its 500 ports
Bag, client can continue to operate in next step;If it is not, then finally judging whether the information is that client request returns to clothes
The information for device IP and the port numbers of being engaged in, if so, the IP and port numbers of server are then sent to client, if it is not, then judging this letter
Cease for garbage, throw aside and restart to receive message.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510080442.6A CN104660728B (en) | 2015-02-13 | 2015-02-13 | NAT penetrating methods based on intelligent home control system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510080442.6A CN104660728B (en) | 2015-02-13 | 2015-02-13 | NAT penetrating methods based on intelligent home control system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104660728A CN104660728A (en) | 2015-05-27 |
CN104660728B true CN104660728B (en) | 2018-01-19 |
Family
ID=53251414
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510080442.6A Expired - Fee Related CN104660728B (en) | 2015-02-13 | 2015-02-13 | NAT penetrating methods based on intelligent home control system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104660728B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105119946A (en) * | 2015-06-17 | 2015-12-02 | 深圳市美贝壳科技有限公司 | Intelligent household electrical appliance control device and method capable of automatically switching network |
CN110621017B (en) * | 2018-06-19 | 2022-06-10 | 佛山市顺德区美的电热电器制造有限公司 | Network configuration method, equipment and storage medium |
CN110636039A (en) * | 2019-07-31 | 2019-12-31 | 浙江工业大学 | Intelligent household encryption control management method based on intranet penetration technology |
CN112437169B (en) * | 2020-11-17 | 2022-10-25 | 郑炳立 | NAT (network Address translation) penetration method and system |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101895590A (en) * | 2010-07-23 | 2010-11-24 | 华南理工大学 | UDT-based system and method for realizing network address translator traversal |
CN101938532A (en) * | 2010-09-17 | 2011-01-05 | 北京神州泰岳软件股份有限公司 | UDP-based method and system for penetrating through NAT equipment |
CN103795818A (en) * | 2014-01-27 | 2014-05-14 | 杭州顺浪信息技术有限公司 | NAT traversal method |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101557388B (en) * | 2008-04-11 | 2012-05-23 | 中国科学院声学研究所 | NAT traversing method based on combination of UPnP and STUN technologies |
-
2015
- 2015-02-13 CN CN201510080442.6A patent/CN104660728B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101895590A (en) * | 2010-07-23 | 2010-11-24 | 华南理工大学 | UDT-based system and method for realizing network address translator traversal |
CN101938532A (en) * | 2010-09-17 | 2011-01-05 | 北京神州泰岳软件股份有限公司 | UDP-based method and system for penetrating through NAT equipment |
CN103795818A (en) * | 2014-01-27 | 2014-05-14 | 杭州顺浪信息技术有限公司 | NAT traversal method |
Non-Patent Citations (1)
Title |
---|
P2P网络中的NAT穿透机制研究;贾学锋;《中国优秀硕士学位论文全文数据库》;20090315;正文26-31页 * |
Also Published As
Publication number | Publication date |
---|---|
CN104660728A (en) | 2015-05-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102231763B (en) | Sharing method based on NAT (Network Address Translation) penetration | |
CN104270379B (en) | HTTPS agency retransmission methods and device based on transmission control protocol | |
CN104660728B (en) | NAT penetrating methods based on intelligent home control system | |
CN101159714B (en) | Instant communication method and device | |
US7492764B2 (en) | System for management of equipment deployed behind firewalls | |
CN102845123B (en) | Virtual private cloud connection method and tunnel proxy server | |
CN105847343B (en) | Public network information detection method, apparatus and system for point-to-point transmission | |
CN103220161A (en) | Method and device for detecting server status | |
CN101977199A (en) | Ip telephone system and ip telephone terminal register method | |
CN101778126A (en) | Method and system for automatic configuration of server for remote management of user front-end equipment | |
CN109379291A (en) | The processing method and processing device of service request in a kind of networking | |
WO2016070633A1 (en) | Network log generation method and device | |
CN107995321A (en) | A kind of VPN client acts on behalf of the method and device of DNS | |
CN102917082B (en) | Penetrate information push method and the system of network address translation | |
CN106878259A (en) | A kind of message forwarding method and device | |
CN102647432B (en) | A kind of authentication information transmission method, device and certification middleware | |
CN107911496A (en) | A kind of VPN service terminal acts on behalf of the method and device of DNS | |
CN102035655A (en) | Implementation method for end-to-end instant messaging, and end-to-end instant messaging terminal and system | |
CN105915662B (en) | A kind of data transmission method and device | |
CN107645339A (en) | A kind of optical fiber repeater realizes the method and device of topological structure automatically | |
CN107566213A (en) | A kind of keep-alive detection method and device | |
CN107800745A (en) | The method that service declaration and service discovery are carried out based on mDNS | |
CN101796769B (en) | Ipv6 over ipv4 transition method and apparatus for improving performance of control server | |
CN106302846B (en) | A kind of communication connection method for building up and device, system | |
CN105049302B (en) | Household communication system and communication means based on public server |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20180119 |
|
CF01 | Termination of patent right due to non-payment of annual fee |