WO2017166808A1 - Method, device, server, and system for implementing p2p communication by going through nat - Google Patents

Method, device, server, and system for implementing p2p communication by going through nat Download PDF

Info

Publication number
WO2017166808A1
WO2017166808A1 PCT/CN2016/103902 CN2016103902W WO2017166808A1 WO 2017166808 A1 WO2017166808 A1 WO 2017166808A1 CN 2016103902 W CN2016103902 W CN 2016103902W WO 2017166808 A1 WO2017166808 A1 WO 2017166808A1
Authority
WO
WIPO (PCT)
Prior art keywords
associated terminal
nat
server
access device
wireless access
Prior art date
Application number
PCT/CN2016/103902
Other languages
French (fr)
Chinese (zh)
Inventor
张享达
Original Assignee
上海斐讯数据通信技术有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 上海斐讯数据通信技术有限公司 filed Critical 上海斐讯数据通信技术有限公司
Publication of WO2017166808A1 publication Critical patent/WO2017166808A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/256NAT traversal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks

Definitions

  • the present invention relates to the field of P2P communication technology for implementing NAT, and in particular, to a method, device, server and system for implementing P2P communication through NAT.
  • NAT Network Address Translator
  • the address can be divided into a public address and a private address.
  • the private address is used for the intranet. Different intranets and private addresses can be reused, thereby saving the public address.
  • the private address cannot be routed in the public network, so the host of the intranet needs to be To access the public network server, you have to go through NAT.
  • the public address is globally unique and can be routed on the public network.
  • the intranet host uses the private address to communicate with other intranet hosts without error, but the intranet host must communicate with the external network and must pass through NAT devices (such as gateways and routers). For example, if the intranet host A wants to communicate with the external network server S, it must first pass through the gateway. At this time, the gateway changes the packet address and port, and changes the private address to the public address, so that the data packet can be routed on the public network and sent to the public network. External network server S. After the data packet returned by the external network server S arrives at the gateway, the gateway changes the public address to the corresponding private address, and then forwards it to the intranet host A. In this way, an intranet only needs a public IP address to access the entire intranet terminal to the external network, thereby solving the problem of lack of IP address.
  • NAT devices such as gateways and routers
  • NAT functions are often integrated into routers, firewalls, ISDN (Integrated Services Digital Network) routers or separate NAT devices.
  • NAT can be divided into basic NAT and NAPT (Network Address/Port Translator).
  • Basic NAT which only converts the private IP address of the intranet host into a public IP address, but does not convert the TCP/UDP port information. There is a distinction between dynamic and static. Since most of the current types belong to another type, namely NAPT, the basic NAT is not discussed in detail here.
  • NAPT Another kind of NAT is called NAPT. From the name, we can also see that NAPT will not only change the IP address of the IP packet passing through the NAT device, but also change the TCP/UDP port of the IP packet.
  • a host in the private network Client A (10.0.0.2)
  • Client A 10.0.0.2
  • the NAT external network address is 155.99.25.11.
  • NAT will change the original IP address of the data packet to 155.99.25.11.
  • assign a port (such as 62000) to Client A and change the original port number of the packet to 62000. So the packet that was originally (10.0.0.2:1234->18.181.0.31:1235) went to the Internet and became (155.99.25.11:62000->18.181.0.31:1235).
  • NAT will remember that the 62000 port corresponds to the port 1234 of 10.0.0.2, and the data sent from the external network server 18.181.0.31 to the 62000 port will be automatically changed by the NAT to change the destination IP and port number, and then forwarded to 10.0.0.2.
  • NAPT is divided into Cone and Symmetric. The difference is that if NAT has assigned port number to Client A, if Client A continues to communicate with another external server using port 1235, the cone Type NAT will continue to use the original 62000 port, that is, the assigned port number does not change. For peer-to-peer NAT, NAT will assign another port number (such as 62001) to Client A's port 1235. That is to say, the same intranet host has the same port number. For the cone NAT, no matter which external network host communicates, the assigned port number is not changed. For the peer NAT, the same intranet host has the same port number. Each time it communicates with a different external host, it reassigns another port number.
  • Cone-type NAT can be additionally classified as Full Cone NAT, Restricted Cone NAT, and Port Restricted Cone NAT.
  • NAT After Host A inside the NAT connects to the external host C, NAT will open a port. Then any UDP datagram sent by the external network to this open port can reach A, whether it is sent by C or not.
  • NAT After Host A inside the NAT connects to Host C of the external network, NAT opens a port. Then C can communicate with A using any port, but other external hosts cannot.
  • NAT After Host A inside the NAT connects to Host C of the external network, NAT opens a port. Then C can only communicate with A using the original port, and other external hosts cannot.
  • NAT solves the problem of address shortage well, and can effectively avoid attacks from outside the network, hiding and protecting computers inside the network. At the same time, NAT also hinders direct access from the external network to the internal network, such as CDN P2P distributed transmission and server active push.
  • NAT penetration is the main solution for implementing P2P communication.
  • Commonly used solutions are ICE (The Internet Communications Engine) and UPnP.
  • ICE penetration requires that the external network server is a dual network card configuration, which will bring more security risks, and the internal network terminal requires a storage space compatible with the environment. For example, an open source program is run on an embedded device. If it is implemented in a different language, the base library needs to be loaded. This will affect the actual application in low-cost embedded projects.
  • UPnP can penetrate UDP/TCP and symmetric, but does not support tandem NAT devices.
  • STUN Simple Traversal of UDP over NAT
  • STUN Simple Traversal of UDP over NAT
  • Step S101 the client requests the public network address after the NAT mapping to the server;
  • step S102 it is determined whether a response is received. If the process proceeds to step S104, otherwise proceeds to step S103;
  • Step S103 confirming that it is blocked, and the network disconnection or UDP/TCP packet is blocked by the firewall;
  • Step S104 confirming that it is non-blocking type, comparing the external network address of the client and the public network after NAT mapping;
  • step S105 it is determined whether the addresses are the same? If the same goes to step S106, otherwise enter the step S111;
  • Step S106 confirming that it is a public network, and there is no NAT device
  • Step S107 the client requests the server to reply the packet from another IP address and the port port;
  • step S108 it is determined whether a response is received. If the process proceeds to step S109, otherwise proceeds to step S110;
  • Step S109 confirming that it is an open type, and the client is on an open network
  • Step S110 confirming that it is a symmetric PW, and the UDP/TCP packet is blocked by the front firewall;
  • Step S111 confirming that it is a private network, and having a NAT device
  • Step S112 the client requests the server to reply the packet from the other IP and the port;
  • step S113 it is determined whether a response is received. If the process proceeds to step S114, otherwise proceeds to step S115;
  • Step S114 confirming that it is completely tapered, and the NAT device is completely open;
  • Step S115 confirming that the NAT is restricted, the NAT device is restricted open;
  • Step S116 the client requests a NAT-mapped public network address from another IP address of the server, and compares the client external network address and the public network address after NAT mapping;
  • step S117 it is determined whether the addresses are the same? If the same goes to step S119, otherwise proceeds to step S118;
  • Step S118 the symmetric cone NAT, the UDP/TCP packet is blocked by the pre-NAT device;
  • Step S119 confirming to be a restricted taper
  • Step S120 the client requests the server to reply the packet from the same address and different ports;
  • step S121 is the same address determined? If the same goes to step S122, otherwise proceeds to step S123;
  • Step S122 confirming that the address is limited in cone shape
  • step S123 it is confirmed that the port is limited in cone shape.
  • the STUN protocol requires an external network server to configure a dual NIC for NAT type detection of the intranet terminal.
  • the open source versions "RFC3489: stund-0.97" and “RFC5389: stunserver” are based on C++ implementation.
  • the operation requires C++Lib library support.
  • the compilation size is more than 1M, which is not suitable for low-cost embedded device projects.
  • UPnP is an open device interconnection protocol based on TCP/IP and does not require drivers. Enable the NAT device of the UPnP function.
  • the intranet terminal allows the NAT gateway to perform automatic port mapping.
  • the UPnP protocol cluster realizes interconnection and intercommunication, that is, the external network address of the intranet terminal is broadcast and announced.
  • UPnP can penetrate UDP/TCP NAT and symmetric NAT, and the penetration efficiency is very high, but the application scenario is limited.
  • it is necessary to open the UPnP function request automatic port mapping for each level, and the external network server can know the public network address of the internal network terminal. But in fact, the outer NAT device is unpredictable and controllable.
  • the technical problem to be solved by the present invention penetrates all types of NAT and multi-level serial NAT devices, and does not impose additional requirements on devices and network environments, and solves the problem of low-cost promotion and application.
  • the present invention provides a method for implementing P2P communication by penetrating NAT, the method comprising:
  • the wireless access device detects a NAT heartbeat period
  • the method further includes: directly detecting the received terminal when detecting the received response Perform P2P communication.
  • the method before the sending the request message to the public network address of the associated terminal, the method further includes:
  • the response packet further carries a network type of the associated terminal
  • the associated terminal includes a primary device and at least one associated device, and the associated forwarding table format of the associated terminal is:
  • Primary device ID public network address, network type, heartbeat period
  • First associated device identifier public network address, network type, heartbeat period
  • the detecting, by the wireless access device, a NAT heartbeat period includes:
  • the sniffing is continued in N/2 seconds, the preset number of times is continuously sniffed, and the response of the server is still not received, and the network is considered unreachable;
  • the N seconds is a heartbeat period.
  • the present invention also provides a method for implementing P2P communication by penetrating NAT, the method comprising:
  • the wireless terminal device After receiving the request message of the wireless access device, the wireless terminal device notifies the associated terminal to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period. And performing, by the wireless access device, P2P communication with the associated terminal.
  • the method before updating the associated forwarding table of the associated terminal according to the TCP application layer information, the method further includes:
  • TCP application layer packet information includes network address information
  • the source address of the data packet is a public network address that is mapped by the wireless access device through NAT.
  • the method further includes:
  • the present invention also provides a wireless access device that implements P2P communication by penetrating NAT, and the wireless access device includes:
  • a first detecting module configured to detect a NAT heartbeat period
  • the reporting module is configured to report the TCP application layer information to the server according to the NAT heartbeat period detected by the first detecting module, so that the server updates the associated forwarding table of the associated terminal according to the TCP application layer information;
  • a first receiving module configured to receive a response packet of the server, where the response packet carries a public network address of the associated terminal;
  • a first sending module configured to send a request message to a public network address of the associated terminal
  • a second detecting module that detects whether a response is received
  • a first communication module configured to: when the second detection module detects that no response is received, by using a relay mode or requesting the server to notify the associated terminal to initiate a heartbeat sniffing packet to penetrate NAT according to the heartbeat period And implementing P2P communication with the associated terminal.
  • the wireless access device further includes:
  • the second communication module is configured to perform P2P communication directly with the associated terminal when the second detecting module detects the receipt of the response.
  • the wireless access device further includes:
  • a first confirmation module configured to: after the first sending module sends a request message to the public network address of the associated terminal, confirm that the associated terminal is in a private network according to a network type of the associated terminal; wherein the response The packet also carries the network type of the associated terminal;
  • the second confirmation module is configured to update the public network address of the associated terminal according to the public network address of the associated terminal.
  • the first detecting module includes:
  • a requesting submodule configured to send a request message to the server
  • the detecting submodule is configured to continue sniffing in N/2 seconds if the response of the server is not received within N seconds, continuously sniffing the preset number of times, and still not receiving the response from the server, then the network is considered Unreachable; if the response of the server is received after a delay of N seconds, the N seconds is a heartbeat period.
  • the present invention further provides a server for implementing P2P communication by penetrating NAT, wherein the server includes:
  • a second receiving module configured to receive, according to a heartbeat period, TCP application layer information reported by the wireless access device
  • An update module configured to update an associated forwarding table of the associated terminal according to the TCP application layer information
  • a second sending module configured to send a response packet to the wireless access device, so that the wireless access device sends a request packet to a public network address of the associated terminal, where the response packet carries the The public network address of the associated terminal;
  • Receiving a notification module configured to notify the associated terminal to initiate heartbeat sniffing packet penetration according to the heartbeat period, after receiving the request notification message of the wireless access device, when the wireless access device does not receive a response
  • the NAT facilitates P2P communication between the wireless access device and the associated terminal.
  • the server further includes:
  • a third receiving module configured to receive the TCP application layer packet information, where the update application module updates the associated forwarding table of the associated terminal according to the TCP application layer information, where the TCP application layer packet information includes a network Address information;
  • a comparison determining module configured to compare the pre-stored data source address with the network address information to determine a network type, where the data source address is a public network address that is mapped by the wireless access device through NAT.
  • the server further includes:
  • a notification module configured to: after the update module updates the associated forwarding table of the associated terminal according to the TCP application layer information, notify the associated terminal of the updated content of the associated forwarding table of the associated terminal.
  • the present invention also provides a system for implementing P2P communication by penetrating NAT, the system comprising a wireless access device and a server,
  • the wireless access device is the wireless access device described above;
  • the server is the server described above.
  • FIG. 1 is a schematic flowchart of a network state after a traditional NAT mapping and a manner of determining various NAT types
  • FIG. 2 is a schematic flow chart of an embodiment of a method for implementing P2P communication by penetrating NAT according to the present invention
  • FIG. 3 is a schematic flow chart of another embodiment of a method for implementing P2P communication by penetrating NAT according to the present invention.
  • FIG. 4 is a schematic flowchart of a further processing method before sending a request message to a public network address of the associated terminal in a method for implementing P2P communication by using NAT;
  • FIG. 5 is a schematic flow chart of another embodiment of a method for implementing P2P communication by penetrating NAT according to the present invention.
  • FIG. 6 is a schematic flowchart of a further processing method before updating an associated forwarding table of an associated terminal according to the TCP application layer information in the method for implementing P2P communication by using NAT;
  • FIG. 7 is a schematic structural diagram of an embodiment of a wireless access device for implementing P2P communication by penetrating NAT according to the present invention.
  • FIG. 8 is a schematic structural diagram of another embodiment of a wireless access device for implementing P2P communication by penetrating NAT according to the present invention.
  • FIG. 9 is a schematic structural diagram of another embodiment of a wireless access device for implementing P2P communication by penetrating NAT according to the present invention.
  • FIG. 10 is a schematic structural diagram of an embodiment of a first detecting module in a wireless access device that implements P2P communication by using NAT;
  • FIG. 11 is a schematic structural diagram of an embodiment of a server for implementing P2P communication by penetrating NAT according to the present invention.
  • FIG. 12 is a schematic structural diagram of another embodiment of a server for implementing P2P communication by penetrating NAT according to the present invention.
  • FIG. 13 is a schematic structural diagram of another embodiment of a server for implementing P2P communication by penetrating NAT according to the present invention.
  • FIG. 14 is a schematic structural diagram of an embodiment of a system for implementing P2P communication by penetrating NAT according to the present invention.
  • the present invention provides a method, device, server and system for implementing P2P communication by penetrating NAT.
  • FIG. 2 is a schematic flowchart of an embodiment of a method for implementing P2P communication by using NAT through the NAT, which is suitable for wireless access to the device side, and the specific steps are as follows:
  • Step S201 the wireless access device detects a NAT heartbeat period
  • the detecting, by the wireless access device, a NAT heartbeat period includes:
  • the sniffing is continued in N/2 seconds, the preset number of times is continuously sniffed, and the response of the server is still not received, and the network is considered unreachable;
  • the N seconds is a heartbeat period.
  • the wireless access device is located on the intranet.
  • Step S202 and reporting TCP application layer information to the server according to the NAT heartbeat period, so that the server updates the associated forwarding table of the associated terminal according to the TCP application layer information;
  • the associated terminal includes a master device and at least one associated device, and the associated forwarding table format of the associated terminal is:
  • Primary device ID public network address, network type, heartbeat period
  • First associated device identifier public network address, network type, heartbeat period
  • the number is set by the server, and the other device identifier and the first device identifier are the physical addresses in the packets reported by the wireless access device according to the heartbeat period;
  • the network type includes a private network and a public network.
  • the specific server compares the source address of the data packet with the network address in the TCP application layer information.
  • the network type is the public network, the network type is private.
  • Step S203 Receive a response packet of the server, where the response packet carries a public network address of the associated terminal.
  • the response message further carries a network type.
  • Step S204 Send a request message to the public network address of the associated terminal.
  • the associated terminal includes: a primary device identifier and a first device identifier.
  • Step S205 and when detecting that no response is received, by using the relay mode or requesting the server to notify the associated terminal to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period, to implement P2P with the associated terminal. Communication.
  • the relay mode is to enable the wireless access device to be connected to the associated terminal by using the relay, that is, bypassing the NAT
  • the wireless access device can directly perform P2P communication with the associated device.
  • the associated terminal initiates a heartbeat sniffing packet to the wireless access terminal according to a heartbeat cycle, that is, the NAT is opened through a heartbeat continuous manner, so that the associated terminal and the wireless access device are enabled. Perform P2P communication;
  • the wireless access device When the wireless access device starts to start, it requests the address information of the associated terminal from the server; and initiates sniffing communication, and records whether the relay mode is enabled when the connection is made.
  • FIG. 3 is a schematic flowchart diagram of another embodiment of a method for implementing P2P communication by using NAT in the present invention, and the specific steps are as follows:
  • Step S301 the wireless access device detects a NAT heartbeat period
  • step S201 As shown in step S201.
  • Step S302 and reporting TCP application layer information to the server according to the NAT heartbeat period, so that the server updates the associated forwarding table of the associated terminal according to the TCP application layer information;
  • step S202 As shown in step S202.
  • Step S303 receiving a response packet of the server, where the response packet carries a public network address of the associated terminal.
  • step S203 As shown in step S203.
  • Step S304 sending a request message to the public network address of the associated terminal
  • step S204 As shown in step S204.
  • Step S305 and when detecting that no response is received, by using the relay mode or requesting the server to notify the associated terminal to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period, to implement P2P with the associated terminal.
  • step S205 As shown in step S205.
  • Step S306 when detecting the received response, directly performing P2P communication with the associated terminal.
  • the wireless access device and the associated terminal can directly communicate.
  • FIG. 4 is a schematic flowchart of a further processing method before a request message is sent to a public network address of the associated terminal in a method for implementing P2P communication by using NAT, and the specific steps are as follows:
  • Step S401 the response packet further carries a network type of the associated terminal.
  • Step S402 confirming, according to the network type of the associated terminal, that the associated terminal is in a private network
  • the network type includes a private network and a public network.
  • Step S403 confirming that the public network address of the associated terminal is updated according to the public network address of the associated terminal.
  • the wireless access device compares the received public network address of the associated terminal with the public network address of the associated terminal that was previously stored by the wireless access device, and finds that the public network address of the associated terminal is updated.
  • FIG. 5 is a schematic flowchart of another embodiment of a method for implementing P2P communication by using NAT through the NAT, which is suitable for the server side, and the specific steps are as follows:
  • Step S501 Receive, according to a heartbeat period, TCP application layer information reported by the wireless access device.
  • the TCP application layer information includes: a device state, a function mask, a network address (IP address), a physical address, and the like, and adopts a jason format.
  • Step S502 updating an associated forwarding table of the associated terminal according to the TCP application layer information.
  • the server compares the source address of the data packet with the network address in the TCP application layer information.
  • the server is the same, it is a public network, and at the same time, a private network.
  • the packet source address is the outermost NAT
  • the mapped address is also the public network address of the wireless access device;
  • the updated content of the associated forwarding table of the associated terminal may also be notified to the associated terminal.
  • Step S503 and sending a response message to the wireless access device, so that the wireless access device sends a request message to the public network address of the associated terminal;
  • the response packet carries a public network address of the associated terminal.
  • Step S504 and after receiving the request message of the wireless access device, after the wireless access device receives the response packet, notify the associated terminal to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period, which is convenient.
  • the wireless access device performs P2P communication with the associated terminal.
  • the server after receiving the request of the wireless access terminal, notifies the associated terminal to initiate the heartbeat sniffing packet to penetrate the NAT according to the heartbeat period according to the request.
  • FIG. 6 is a schematic flowchart of a method for further processing an associated forwarding table of an associated terminal according to the TCP application layer information in the method for implementing P2P communication by using NAT in the method of the present invention. The specific steps are as follows:
  • Step S601 Receive the TCP application layer packet information.
  • the TCP application layer packet information includes network address information.
  • Step S602 comparing the pre-stored data source address with the network address information to determine a network type.
  • the network type is a public network, and at the same time, the network type is a private network.
  • Step S603 the source address of the data packet is a public network address that is mapped by the wireless access device through NAT.
  • the source address of the data packet is an IP address.
  • the machine-readable medium can include, but is not limited to, a floppy disk, an optical disk, a CD-ROM (Compact Disk-Read Only Memory), a magneto-optical disk, a ROM (Read Only Memory), a RAM (Random Access Memory), an EPROM (erasable) In addition to programmable read only memory, EEPROM (Electrically Erasable Programmable Read Only Memory), magnetic or optical cards, flash memory, or other types of media/machine readable media suitable for storing machine executable instructions.
  • the invention is applicable to a wide variety of general purpose or special purpose computing system environments or configurations.
  • the invention may be described in the general context of computer-executable instructions executed by a computer, such as a program module.
  • program modules include routines, programs, objects, components, data structures, and the like that perform particular tasks or implement particular abstract data types.
  • the invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are connected through a communication network.
  • program modules can be located in both local and remote computer storage media including storage devices.
  • FIG. 7 is a schematic structural diagram of an embodiment of a wireless access device that implements P2P communication by using NAT.
  • the wireless access device 700 includes a first detecting module 701, a reporting module 702, a first receiving module 703, and a first a sending module 704, a second detecting module 705, and a first communication module 706,
  • the first detecting module 701 is configured to detect a NAT heartbeat period
  • the first detecting module 701 detects the NAT heartbeat period, and specifically includes:
  • the first detecting module 701 sends a request message to the server; if the response of the server is not received within N seconds, the sniffing continues in N/2 seconds, and the preset number of times is continuously sniffed, and the receiving number is still not received.
  • the response of the server is considered to be unreachable; if the response of the server is received after a delay of N seconds, the N seconds is a heartbeat period.
  • the reporting module 702 is configured to report the TCP application layer information to the server according to the NAT heartbeat period detected by the first detecting module 701, so that the server updates the association according to the TCP application layer information.
  • the associated terminal includes a master device and at least one associated device, and the associated forwarding table format of the associated terminal is:
  • Primary device ID public network address, network type, heartbeat period
  • First associated device identifier public network address, network type, heartbeat period
  • the number is set by the server, and the other device identifier and the first device identifier are the physical addresses in the packets reported by the first detection module according to the heartbeat period;
  • the network type includes a private network and a public network.
  • the specific server compares the source address of the data packet with the network address in the TCP application layer information.
  • the network type is the public network, the network type is private.
  • the first receiving module 703 is configured to receive a response packet of the server, where the response packet carries a public network address of the associated terminal.
  • the response message further carries a network type.
  • the first sending module 704 is configured to send a request message to the public network address of the associated terminal.
  • the associated terminal includes: a primary device identifier and a first device identifier.
  • the second detecting module 705 detects whether a response is received.
  • the first communication module 706 is configured to, when the second detecting module 705 detects that no response is received, notify the associated terminal to initiate a heartbeat sniffing packet wear according to the heartbeat period by using a relay mode or requesting the server Through NAT, P2P communication with the associated terminal is implemented.
  • the wireless access device can directly perform P2P communication with the associated device.
  • the associated terminal initiates a heartbeat sniffing packet to the wireless access terminal according to a heartbeat cycle, that is, the NAT is opened through a heartbeat continuous manner, so that the associated terminal and the wireless access device are enabled. Perform P2P communication.
  • FIG. 8 is a schematic structural diagram of another embodiment of a wireless access device that implements P2P communication by using NAT.
  • the wireless access device 700 includes a first detecting module 701, a reporting module 702, and a first receiving module 703. a sending module 704, a second detecting module 705, a first communications module 706, and a second communications module 707, wherein the first detecting module 701, the reporting module 702, the first receiving module 703, the first sending module 704, and the second detecting
  • the module 705 and the first communication module 706 are specifically as shown in FIG.
  • the second communication module 707 is configured to perform P2P communication directly with the associated terminal when the second detecting module 705 detects the receipt of the response.
  • the wireless access device and the associated terminal can directly communicate.
  • FIG. 9 is a schematic structural diagram of another embodiment of a wireless access device that implements P2P communication by using NAT.
  • the wireless access device 700 includes a first detecting module 701, a reporting module 702, and a first receiving module 703. a sending module 704, a second detecting module 705, a first communications module 706, a first confirming module 708, and a second confirming module 709, wherein the first detecting module 701, the reporting module 702, the first receiving module 703, and the first sending The module 704, the second detecting module 705 and the first communication module 706 are specifically as shown in FIG. 7.
  • the first confirmation module 708 is configured to: before the first sending module 704 sends the request message to the public network address of the associated terminal, confirm that the associated terminal is in the private network according to the network type of the associated terminal; wherein the response is The packet also carries the network type of the associated terminal;
  • the network type includes a private network and a public network.
  • the second confirmation module 709 is configured to update the public network address of the associated terminal according to the public network address of the associated terminal.
  • the wireless access device compares the public network address of the associated terminal with the public network address of the associated terminal that was previously stored by the wireless access device, and finds that the public network address of the associated terminal is updated.
  • FIG. 10 is a schematic structural diagram of an embodiment of a first detecting module in a wireless access device that implements P2P communication by using NAT, and the first detecting module 701 includes a requesting submodule 7011 and a detecting submodule 7012.
  • a request submodule 7011 configured to send a request message to the server
  • the detecting sub-module 7012 is configured to continue sniffing in N/2 seconds if the response of the server is not received within N seconds, continuously sniffing the preset number of times, and still not receiving the response from the server,
  • the network is unreachable; if the response of the server is received after a delay of N seconds, the N seconds is a heartbeat period.
  • the server 1100 includes a second receiving module 1101, an updating module 1102, a second sending module 1103, and a receiving notification module 1104.
  • the second receiving module 1101 is configured to receive, according to a heartbeat period, TCP application layer information reported by the wireless access device;
  • the TCP application layer information includes: a device status, a function mask, a network address (IP address), a physical address, and the like.
  • the update module 1102 is configured to update an associated forwarding table of the associated terminal according to the TCP application layer information.
  • the server compares the source address of the data packet with the network address in the TCP application layer information.
  • the server is the same, it is a public network, and at the same time, a private network.
  • the source address of the data packet is the outermost NAT mapping address, and is also the public network address of the wireless access device.
  • a second sending module 1103, configured to send a response packet to the wireless access device, so that the wireless access device sends a request packet to a public network address of the associated terminal, where the response packet carries a message Describe the public network address of the associated terminal;
  • the response packet carries a public network address of the associated terminal.
  • the receiving notification module 1104 is configured to notify the associated terminal to initiate a heartbeat sniffing packet according to the heartbeat period after receiving the request notification message of the wireless access device, when the wireless access device does not receive a response.
  • the NAT is convenient for the wireless access device to perform P2P communication with the associated terminal.
  • the receiving notification module 1104 after receiving the request of the wireless access terminal, notifies the associated terminal to initiate the heartbeat sniffing packet to penetrate the NAT according to the heartbeat period according to the request.
  • the server 1100 includes a second receiving module 1101, an updating module 1102, a second sending module 1103, a receiving notification module 1104, a third receiving module 1105, and a comparison determining module 1106.
  • the second receiving module 1101 and the updating module 1102 The second sending module 1103 and the receiving notification module 1104 are specifically as shown in FIG.
  • the third receiving module 1105 is configured to receive the TCP application layer packet information before the update module 1102 updates the associated forwarding table of the associated terminal according to the TCP application layer information, where the TCP application layer packet information includes a network. Address information;
  • the TCP application layer packet information includes network address information.
  • the comparison determining module 1106 is configured to compare the pre-stored data source address with the network address information to determine a network type, where the data source address is a public network address that is mapped by the wireless access device through NAT.
  • the network type is a public network, and at the same time, the network type is a private network.
  • the server 1100 includes a second receiving module 1101, an updating module 1102, a second sending module 1103, a receiving notification module 1104, and a notification module. 1107, wherein the second receiving module 1101, the updating module 1102, the second sending module 1103, and the receiving notification module 1104 are specifically as shown in FIG.
  • the notification module 1107 is configured to: after the update module 1102 updates the associated forwarding table of the associated terminal according to the TCP application layer information, notify the associated terminal of the updated content of the associated forwarding table of the associated terminal.
  • FIG. 14 is a schematic structural diagram of an embodiment of a system for implementing P2P communication by using NAT in the present invention.
  • the system 1300 includes a wireless access device 600 and a server 1000.
  • the wireless access device 600 is located on the internal network and may be a router. Or gateway, etc.
  • the wireless access device 600 is configured to detect a NAT heartbeat period, and report the TCP application layer information to the server 1100 according to the NAT heartbeat period, so that the server 1100 updates the associated forwarding table of the associated terminal according to the TCP application layer information. Meanwhile, the receiving server 1100 The response message carries the public network address of the associated terminal; and sends a request message to the public network address of the associated terminal to detect whether a response is received; when the detection does not receive a response, the response is passed. The mode or request server 1100 notifies the associated terminal to initiate heartbeat sniffing packet penetration to itself according to the heartbeat period.
  • the NAT implements P2P communication with the associated terminal; when the detection receives a response, directly performs P2P communication with the associated terminal.
  • the detecting, by the wireless access device 600, the NAT heartbeat period includes: sending a request message to the server 1100. If the server 1100 does not receive the response within N seconds, the device continues to sniff in N/2 seconds to continuously sniff the preset. The number of times, if the response of the server 1100 is still not received, the network is considered unreachable; if the response of the server 1100 is received after a delay of N seconds, the N seconds is a heartbeat period.
  • the wireless access device 600 is further configured to: before the sending the request message to the public network address of the associated terminal, confirm that the associated terminal is in the private network according to the network type of the associated terminal; wherein the response packet is further carried The network type of the associated terminal; the public network address of the associated terminal is updated according to the public network address of the associated terminal.
  • the server 1100 is configured to receive the TCP application layer information reported by the wireless access device 600 according to the heartbeat period; update the associated forwarding table of the associated terminal according to the TCP application layer information; and send a response packet to the wireless access device 600, so that The wireless access device 600 sends a request message to the public network address of the associated terminal, where the response message carries the public network address of the associated terminal; when the wireless access device 600 does not receive the response, the wireless access device receives the wireless message.
  • the associated terminal is notified to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period, so that the wireless access device 600 can perform P2P communication with the associated terminal.
  • the server 1100 is further configured to: before the update forwarding table of the associated terminal is updated according to the TCP application layer information, receive the TCP application layer packet information; where the TCP application layer packet information includes network address information; The pre-stored data packet source address is compared with the network address information to determine a network type.
  • the data packet source address is a public network address that is mapped by the wireless access device through NAT.
  • the server 1100 is further configured to: after updating the associated forwarding table of the associated terminal according to the TCP application layer information, notify the associated terminal of the updated content of the associated forwarding table of the associated terminal.
  • CMOS complementary metal-oxide-semiconductor
  • PAL Programmable Array Logic
  • GAL Generic Array Logic
  • FPGA Field-Programmable Gate Array
  • Complex Complex Programmable Logic Device
  • CPLD Programmable Logic Device

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Small-Scale Networks (AREA)

Abstract

Disclosed is a method for implementing P2P communication by going through a NAT. The method comprises: a wireless access device detects a NAT heartbeat cycle; TCP application layer information is submitted to a server according to the NAT heartbeat cycle, thus allowing the server to update an associative forwarding table of an associated terminal; a response packet of the server is received, the response packet carrying a public network address of the associated terminal; a request packet is transmitted to the public network address of the associated terminal; and, upon detecting that no response is received, by means of a relay mode or a request to the server, the associated terminal is notified to launch to self a heartbeat sniffing packet going through a NAT according to the heartbeat cycle, thus implementing P2P communication with the associated terminal. The technical solution of the present invention not only allows going through NAT of all types and connecting in series cascading NAT devices, but also has no special requirement with respect to devices and network environment, and also inexpensively promotes application.

Description

一种通过穿透NAT实现P2P通信的方法、设备、服务器及***Method, device, server and system for realizing P2P communication by penetrating NAT 技术领域Technical field
本发明涉及穿透NAT实现P2P通信技术领域,尤其涉及一种穿透NAT实现P2P通信的方法、设备、服务器及***。The present invention relates to the field of P2P communication technology for implementing NAT, and in particular, to a method, device, server and system for implementing P2P communication through NAT.
背景技术Background technique
NAT(Network Address Translator,网络地址转换),它是一种把内部私有网络IP地址翻译成公有网络IP地址的技术,在IP地址日益缺乏的情况下,NAT的主要目的是使地址能够重用,IP地址可分为公有地址和私有地址,私有地址用于内网,不同的内网,私有地址可重用,从而节省了公有地址,但私有地址不可在公网中被路由,所以内网的主机要访问公网的服务器,便要经过NAT,公有地址是全球唯一的,能在公网上被路由。NAT (Network Address Translator), which is a technology for translating an internal private network IP address into a public network IP address. In the case of an increasingly lacking IP address, the main purpose of NAT is to enable the address to be reused. The address can be divided into a public address and a private address. The private address is used for the intranet. Different intranets and private addresses can be reused, thereby saving the public address. However, the private address cannot be routed in the public network, so the host of the intranet needs to be To access the public network server, you have to go through NAT. The public address is globally unique and can be routed on the public network.
内网主机用私有地址在内网能与其它内网主机无误地通信,但内网主机要与外网通信,必须经过NAT设备(如网关、路由器)。例如,内网主机A要与外网服务器S通信,必须先通过网关,此时网关改变的数据包地址及端口,把私有地址改为公有地址,使数据包能够在公网上被路由,送至外网服务器S。外网服务器S返回的数据包到达网关后,网关把公有地址改为相应的私有地址,然后转发到内网主机A。如此,一个内网只需一个公有IP地址,就把整个内网的终端接入外网,从而解决了IP地址缺乏的问题。The intranet host uses the private address to communicate with other intranet hosts without error, but the intranet host must communicate with the external network and must pass through NAT devices (such as gateways and routers). For example, if the intranet host A wants to communicate with the external network server S, it must first pass through the gateway. At this time, the gateway changes the packet address and port, and changes the private address to the public address, so that the data packet can be routed on the public network and sent to the public network. External network server S. After the data packet returned by the external network server S arrives at the gateway, the gateway changes the public address to the corresponding private address, and then forwards it to the intranet host A. In this way, an intranet only needs a public IP address to access the entire intranet terminal to the external network, thereby solving the problem of lack of IP address.
目前,NAT功能常被集成到路由器、防火墙、ISDN(Integrated Services Digital Network,综合业务数字网)路由器或者单独的NAT设备中,NAT可分为基本的NAT和NAPT(Network Address/Port Translator)。At present, NAT functions are often integrated into routers, firewalls, ISDN (Integrated Services Digital Network) routers or separate NAT devices. NAT can be divided into basic NAT and NAPT (Network Address/Port Translator).
基本的NAT,它仅将内网主机的私有IP地址转换成公网IP地址,但并不将TCP/UDP端口信息进行转换,有动态与静态之区分。由于现在大部分都属于另一种类型,即NAPT,故这里不详细讨论基础NAT。 Basic NAT, which only converts the private IP address of the intranet host into a public IP address, but does not convert the TCP/UDP port information. There is a distinction between dynamic and static. Since most of the current types belong to another type, namely NAPT, the basic NAT is not discussed in detail here.
另外一种NAT叫做NAPT,从名称上我们也可以看得出,NAPT不但会改变经过这个NAT设备的IP数据包的IP地址,还会改变IP数据包的TCP/UDP端口。Another kind of NAT is called NAPT. From the name, we can also see that NAPT will not only change the IP address of the IP packet passing through the NAT device, but also change the TCP/UDP port of the IP packet.
例如,私有网络中某一主机Client A(10.0.0.2),它的某个进程通过1234端口,想访问外网服务器18.181.0.31的1235端口。那么当数据包通过NAT时,这个NAT的外网地址是155.99.25.11,首先NAT会改变这个数据包的原IP地址,改为155.99.25.11。并分配一个端口(如62000)给Client A,把数据包的原端口号改为62000。所以本来是(10.0.0.2:1234->18.181.0.31:1235)的数据包到了互联网上变为了(155.99.25.11:62000->18.181.0.31:1235)。NAT会记住62000端口对应的是10.0.0.2的1234端口,以后从外网服务器18.181.0.31发送到62000端口的数据会被NAT自动的改变目的IP和端口号,然后转发到10.0.0.2上。For example, a host in the private network, Client A (10.0.0.2), has a certain process that passes through port 1234 and wants to access port 1235 of the external network server 18.181.0.31. Then, when the data packet passes through NAT, the NAT external network address is 155.99.25.11. First, NAT will change the original IP address of the data packet to 155.99.25.11. And assign a port (such as 62000) to Client A, and change the original port number of the packet to 62000. So the packet that was originally (10.0.0.2:1234->18.181.0.31:1235) went to the Internet and became (155.99.25.11:62000->18.181.0.31:1235). NAT will remember that the 62000 port corresponds to the port 1234 of 10.0.0.2, and the data sent from the external network server 18.181.0.31 to the 62000 port will be automatically changed by the NAT to change the destination IP and port number, and then forwarded to 10.0.0.2.
NAPT又分为锥型(Cone)和对称型(Symmetric),它们的区别在于,在NAT已分配端口号给Client A的情况下,如果Client A继续用1235端口与另一外网服务器通讯,锥型NAT还会继续用原来62000端口,即所分配的端口号不变。而对于对等型NAT,NAT将会分配另一端口号(如62001)给Client A的1235端口。也就是说,同一内网主机同一端口号,对于锥型NAT,无论与哪一外网主机通讯,都不改变所分配的端口号;而对于对等型NAT,同一内网主机同一端口号,每一次与不同的外网主机通信,就重新分配另一个端口号。NAPT is divided into Cone and Symmetric. The difference is that if NAT has assigned port number to Client A, if Client A continues to communicate with another external server using port 1235, the cone Type NAT will continue to use the original 62000 port, that is, the assigned port number does not change. For peer-to-peer NAT, NAT will assign another port number (such as 62001) to Client A's port 1235. That is to say, the same intranet host has the same port number. For the cone NAT, no matter which external network host communicates, the assigned port number is not changed. For the peer NAT, the same intranet host has the same port number. Each time it communicates with a different external host, it reassigns another port number.
锥型NAT可另外分类为完全锥形(Full Cone)NAT,受限制锥形(Restricted Cone)NAT,端口受限制锥形(Port Restricted Cone)NAT。Cone-type NAT can be additionally classified as Full Cone NAT, Restricted Cone NAT, and Port Restricted Cone NAT.
完全锥形(Full Cone)NATFull Cone NAT
这种NAT内部的主机A连接过外网主机C后,NAT会打开一个端口。然后外网的任何发到这个打开的端口的UDP数据报都可以到达A,不管是不是C发过来的。After Host A inside the NAT connects to the external host C, NAT will open a port. Then any UDP datagram sent by the external network to this open port can reach A, whether it is sent by C or not.
受限制锥形(Restricted Cone)NATRestricted Cone NAT
这种NAT内部的主机A连接过外网的主机C后,NAT打开一个端口。然后C可以用任何端口和A通信,但其他的外网主机不可以。 After Host A inside the NAT connects to Host C of the external network, NAT opens a port. Then C can communicate with A using any port, but other external hosts cannot.
端口受限制锥形(Port Restricted Cone)NATPort Restricted Cone NAT
这种NAT内部的主机A连接过外网的主机C后,NAT打开一个端口。然后C只能用原来的端口和A通信,其他的外网主机不可以。After Host A inside the NAT connects to Host C of the external network, NAT opens a port. Then C can only communicate with A using the original port, and other external hosts cannot.
NAT很好地解决了地址紧缺的问题,还能够有效避免来自网络外部的攻击,隐藏并保护网络内部的计算机。同时,NAT也阻碍了外网到内网的直接访问,例如:CDN P2P分布式传输和和服务器主动推送等。NAT solves the problem of address shortage well, and can effectively avoid attacks from outside the network, hiding and protecting computers inside the network. At the same time, NAT also hinders direct access from the external network to the internal network, such as CDN P2P distributed transmission and server active push.
NAT穿透是实现P2P通信的主要方案,常用方案是ICE(The Internet Communications Engine,互联网通信引擎)和UPnP。NAT penetration is the main solution for implementing P2P communication. Commonly used solutions are ICE (The Internet Communications Engine) and UPnP.
ICE穿透要求外网服务器是双网卡配置,这将带来更多的安全风险,内网终端要求有兼容环境的存储空间。例如:嵌入式设备上运行开源程序,如果是用不同语言实现的,需要加载基本库。这在低成本的嵌入式项目中,将影响实际应用。ICE penetration requires that the external network server is a dual network card configuration, which will bring more security risks, and the internal network terminal requires a storage space compatible with the environment. For example, an open source program is run on an embedded device. If it is implemented in a different language, the base library needs to be loaded. This will affect the actual application in low-cost embedded projects.
UPnP可以穿透UDP/TCP和对称型,但却不支持串联的NAT设备。UPnP can penetrate UDP/TCP and symmetric, but does not support tandem NAT devices.
常用的内网NAT穿透方案有:Common intranet NAT penetration schemes are:
1)ICE(STUN+TURN)1) ICE (STUN+TURN)
STUN(Simple Traversal of UDP over NAT,NAT的UDP简单穿越)是一种网络协议,可以穿透TCP NAT的圆锥型和受限锥型,不能穿透UDP和对称型。这里,不考虑UDP NAT穿透,假设没有对称型防火墙或阻塞型,则需要TURN(Traversal Using Relays around NAT,使用中继穿透NAT)中继的概率是1/8=1/2*1/4(对称型NAT),具体如图1所示,具体步骤如下:STUN (Simple Traversal of UDP over NAT) is a network protocol that can penetrate the conical and restricted cones of TCP NAT and cannot penetrate UDP and symmetry. Here, regardless of UDP NAT penetration, assuming that there is no symmetric firewall or blocking type, the probability of TURN (Traversal Using Relays around NAT) relaying is 1/8=1/2*1/ 4 (symmetric NAT), as shown in Figure 1, the specific steps are as follows:
步骤S101,客户端向服务器请求NAT映射后的公网地址;Step S101, the client requests the public network address after the NAT mapping to the server;
步骤S102,判断是否收到应答?如果收到进入步骤S104,否则进入步骤S103;In step S102, it is determined whether a response is received. If the process proceeds to step S104, otherwise proceeds to step S103;
步骤S103,确认为阻塞型,网络断路或UDP/TCP报文被防火墙阻断;Step S103, confirming that it is blocked, and the network disconnection or UDP/TCP packet is blocked by the firewall;
步骤S104,确认为非阻塞型,比较客户端外网地址和NAT映射后的公网;Step S104, confirming that it is non-blocking type, comparing the external network address of the client and the public network after NAT mapping;
步骤S105,判断地址是否相同?如果相同进入步骤S106,否则进入步骤 S111;In step S105, it is determined whether the addresses are the same? If the same goes to step S106, otherwise enter the step S111;
步骤S106,确认为公网,没有NAT设备;Step S106, confirming that it is a public network, and there is no NAT device;
步骤S107,客户端向服务器请求从其他IP地址和Port端口回复包;Step S107, the client requests the server to reply the packet from another IP address and the port port;
步骤S108,判断是否收到应答?如果收到进入步骤S109,否则进入步骤S110;In step S108, it is determined whether a response is received. If the process proceeds to step S109, otherwise proceeds to step S110;
步骤S109,确认为开放型,客户端在开放网络上;Step S109, confirming that it is an open type, and the client is on an open network;
步骤S110,确认为对称型PW,UDP/TCP报文被前置防火墙阻断;Step S110, confirming that it is a symmetric PW, and the UDP/TCP packet is blocked by the front firewall;
步骤S111,确认为私网,有NAT设备;Step S111, confirming that it is a private network, and having a NAT device;
步骤S112,客户端向服务器请求从其他IP和Port回复包;Step S112, the client requests the server to reply the packet from the other IP and the port;
步骤S113,判断是否收到应答?如果收到进入步骤S114,否则进入步骤步骤S115;In step S113, it is determined whether a response is received. If the process proceeds to step S114, otherwise proceeds to step S115;
步骤S114,确认为完全锥形,NAT设备是完全开放的;Step S114, confirming that it is completely tapered, and the NAT device is completely open;
步骤S115,确认为受限NAT,NAT设备是受限开放的;Step S115, confirming that the NAT is restricted, the NAT device is restricted open;
步骤S116,客户端向服务器的另一个IP请求NAT映射后的公网地址,比较客户端外网地址和NAT映射后的公网地址;Step S116, the client requests a NAT-mapped public network address from another IP address of the server, and compares the client external network address and the public network address after NAT mapping;
步骤S117,判断地址是否相同?如果相同进入步骤S119,否则进入步骤S118;In step S117, it is determined whether the addresses are the same? If the same goes to step S119, otherwise proceeds to step S118;
步骤S118,对称锥形NAT,UDP/TCP报文被前置NAT设备阻断;Step S118, the symmetric cone NAT, the UDP/TCP packet is blocked by the pre-NAT device;
步骤S119,确认为受限锥形;Step S119, confirming to be a restricted taper;
步骤S120,客户端向服务器请求从相同地址和不同端口回复包;Step S120, the client requests the server to reply the packet from the same address and different ports;
步骤S121,判断地址相同吗?如果相同进入步骤S122,否则进入步骤S123;In step S121, is the same address determined? If the same goes to step S122, otherwise proceeds to step S123;
步骤S122,确认为地址受限锥形;Step S122, confirming that the address is limited in cone shape;
步骤S123,确认为端口受限锥形。In step S123, it is confirmed that the port is limited in cone shape.
STUN协议需要外网服务器配置双网卡,用于内网终端的NAT类型检测。 开源版本“RFC3489:stund-0.97”和“RFC5389:stunserver”都是基于C++实现,运行要有C++Lib库支持,编译大小是1M多,不适用于低成本嵌入式设备项目。The STUN protocol requires an external network server to configure a dual NIC for NAT type detection of the intranet terminal. The open source versions "RFC3489: stund-0.97" and "RFC5389: stunserver" are based on C++ implementation. The operation requires C++Lib library support. The compilation size is more than 1M, which is not suitable for low-cost embedded device projects.
2)UPnP(即插即用)2) UPnP (plug and play)
UPnP是开放的设备互联协议,基于TCP/IP且不需要驱动。开启UPnP功能的NAT设备,内网终端可以让NAT网关做自动端口映射。UPnP协议簇实现互联互通,就是将内网终端的外网地址广播公告出去。UPnP可以穿透UDP/TCP NAT和对称型NAT,穿透效率很高,但应用场景有限。在串联多级NAT设备的情况下,需要每级都打开UPnP功能请求自动端口映射,外网服务器才能获知内网终端的公网地址。但事实上,外层NAT设备是不可预知和控制的。UPnP is an open device interconnection protocol based on TCP/IP and does not require drivers. Enable the NAT device of the UPnP function. The intranet terminal allows the NAT gateway to perform automatic port mapping. The UPnP protocol cluster realizes interconnection and intercommunication, that is, the external network address of the intranet terminal is broadcast and announced. UPnP can penetrate UDP/TCP NAT and symmetric NAT, and the penetration efficiency is very high, but the application scenario is limited. In the case of a series of multi-level NAT devices, it is necessary to open the UPnP function request automatic port mapping for each level, and the external network server can know the public network address of the internal network terminal. But in fact, the outer NAT device is unpredictable and controllable.
发明内容Summary of the invention
本发明所要解决的技术问题穿透所有类型NAT及多级串联NAT设备,且不对设备和网络环境提出额外要求,同时解决低成本推广应用问题。The technical problem to be solved by the present invention penetrates all types of NAT and multi-level serial NAT devices, and does not impose additional requirements on devices and network environments, and solves the problem of low-cost promotion and application.
为了解决上述问题,本发明提供了一种通过穿透NAT实现P2P通信的方法,所述方法包括:In order to solve the above problems, the present invention provides a method for implementing P2P communication by penetrating NAT, the method comprising:
无线接入设备检测NAT心跳周期;The wireless access device detects a NAT heartbeat period;
并按照所述NAT心跳周期向服务器上报TCP应用层信息,以便所述服务器根据所述TCP应用层信息更新关联终端的关联转发表;And reporting the TCP application layer information to the server according to the NAT heartbeat period, so that the server updates the associated forwarding table of the associated terminal according to the TCP application layer information;
接收所述服务器的响应报文,所述响应报文携带所述关联终端的公网地址;Receiving a response packet of the server, where the response packet carries a public network address of the associated terminal;
向所述关联终端的公网地址发送请求报文;Sending a request message to the public network address of the associated terminal;
并在检测没有收到回应时,通过中继模式或请求所述服务器通知所述关联终端按照所述心跳周期向自身发起心跳嗅探包穿透NAT,实现与所述关联终端进行P2P通信。And detecting that the response is not received, by using the relay mode or requesting the server to notify the associated terminal to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period, to implement P2P communication with the associated terminal.
可选的,所述方法还包括:在检测收到回应时,则直接与所述关联终端 进行P2P通信。Optionally, the method further includes: directly detecting the received terminal when detecting the received response Perform P2P communication.
可选的,在向所述关联终端的公网地址发送请求报文之前,所述方法还包括:Optionally, before the sending the request message to the public network address of the associated terminal, the method further includes:
所述响应报文还携带所述关联终端的网络类型;The response packet further carries a network type of the associated terminal;
根据所述关联终端的网络类型确认所述关联终端在私网;Confirming, according to the network type of the associated terminal, that the associated terminal is in a private network;
根据所述关联终端的公网地址确认更新了所述关联终端的公网地址。And confirming that the public network address of the associated terminal is updated according to the public network address of the associated terminal.
可选的,所述关联终端包括主设备及至少一个关联设备,所述关联终端的关联转发表格式为:Optionally, the associated terminal includes a primary device and at least one associated device, and the associated forwarding table format of the associated terminal is:
{编号;{Numbering;
主设备标识,公网地址,网络类型,心跳周期;Primary device ID, public network address, network type, heartbeat period;
第一关联设备标识,公网地址,网络类型,心跳周期;First associated device identifier, public network address, network type, heartbeat period;
……}。......}.
可选的,所述无线接入设备检测NAT心跳周期,具体包括:Optionally, the detecting, by the wireless access device, a NAT heartbeat period includes:
所述无线接入设备向所述服务器发送请求报文;Sending, by the wireless access device, a request message to the server;
如果在N秒内没有收到所述服务器的回应,则以N/2秒继续嗅探,连续嗅探预设次数,仍没有收到所述服务器的回应,则认为网络不可达;If the response of the server is not received within N seconds, the sniffing is continued in N/2 seconds, the preset number of times is continuously sniffed, and the response of the server is still not received, and the network is considered unreachable;
如果延迟N秒收到所述服务器的回应,则所述N秒为心跳周期。If the response of the server is received after a delay of N seconds, the N seconds is a heartbeat period.
本发明还提供了一种通过穿透NAT实现P2P通信的方法,所述方法包括:The present invention also provides a method for implementing P2P communication by penetrating NAT, the method comprising:
按照心跳周期接收无线接入设备上报的TCP应用层信息;Receiving, by the heartbeat period, the TCP application layer information reported by the wireless access device;
根据所述TCP应用层信息更新关联终端的关联转发表;Updating an associated forwarding table of the associated terminal according to the TCP application layer information;
并向所述无线接入设备发送响应报文,以便所述无线接入设备向所述关联终端的公网地址发送请求报文;其中,所述响应报文携带所述关联终端的公网地址;Sending a response packet to the wireless access device, so that the wireless access device sends a request packet to the public network address of the associated terminal; wherein the response packet carries the public network address of the associated terminal ;
并在所述无线接入设备没有收到回应时,接收所述无线接入设备的请求报文后,通知所述关联终端按照所述心跳周期发起心跳嗅探包穿透NAT,便 于所述无线接入设备与所述关联终端进行P2P通信。After receiving the request message of the wireless access device, the wireless terminal device notifies the associated terminal to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period. And performing, by the wireless access device, P2P communication with the associated terminal.
可选的,在根据所述TCP应用层信息更新关联终端的关联转发表之前,所述方法还包括:Optionally, before updating the associated forwarding table of the associated terminal according to the TCP application layer information, the method further includes:
接收所述TCP应用层报文信息;其中,所述TCP应用层报文信息包括网络地址信息;Receiving the TCP application layer packet information, where the TCP application layer packet information includes network address information;
将预存的数据包源地址与所述网络地址信息进行比较确定网络类型;Comparing the pre-stored data source address with the network address information to determine a network type;
所述数据包源地址为所述无线接入设备通过NAT映射后的公网地址。The source address of the data packet is a public network address that is mapped by the wireless access device through NAT.
可选的,在根据所述TCP应用层信息更新关联终端的关联转发表之后,所述方法还包括:Optionally, after updating the associated forwarding table of the associated terminal according to the TCP application layer information, the method further includes:
将所述关联终端的关联转发表的更新内容通知给所述关联终端。Notifying the associated terminal of the updated content of the associated forwarding table of the associated terminal.
本发明还提供了一种通过穿透NAT实现P2P通信的无线接入设备,所述无线接入设备包括:The present invention also provides a wireless access device that implements P2P communication by penetrating NAT, and the wireless access device includes:
第一检测模块,用于检测NAT心跳周期;a first detecting module, configured to detect a NAT heartbeat period;
上报模块,用于按照所述第一检测模块检测的NAT心跳周期向服务器上报TCP应用层信息,以便所述服务器根据所述TCP应用层信息更新关联终端的关联转发表;The reporting module is configured to report the TCP application layer information to the server according to the NAT heartbeat period detected by the first detecting module, so that the server updates the associated forwarding table of the associated terminal according to the TCP application layer information;
第一接收模块,用于接收所述服务器的响应报文,所述响应报文携带所述关联终端的公网地址;a first receiving module, configured to receive a response packet of the server, where the response packet carries a public network address of the associated terminal;
第一发送模块,用于向所述关联终端的公网地址发送请求报文;a first sending module, configured to send a request message to a public network address of the associated terminal;
第二检测模块,检测是否收到回应;a second detecting module that detects whether a response is received;
第一通信模块,用于当所述第二检测模块检测没有收到回应时,通过中继模式或请求所述服务器通知所述关联终端按照所述心跳周期向自身发起心跳嗅探包穿透NAT,实现与所述关联终端进行P2P通信。a first communication module, configured to: when the second detection module detects that no response is received, by using a relay mode or requesting the server to notify the associated terminal to initiate a heartbeat sniffing packet to penetrate NAT according to the heartbeat period And implementing P2P communication with the associated terminal.
可选的,所述无线接入设备还包括:Optionally, the wireless access device further includes:
第二通信模块,用于当所述第二检测模块检测收到回应时,直接与所述关联终端进行P2P通信。 The second communication module is configured to perform P2P communication directly with the associated terminal when the second detecting module detects the receipt of the response.
可选的,所述无线接入设备还包括:Optionally, the wireless access device further includes:
第一确认模块,用于所述第一发送模块向所述关联终端的公网地址发送请求报文之前,根据所述关联终端的网络类型确认所述关联终端在私网;其中,所述响应报文还携带所述关联终端的网络类型;a first confirmation module, configured to: after the first sending module sends a request message to the public network address of the associated terminal, confirm that the associated terminal is in a private network according to a network type of the associated terminal; wherein the response The packet also carries the network type of the associated terminal;
第二确认模块,用于根据所述关联终端的公网地址确认更新了所述关联终端的公网地址。The second confirmation module is configured to update the public network address of the associated terminal according to the public network address of the associated terminal.
可选的,所述第一检测模块包括:Optionally, the first detecting module includes:
请求子模块,用于向所述服务器发送请求报文;a requesting submodule, configured to send a request message to the server;
检测子模块,用于如果在N秒内没有收到所述服务器的回应,则以N/2秒继续嗅探,连续嗅探预设次数,仍没有收到所述服务器的回应,则认为网络不可达;如果延迟N秒收到所述服务器的回应,则所述N秒为心跳周期。The detecting submodule is configured to continue sniffing in N/2 seconds if the response of the server is not received within N seconds, continuously sniffing the preset number of times, and still not receiving the response from the server, then the network is considered Unreachable; if the response of the server is received after a delay of N seconds, the N seconds is a heartbeat period.
可选的,本发明还提出了一种通过穿透NAT实现P2P通信的服务器,其特征在于,所述服务器包括:Optionally, the present invention further provides a server for implementing P2P communication by penetrating NAT, wherein the server includes:
第二接收模块,用于按照心跳周期接收无线接入设备上报的TCP应用层信息;a second receiving module, configured to receive, according to a heartbeat period, TCP application layer information reported by the wireless access device;
更新模块,用于根据所述TCP应用层信息更新关联终端的关联转发表;An update module, configured to update an associated forwarding table of the associated terminal according to the TCP application layer information;
第二发送模块,用于向所述无线接入设备发送响应报文,以便所述无线接入设备向所述关联终端的公网地址发送请求报文;其中,所述响应报文携带所述关联终端的公网地址;a second sending module, configured to send a response packet to the wireless access device, so that the wireless access device sends a request packet to a public network address of the associated terminal, where the response packet carries the The public network address of the associated terminal;
接收通知模块,用于在所述无线接入设备没有收到回应时,接收所述无线接入设备的请求通知报文后,通知所述关联终端按照所述心跳周期发起心跳嗅探包穿透NAT,便于所述无线接入设备与所述关联终端进行P2P通信。Receiving a notification module, configured to notify the associated terminal to initiate heartbeat sniffing packet penetration according to the heartbeat period, after receiving the request notification message of the wireless access device, when the wireless access device does not receive a response The NAT facilitates P2P communication between the wireless access device and the associated terminal.
可选的,所述服务器还包括:Optionally, the server further includes:
第三接收模块,用于在所述更新模块根据所述TCP应用层信息更新关联终端的关联转发表之前,接收所述TCP应用层报文信息;其中,所述TCP应用层报文信息包括网络地址信息; a third receiving module, configured to receive the TCP application layer packet information, where the update application module updates the associated forwarding table of the associated terminal according to the TCP application layer information, where the TCP application layer packet information includes a network Address information;
比较确定模块,用于将预存的数据包源地址与所述网络地址信息进行比较确定网络类型;其中,所述数据包源地址为所述无线接入设备通过NAT映射后的公网地址。And a comparison determining module, configured to compare the pre-stored data source address with the network address information to determine a network type, where the data source address is a public network address that is mapped by the wireless access device through NAT.
可选的,所述服务器还包括:Optionally, the server further includes:
通知模块,用于所述更新模块根据所述TCP应用层信息更新关联终端的关联转发表之后,将所述关联终端的关联转发表的更新内容通知给所述关联终端。And a notification module, configured to: after the update module updates the associated forwarding table of the associated terminal according to the TCP application layer information, notify the associated terminal of the updated content of the associated forwarding table of the associated terminal.
本发明还提供了一种通过穿透NAT实现P2P通信的***,所述***包括无线接入设备和服务器,The present invention also provides a system for implementing P2P communication by penetrating NAT, the system comprising a wireless access device and a server,
所述无线接入设备为上述所述的无线接入设备;The wireless access device is the wireless access device described above;
所述服务器为上述所述的服务器。The server is the server described above.
与现有技术相比,本发明的技术方案具有以下优点:Compared with the prior art, the technical solution of the present invention has the following advantages:
不仅能够穿透所有类型NAT及串联多级NAT设备,同时对设备和网络环境也没有特殊要求,并且可以低成本推广应用。Not only can it penetrate all types of NAT and serial multi-level NAT devices, but also has no special requirements for devices and network environments, and can promote applications at low cost.
附图说明DRAWINGS
图1是传统NAT映射后网络状况、及各种NAT类型的判断方式的流程示意图;FIG. 1 is a schematic flowchart of a network state after a traditional NAT mapping and a manner of determining various NAT types;
图2是本发明通过穿透NAT实现P2P通信的方法的一种实施例的流程示意图;2 is a schematic flow chart of an embodiment of a method for implementing P2P communication by penetrating NAT according to the present invention;
图3是本发明通过穿透NAT实现P2P通信的方法的另一种实施例的流程示意图;3 is a schematic flow chart of another embodiment of a method for implementing P2P communication by penetrating NAT according to the present invention;
图4是本发明通过穿透NAT实现P2P通信的方法中向所述关联终端的公网地址发送请求报文之前的进一步处理方法的流程示意图;4 is a schematic flowchart of a further processing method before sending a request message to a public network address of the associated terminal in a method for implementing P2P communication by using NAT;
图5是本发明通过穿透NAT实现P2P通信的方法的另一种实施例的流程示意图; 5 is a schematic flow chart of another embodiment of a method for implementing P2P communication by penetrating NAT according to the present invention;
图6是本发明通过穿透NAT实现P2P通信的方法中根据所述TCP应用层信息更新关联终端的关联转发表之前进一步处理方法的流程示意图;6 is a schematic flowchart of a further processing method before updating an associated forwarding table of an associated terminal according to the TCP application layer information in the method for implementing P2P communication by using NAT;
图7是本发明通过穿透NAT实现P2P通信的无线接入设备的一种实施例的结构示意图;7 is a schematic structural diagram of an embodiment of a wireless access device for implementing P2P communication by penetrating NAT according to the present invention;
图8是本发明通过穿透NAT实现P2P通信的无线接入设备的另一种实施例的结构示意图;8 is a schematic structural diagram of another embodiment of a wireless access device for implementing P2P communication by penetrating NAT according to the present invention;
图9是本发明通过穿透NAT实现P2P通信的无线接入设备的另一种实施例的结构示意图;9 is a schematic structural diagram of another embodiment of a wireless access device for implementing P2P communication by penetrating NAT according to the present invention;
图10是本发明通过穿透NAT实现P2P通信的无线接入设备中第一检测模块的一种实施例的结构示意图;10 is a schematic structural diagram of an embodiment of a first detecting module in a wireless access device that implements P2P communication by using NAT;
图11是本发明通过穿透NAT实现P2P通信的服务器的一种实施例的结构示意图;11 is a schematic structural diagram of an embodiment of a server for implementing P2P communication by penetrating NAT according to the present invention;
图12是本发明通过穿透NAT实现P2P通信的服务器的另一种实施例的结构示意图;12 is a schematic structural diagram of another embodiment of a server for implementing P2P communication by penetrating NAT according to the present invention;
图13是本发明通过穿透NAT实现P2P通信的服务器的另一种实施例的结构示意图;13 is a schematic structural diagram of another embodiment of a server for implementing P2P communication by penetrating NAT according to the present invention;
图14是本发明通过穿透NAT实现P2P通信的***的一种实施例的结构示意图。FIG. 14 is a schematic structural diagram of an embodiment of a system for implementing P2P communication by penetrating NAT according to the present invention.
具体实施方式detailed description
在下面的描述中阐述了很多具体细节以便于充分理解本发明。但是本发明能够以很多不同于在此描述的其它方式来实施,本领域技术人员可以在不违背本发明内涵的情况下做类似推广,因此本发明不受下面公开的具体实施的限制。Numerous specific details are set forth in the description below in order to provide a thorough understanding of the invention. However, the present invention can be implemented in many other ways than those described herein, and a person skilled in the art can make a similar promotion without departing from the spirit of the invention, and thus the invention is not limited by the specific embodiments disclosed below.
其次,本发明利用示意图进行详细描述,在详述本发明实施例时,为便于说明,所述示意图只是实例,其在此不应限制本发明保护的范围。 The present invention is described in detail with reference to the accompanying drawings, which are illustrated by way of example only, and are not intended to limit the scope of the invention.
为了解决背景技术中的技术问题穿透所有类型NAT及多级串联NAT设备,且不对设备和网络环境提出额外要求,同时解决低成本推广应用问题。本发明提供了一种通过穿透NAT实现P2P通信的方法、设备、服务器及***。In order to solve the technical problems in the background art, all types of NAT and multi-level serial NAT devices are penetrated, and no additional requirements are imposed on the device and the network environment, and the problem of low-cost promotion and application is solved at the same time. The present invention provides a method, device, server and system for implementing P2P communication by penetrating NAT.
下面结合附图和具体实施例对本发明的技术方案做进一步说明。The technical solutions of the present invention are further described below in conjunction with the accompanying drawings and specific embodiments.
图2是本发明通过穿透NAT实现P2P通信的方法的一种实施例的流程示意图,适于无线接入设备侧,具体步骤如下:FIG. 2 is a schematic flowchart of an embodiment of a method for implementing P2P communication by using NAT through the NAT, which is suitable for wireless access to the device side, and the specific steps are as follows:
步骤S201,无线接入设备检测NAT心跳周期;Step S201, the wireless access device detects a NAT heartbeat period;
具体地,所述无线接入设备检测NAT心跳周期,具体包括:Specifically, the detecting, by the wireless access device, a NAT heartbeat period includes:
所述无线接入设备向所述服务器发送请求报文;Sending, by the wireless access device, a request message to the server;
如果在N秒内没有收到所述服务器的回应,则以N/2秒继续嗅探,连续嗅探预设次数,仍没有收到所述服务器的回应,则认为网络不可达;If the response of the server is not received within N seconds, the sniffing is continued in N/2 seconds, the preset number of times is continuously sniffed, and the response of the server is still not received, and the network is considered unreachable;
如果延迟N秒收到所述服务器的回应,则所述N秒为心跳周期。If the response of the server is received after a delay of N seconds, the N seconds is a heartbeat period.
其中,这里,无线接入设备位于内网。Here, the wireless access device is located on the intranet.
步骤S202,并按照所述NAT心跳周期向服务器上报TCP应用层信息,以便所述服务器根据所述TCP应用层信息更新关联终端的关联转发表;Step S202, and reporting TCP application layer information to the server according to the NAT heartbeat period, so that the server updates the associated forwarding table of the associated terminal according to the TCP application layer information;
具体地,所述关联终端包括主设备及至少一个关联设备,所述关联终端的关联转发表格式为:Specifically, the associated terminal includes a master device and at least one associated device, and the associated forwarding table format of the associated terminal is:
{编号;{Numbering;
主设备标识,公网地址,网络类型,心跳周期;Primary device ID, public network address, network type, heartbeat period;
第一关联设备标识,公网地址,网络类型,心跳周期;First associated device identifier, public network address, network type, heartbeat period;
……}。......}.
其中,编号由服务器设定,另主设备标识及第一设备标识……为无线接入设备按心跳周期上报的报文中的物理地址;The number is set by the server, and the other device identifier and the first device identifier are the physical addresses in the packets reported by the wireless access device according to the heartbeat period;
其中,网络类型包括私网和公网,具体服务器将数据包源地址和TCP应用层信息中的网络地址进行比较,当相同时网络类型为公网,不同时网络类型为私网。 The network type includes a private network and a public network. The specific server compares the source address of the data packet with the network address in the TCP application layer information. When the network type is the public network, the network type is private.
步骤S203,接收所述服务器的响应报文,所述响应报文携带所述关联终端的公网地址;Step S203: Receive a response packet of the server, where the response packet carries a public network address of the associated terminal.
具体地,所述响应报文还携带网络类型。Specifically, the response message further carries a network type.
步骤S204,向所述关联终端的公网地址发送请求报文;Step S204: Send a request message to the public network address of the associated terminal.
具体地,所述关联终端包括:主设备标识及第一设备标识……。Specifically, the associated terminal includes: a primary device identifier and a first device identifier.
步骤S205,并在检测没有收到回应时,通过中继模式或请求所述服务器通知所述关联终端按照所述心跳周期向自身发起心跳嗅探包穿透NAT,实现与所述关联终端进行P2P通信。Step S205, and when detecting that no response is received, by using the relay mode or requesting the server to notify the associated terminal to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period, to implement P2P with the associated terminal. Communication.
具体地,当检测没有收到回应时,则确认为网络拥塞或NAT是受限型或对称型;其中,中继模式是通过中继使无线接入设备与关联终端接通,即绕开NAT,使无线接入设备可以与关联设备直接进行P2P通信;其中,关联终端按心跳周期向无线接入终端发起心跳嗅探包,即通过心跳连续的方式打通NAT,使关联终端与无线接入设备进行P2P通信;Specifically, when the detection does not receive the response, it is confirmed that the network congestion or the NAT is restricted or symmetric; wherein the relay mode is to enable the wireless access device to be connected to the associated terminal by using the relay, that is, bypassing the NAT The wireless access device can directly perform P2P communication with the associated device. The associated terminal initiates a heartbeat sniffing packet to the wireless access terminal according to a heartbeat cycle, that is, the NAT is opened through a heartbeat continuous manner, so that the associated terminal and the wireless access device are enabled. Perform P2P communication;
其中,无线接入设备在开始启动时,会向服务器请求关联终端的地址信息;并发起嗅探通信,记录连接时是否启用中继模式。When the wireless access device starts to start, it requests the address information of the associated terminal from the server; and initiates sniffing communication, and records whether the relay mode is enabled when the connection is made.
图3是本发明通过穿透NAT实现P2P通信的方法的另一种实施例的流程示意图,具体步骤如下:FIG. 3 is a schematic flowchart diagram of another embodiment of a method for implementing P2P communication by using NAT in the present invention, and the specific steps are as follows:
步骤S301,无线接入设备检测NAT心跳周期;Step S301, the wireless access device detects a NAT heartbeat period;
具体地,如步骤S201所示。Specifically, as shown in step S201.
步骤S302,并按照所述NAT心跳周期向服务器上报TCP应用层信息,以便所述服务器根据所述TCP应用层信息更新关联终端的关联转发表;Step S302, and reporting TCP application layer information to the server according to the NAT heartbeat period, so that the server updates the associated forwarding table of the associated terminal according to the TCP application layer information;
具体地,如步骤S202所示。Specifically, as shown in step S202.
步骤S303,接收所述服务器的响应报文,所述响应报文携带所述关联终端的公网地址;Step S303, receiving a response packet of the server, where the response packet carries a public network address of the associated terminal.
具体地,如步骤S203所示。Specifically, as shown in step S203.
步骤S304,向所述关联终端的公网地址发送请求报文; Step S304, sending a request message to the public network address of the associated terminal;
具体地,如步骤S204所示。Specifically, as shown in step S204.
步骤S305,并在检测没有收到回应时,通过中继模式或请求所述服务器通知所述关联终端按照所述心跳周期向自身发起心跳嗅探包穿透NAT,实现与所述关联终端进行P2P通信;Step S305, and when detecting that no response is received, by using the relay mode or requesting the server to notify the associated terminal to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period, to implement P2P with the associated terminal. Communication
具体地,如步骤S205所示。Specifically, as shown in step S205.
步骤S306,在检测收到回应时,则直接与所述关联终端进行P2P通信。Step S306, when detecting the received response, directly performing P2P communication with the associated terminal.
具体地,当检测收到回应时,NAT是开放的或关联终端位于开放网络上,则无线接入设备与关联终端是可以直接进行通信。Specifically, when detecting that the response is received, the NAT is open or the associated terminal is located on the open network, the wireless access device and the associated terminal can directly communicate.
图4是本发明通过穿透NAT实现P2P通信的方法中向所述关联终端的公网地址发送请求报文之前的进一步处理方法的流程示意图,具体步骤如下:4 is a schematic flowchart of a further processing method before a request message is sent to a public network address of the associated terminal in a method for implementing P2P communication by using NAT, and the specific steps are as follows:
步骤S401,所述响应报文还携带所述关联终端的网络类型;Step S401, the response packet further carries a network type of the associated terminal.
步骤S402,根据所述关联终端的网络类型确认所述关联终端在私网;Step S402, confirming, according to the network type of the associated terminal, that the associated terminal is in a private network;
具体地,网络类型包括私网和公网。Specifically, the network type includes a private network and a public network.
步骤S403,根据所述关联终端的公网地址确认更新了所述关联终端的公网地址。Step S403, confirming that the public network address of the associated terminal is updated according to the public network address of the associated terminal.
具体地,无线接入设备将收到的关联终端的公网地址与之前自身存储的关联终端的公网地址进行比较发现不同时,则认为关联终端的公网地址更新了。Specifically, the wireless access device compares the received public network address of the associated terminal with the public network address of the associated terminal that was previously stored by the wireless access device, and finds that the public network address of the associated terminal is updated.
图5是本发明通过穿透NAT实现P2P通信的方法的另一种实施例的流程示意图,适于服务器侧,具体步骤如下:FIG. 5 is a schematic flowchart of another embodiment of a method for implementing P2P communication by using NAT through the NAT, which is suitable for the server side, and the specific steps are as follows:
步骤S501,按照心跳周期接收无线接入设备上报的TCP应用层信息;Step S501: Receive, according to a heartbeat period, TCP application layer information reported by the wireless access device.
具体地,TCP应用层信息包括:设备状态、功能掩码、网络地址(IP地址)、物理地址等,采用jason格式。Specifically, the TCP application layer information includes: a device state, a function mask, a network address (IP address), a physical address, and the like, and adopts a jason format.
步骤S502,根据所述TCP应用层信息更新关联终端的关联转发表;Step S502, updating an associated forwarding table of the associated terminal according to the TCP application layer information.
具体地,服务器将数据包源地址和TCP应用层信息中的网络地址进行比较,当相同时为公网,不同时为私网。其中,数据包源地址就是最外层NAT 映射地址,也是无线接入设备的公网地址;Specifically, the server compares the source address of the data packet with the network address in the TCP application layer information. When the server is the same, it is a public network, and at the same time, a private network. Where the packet source address is the outermost NAT The mapped address is also the public network address of the wireless access device;
其中,在根据所述TCP应用层信息更新关联终端的关联转发表之后,还可将所述关联终端的关联转发表的更新内容通知给所述关联终端。After updating the associated forwarding table of the associated terminal according to the TCP application layer information, the updated content of the associated forwarding table of the associated terminal may also be notified to the associated terminal.
步骤S503,并向所述无线接入设备发送响应报文,以便所述无线接入设备向所述关联终端的公网地址发送请求报文;Step S503, and sending a response message to the wireless access device, so that the wireless access device sends a request message to the public network address of the associated terminal;
具体地,其中,所述响应报文携带所述关联终端的公网地址。Specifically, the response packet carries a public network address of the associated terminal.
步骤S504,并在所述无线接入设备没有收到回应时,接收所述无线接入设备的请求报文后,通知所述关联终端按照所述心跳周期发起心跳嗅探包穿透NAT,便于所述无线接入设备与所述关联终端进行P2P通信。Step S504, and after receiving the request message of the wireless access device, after the wireless access device receives the response packet, notify the associated terminal to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period, which is convenient. The wireless access device performs P2P communication with the associated terminal.
具体地,服务器接收无线接入终端的请求后,按照该请求通知关联终端按照所述心跳周期发起心跳嗅探包穿透NAT。Specifically, after receiving the request of the wireless access terminal, the server notifies the associated terminal to initiate the heartbeat sniffing packet to penetrate the NAT according to the heartbeat period according to the request.
图6是本发明通过穿透NAT实现P2P通信的方法中根据所述TCP应用层信息更新关联终端的关联转发表之前进一步处理方法的流程示意图,具体步骤如下:FIG. 6 is a schematic flowchart of a method for further processing an associated forwarding table of an associated terminal according to the TCP application layer information in the method for implementing P2P communication by using NAT in the method of the present invention. The specific steps are as follows:
步骤S601,接收所述TCP应用层报文信息;Step S601: Receive the TCP application layer packet information.
具体地,其中,所述TCP应用层报文信息包括网络地址信息。Specifically, the TCP application layer packet information includes network address information.
步骤S602,将预存的数据包源地址与所述网络地址信息进行比较确定网络类型;Step S602, comparing the pre-stored data source address with the network address information to determine a network type.
具体地,当相同时则网络类型为公网,不同时则网络类型为私网。Specifically, when the same, the network type is a public network, and at the same time, the network type is a private network.
步骤S603,所述数据包源地址为所述无线接入设备通过NAT映射后的公网地址。Step S603, the source address of the data packet is a public network address that is mapped by the wireless access device through NAT.
具体地,数据包源地址为IP地址。Specifically, the source address of the data packet is an IP address.
需要说明的是,通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到本发明的部分或全部可借助软件并结合必需的通用硬件平台来实现。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可包括其上存储有机 器可执行指令的一个或多个机器可读介质,这些指令在由诸如计算机、计算机网络或其他电子设备等一个或多个机器执行时可使得该一个或多个机器根据本发明的实施例来执行操作。机器可读介质可包括,但不限于,软盘、光盘、CD-ROM(紧致盘-只读存储器)、磁光盘、ROM(只读存储器)、RAM(随机存取存储器)、EPROM(可擦除可编程只读存储器)、EEPROM(电可擦除可编程只读存储器)、磁卡或光卡、闪存、或适于存储机器可执行指令的其他类型的介质/机器可读介质。It should be noted that, through the description of the above embodiments, those skilled in the art can clearly understand that some or all of the present invention can be implemented by software and in combination with a necessary general hardware platform. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product, which may include organic storage thereon. And one or more machine-readable mediums of instructions executable by one or more machines, such as a computer, computer network or other electronic device, to cause the one or more machines to be in accordance with an embodiment of the present invention Perform the operation. The machine-readable medium can include, but is not limited to, a floppy disk, an optical disk, a CD-ROM (Compact Disk-Read Only Memory), a magneto-optical disk, a ROM (Read Only Memory), a RAM (Random Access Memory), an EPROM (erasable) In addition to programmable read only memory, EEPROM (Electrically Erasable Programmable Read Only Memory), magnetic or optical cards, flash memory, or other types of media/machine readable media suitable for storing machine executable instructions.
本发明可用于众多通用或专用的计算***环境或配置中。例如:个人计算机、服务器计算机、手持设备或便携式设备、平板型设备、多处理器***、基于微处理器的***、置顶盒、可编程的消费电子设备、网络PC、小型计算机、大型计算机、包括以上任何***或设备的分布式计算环境等。The invention is applicable to a wide variety of general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor based systems, set-top boxes, programmable consumer electronics devices, network PCs, small computers, mainframe computers, including A distributed computing environment of any of the above systems or devices.
本发明可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本发明,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。The invention may be described in the general context of computer-executable instructions executed by a computer, such as a program module. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform particular tasks or implement particular abstract data types. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are connected through a communication network. In a distributed computing environment, program modules can be located in both local and remote computer storage media including storage devices.
图7是本发明通过穿透NAT实现P2P通信的无线接入设备的一种实施例的结构示意图,无线接入设备700包括第一检测模块701、上报模块702、第一接收模块703、第一发送模块704、第二检测模块705和第一通信模块706,FIG. 7 is a schematic structural diagram of an embodiment of a wireless access device that implements P2P communication by using NAT. The wireless access device 700 includes a first detecting module 701, a reporting module 702, a first receiving module 703, and a first a sending module 704, a second detecting module 705, and a first communication module 706,
第一检测模块701,用于检测NAT心跳周期;The first detecting module 701 is configured to detect a NAT heartbeat period;
具体地,第一检测模块701检测NAT心跳周期,具体包括:Specifically, the first detecting module 701 detects the NAT heartbeat period, and specifically includes:
第一检测模块701向所述服务器发送请求报文;如果在N秒内没有收到所述服务器的回应,则以N/2秒继续嗅探,连续嗅探预设次数,仍没有收到所述服务器的回应,则认为网络不可达;如果延迟N秒收到所述服务器的回应,则所述N秒为心跳周期。The first detecting module 701 sends a request message to the server; if the response of the server is not received within N seconds, the sniffing continues in N/2 seconds, and the preset number of times is continuously sniffed, and the receiving number is still not received. The response of the server is considered to be unreachable; if the response of the server is received after a delay of N seconds, the N seconds is a heartbeat period.
上报模块702,用于按照第一检测模块701检测的NAT心跳周期向服务器上报TCP应用层信息,以便所述服务器根据所述TCP应用层信息更新关联 终端的关联转发表;The reporting module 702 is configured to report the TCP application layer information to the server according to the NAT heartbeat period detected by the first detecting module 701, so that the server updates the association according to the TCP application layer information. The associated forwarding table of the terminal;
具体地,所述关联终端包括主设备及至少一个关联设备,所述关联终端的关联转发表格式为:Specifically, the associated terminal includes a master device and at least one associated device, and the associated forwarding table format of the associated terminal is:
{编号;{Numbering;
主设备标识,公网地址,网络类型,心跳周期;Primary device ID, public network address, network type, heartbeat period;
第一关联设备标识,公网地址,网络类型,心跳周期;First associated device identifier, public network address, network type, heartbeat period;
……}。......}.
其中,编号由服务器设定,另主设备标识及第一设备标识……为第一检测模块按心跳周期上报的报文中的物理地址;The number is set by the server, and the other device identifier and the first device identifier are the physical addresses in the packets reported by the first detection module according to the heartbeat period;
其中,网络类型包括私网和公网,具体服务器将数据包源地址和TCP应用层信息中的网络地址进行比较,当相同时网络类型为公网,不同时网络类型为私网。The network type includes a private network and a public network. The specific server compares the source address of the data packet with the network address in the TCP application layer information. When the network type is the public network, the network type is private.
第一接收模块703,用于接收所述服务器的响应报文,所述响应报文携带所述关联终端的公网地址;The first receiving module 703 is configured to receive a response packet of the server, where the response packet carries a public network address of the associated terminal.
具体地,所述响应报文还携带网络类型。Specifically, the response message further carries a network type.
第一发送模块704,用于向所述关联终端的公网地址发送请求报文;The first sending module 704 is configured to send a request message to the public network address of the associated terminal.
具体地,所述关联终端包括:主设备标识及第一设备标识……。Specifically, the associated terminal includes: a primary device identifier and a first device identifier.
第二检测模块705,检测是否收到回应;The second detecting module 705 detects whether a response is received.
第一通信模块706,用于当所述第二检测模块705检测没有收到回应时,通过中继模式或请求所述服务器通知所述关联终端按照所述心跳周期向自身发起心跳嗅探包穿透NAT,实现与所述关联终端进行P2P通信。The first communication module 706 is configured to, when the second detecting module 705 detects that no response is received, notify the associated terminal to initiate a heartbeat sniffing packet wear according to the heartbeat period by using a relay mode or requesting the server Through NAT, P2P communication with the associated terminal is implemented.
具体地,当检测没有收到回应时,则确认为网络拥塞或NAT是受限型或对称型;其中,中继模式是通过中继使无线接入设备与关联终端接通,即绕开NAT,使无线接入设备可以与关联设备直接进行P2P通信;其中,关联终端按心跳周期向无线接入终端发起心跳嗅探包,即通过心跳连续的方式打通NAT,使关联终端与无线接入设备进行P2P通信。 Specifically, when the detection does not receive the response, it is confirmed that the network congestion or the NAT is restricted or symmetric; wherein the relay mode is to enable the wireless access device to be connected to the associated terminal by using the relay, that is, bypassing the NAT The wireless access device can directly perform P2P communication with the associated device. The associated terminal initiates a heartbeat sniffing packet to the wireless access terminal according to a heartbeat cycle, that is, the NAT is opened through a heartbeat continuous manner, so that the associated terminal and the wireless access device are enabled. Perform P2P communication.
图8是本发明通过穿透NAT实现P2P通信的无线接入设备的另一种实施例的结构示意图,无线接入设备700包括第一检测模块701、上报模块702、第一接收模块703、第一发送模块704、第二检测模块705、第一通信模块706和第二通信模块707,其中,第一检测模块701、上报模块702、第一接收模块703、第一发送模块704、第二检测模块705和第一通信模块706具体如图7所示,FIG. 8 is a schematic structural diagram of another embodiment of a wireless access device that implements P2P communication by using NAT. The wireless access device 700 includes a first detecting module 701, a reporting module 702, and a first receiving module 703. a sending module 704, a second detecting module 705, a first communications module 706, and a second communications module 707, wherein the first detecting module 701, the reporting module 702, the first receiving module 703, the first sending module 704, and the second detecting The module 705 and the first communication module 706 are specifically as shown in FIG.
第二通信模块707,用于当第二检测模块705检测收到回应时,直接与所述关联终端进行P2P通信。The second communication module 707 is configured to perform P2P communication directly with the associated terminal when the second detecting module 705 detects the receipt of the response.
具体地,当检测收到回应时,NAT是开放的或关联终端位于开放网络上,则无线接入设备与关联终端是可以直接进行通信。Specifically, when detecting that the response is received, the NAT is open or the associated terminal is located on the open network, the wireless access device and the associated terminal can directly communicate.
图9是本发明通过穿透NAT实现P2P通信的无线接入设备的另一种实施例的结构示意图,无线接入设备700包括第一检测模块701、上报模块702、第一接收模块703、第一发送模块704、第二检测模块705、第一通信模块706、第一确认模块708和第二确认模块709,其中,第一检测模块701、上报模块702、第一接收模块703、第一发送模块704、第二检测模块705和第一通信模块706具体如图7所示,FIG. 9 is a schematic structural diagram of another embodiment of a wireless access device that implements P2P communication by using NAT. The wireless access device 700 includes a first detecting module 701, a reporting module 702, and a first receiving module 703. a sending module 704, a second detecting module 705, a first communications module 706, a first confirming module 708, and a second confirming module 709, wherein the first detecting module 701, the reporting module 702, the first receiving module 703, and the first sending The module 704, the second detecting module 705 and the first communication module 706 are specifically as shown in FIG. 7.
第一确认模块708,用于第一发送模块704向所述关联终端的公网地址发送请求报文之前,根据所述关联终端的网络类型确认所述关联终端在私网;其中,所述响应报文还携带所述关联终端的网络类型;The first confirmation module 708 is configured to: before the first sending module 704 sends the request message to the public network address of the associated terminal, confirm that the associated terminal is in the private network according to the network type of the associated terminal; wherein the response is The packet also carries the network type of the associated terminal;
具体地,网络类型包括私网和公网。Specifically, the network type includes a private network and a public network.
第二确认模块709,用于根据所述关联终端的公网地址确认更新了所述关联终端的公网地址。The second confirmation module 709 is configured to update the public network address of the associated terminal according to the public network address of the associated terminal.
具体地,具体地,无线接入设备将收到的关联终端的公网地址与之前自身存储的关联终端的公网地址进行比较发现不同时,则认为关联终端的公网地址更新了。Specifically, the wireless access device compares the public network address of the associated terminal with the public network address of the associated terminal that was previously stored by the wireless access device, and finds that the public network address of the associated terminal is updated.
图10是本发明通过穿透NAT实现P2P通信的无线接入设备中第一检测模块的一种实施例的结构示意图,第一检测模块701包括请求子模块7011和检测子模块7012, 10 is a schematic structural diagram of an embodiment of a first detecting module in a wireless access device that implements P2P communication by using NAT, and the first detecting module 701 includes a requesting submodule 7011 and a detecting submodule 7012.
请求子模7011,用于向所述服务器发送请求报文;a request submodule 7011, configured to send a request message to the server;
检测子模块7012,用于如果在N秒内没有收到所述服务器的回应,则以N/2秒继续嗅探,连续嗅探预设次数,仍没有收到所述服务器的回应,则认为网络不可达;如果延迟N秒收到所述服务器的回应,则所述N秒为心跳周期。The detecting sub-module 7012 is configured to continue sniffing in N/2 seconds if the response of the server is not received within N seconds, continuously sniffing the preset number of times, and still not receiving the response from the server, The network is unreachable; if the response of the server is received after a delay of N seconds, the N seconds is a heartbeat period.
图11是本发明通过穿透NAT实现P2P通信的服务器的一种实施例的结构示意图,服务器1100包括第二接收模块1101、更新模块1102、第二发送模块1103和接收通知模块1104,11 is a schematic structural diagram of an embodiment of a server for implementing P2P communication by penetrating NAT. The server 1100 includes a second receiving module 1101, an updating module 1102, a second sending module 1103, and a receiving notification module 1104.
第二接收模块1101,用于按照心跳周期接收无线接入设备上报的TCP应用层信息;The second receiving module 1101 is configured to receive, according to a heartbeat period, TCP application layer information reported by the wireless access device;
具体地,TCP应用层信息包括:设备状态、功能掩码、网络地址(IP地址)、物理地址等。Specifically, the TCP application layer information includes: a device status, a function mask, a network address (IP address), a physical address, and the like.
更新模块1102,用于根据所述TCP应用层信息更新关联终端的关联转发表;The update module 1102 is configured to update an associated forwarding table of the associated terminal according to the TCP application layer information.
具体地,服务器将数据包源地址和TCP应用层信息中的网络地址进行比较,当相同时为公网,不同时为私网。其中,数据包源地址就是最外层NAT映射地址,也是无线接入设备的公网地址。Specifically, the server compares the source address of the data packet with the network address in the TCP application layer information. When the server is the same, it is a public network, and at the same time, a private network. The source address of the data packet is the outermost NAT mapping address, and is also the public network address of the wireless access device.
第二发送模块1103,用于向所述无线接入设备发送响应报文,以便所述无线接入设备向所述关联终端的公网地址发送请求报文;其中,所述响应报文携带所述关联终端的公网地址;a second sending module 1103, configured to send a response packet to the wireless access device, so that the wireless access device sends a request packet to a public network address of the associated terminal, where the response packet carries a message Describe the public network address of the associated terminal;
具体地,其中,所述响应报文携带所述关联终端的公网地址。Specifically, the response packet carries a public network address of the associated terminal.
接收通知模块1104,用于在所述无线接入设备没有收到回应时,接收所述无线接入设备的请求通知报文后,通知所述关联终端按照所述心跳周期发起心跳嗅探包穿透NAT,便于所述无线接入设备与所述关联终端进行P2P通信。The receiving notification module 1104 is configured to notify the associated terminal to initiate a heartbeat sniffing packet according to the heartbeat period after receiving the request notification message of the wireless access device, when the wireless access device does not receive a response. The NAT is convenient for the wireless access device to perform P2P communication with the associated terminal.
具体地,接收通知模块1104接收无线接入终端的请求后,按照该请求通知关联终端按照所述心跳周期发起心跳嗅探包穿透NAT。Specifically, after receiving the request of the wireless access terminal, the receiving notification module 1104 notifies the associated terminal to initiate the heartbeat sniffing packet to penetrate the NAT according to the heartbeat period according to the request.
图12是本发明通过穿透NAT实现P2P通信的服务器的另一种实施例的 结构示意图,服务器1100包括第二接收模块1101、更新模块1102、第二发送模块1103、接收通知模块1104、第三接收模块1105和比较确定模块1106,其中,第二接收模块1101、更新模块1102、第二发送模块1103和接收通知模块1104具体如图11所示,12 is another embodiment of a server for implementing P2P communication by penetrating NAT according to the present invention. The server 1100 includes a second receiving module 1101, an updating module 1102, a second sending module 1103, a receiving notification module 1104, a third receiving module 1105, and a comparison determining module 1106. The second receiving module 1101 and the updating module 1102 The second sending module 1103 and the receiving notification module 1104 are specifically as shown in FIG.
第三接收模块1105,用于在更新模块1102根据所述TCP应用层信息更新关联终端的关联转发表之前,接收所述TCP应用层报文信息;其中,所述TCP应用层报文信息包括网络地址信息;The third receiving module 1105 is configured to receive the TCP application layer packet information before the update module 1102 updates the associated forwarding table of the associated terminal according to the TCP application layer information, where the TCP application layer packet information includes a network. Address information;
具体地,其中,所述TCP应用层报文信息包括网络地址信息。Specifically, the TCP application layer packet information includes network address information.
比较确定模块1106,用于将预存的数据包源地址与所述网络地址信息进行比较确定网络类型;其中,所述数据包源地址为所述无线接入设备通过NAT映射后的公网地址。The comparison determining module 1106 is configured to compare the pre-stored data source address with the network address information to determine a network type, where the data source address is a public network address that is mapped by the wireless access device through NAT.
具体地,当相同时则网络类型为公网,不同时则网络类型为私网。Specifically, when the same, the network type is a public network, and at the same time, the network type is a private network.
图13是本发明通过穿透NAT实现P2P通信的服务器的另一种实施例的结构示意图,服务器1100包括第二接收模块1101、更新模块1102、第二发送模块1103、接收通知模块1104和通知模块1107,其中,第二接收模块1101、更新模块1102、第二发送模块1103和接收通知模块1104具体如图11所示,13 is a schematic structural diagram of another embodiment of a server for implementing P2P communication by penetrating NAT according to the present invention. The server 1100 includes a second receiving module 1101, an updating module 1102, a second sending module 1103, a receiving notification module 1104, and a notification module. 1107, wherein the second receiving module 1101, the updating module 1102, the second sending module 1103, and the receiving notification module 1104 are specifically as shown in FIG.
通知模块1107,用于更新模块1102根据所述TCP应用层信息更新关联终端的关联转发表之后,将所述关联终端的关联转发表的更新内容通知给所述关联终端。The notification module 1107 is configured to: after the update module 1102 updates the associated forwarding table of the associated terminal according to the TCP application layer information, notify the associated terminal of the updated content of the associated forwarding table of the associated terminal.
图14是本发明通过穿透NAT实现P2P通信的***的一种实施例的结构示意图,***1300包括无线接入设备600和服务器1000,其中,无线接入设备600位于内网,且可以为路由器或网关等。FIG. 14 is a schematic structural diagram of an embodiment of a system for implementing P2P communication by using NAT in the present invention. The system 1300 includes a wireless access device 600 and a server 1000. The wireless access device 600 is located on the internal network and may be a router. Or gateway, etc.
无线接入设备600,用于检测NAT心跳周期;按照NAT心跳周期向服务器1100上报TCP应用层信息,以便服务器1100根据所述TCP应用层信息更新关联终端的关联转发表;同时,接收服务器1100的响应报文,所述响应报文携带所述关联终端的公网地址;并向所述关联终端的公网地址发送请求报文,检测是否收到回应;当检测没有收到回应时,通过中继模式或请求服务器1100通知所述关联终端按照所述心跳周期向自身发起心跳嗅探包穿透 NAT,实现与所述关联终端进行P2P通信;当所述检测收到回应时,直接与所述关联终端进行P2P通信。The wireless access device 600 is configured to detect a NAT heartbeat period, and report the TCP application layer information to the server 1100 according to the NAT heartbeat period, so that the server 1100 updates the associated forwarding table of the associated terminal according to the TCP application layer information. Meanwhile, the receiving server 1100 The response message carries the public network address of the associated terminal; and sends a request message to the public network address of the associated terminal to detect whether a response is received; when the detection does not receive a response, the response is passed. The mode or request server 1100 notifies the associated terminal to initiate heartbeat sniffing packet penetration to itself according to the heartbeat period. The NAT implements P2P communication with the associated terminal; when the detection receives a response, directly performs P2P communication with the associated terminal.
其中,无线接入设备600检测NAT心跳周期具体包括:向服务器1100发送请求报文,如果在N秒内没有收到服务器1100的回应,则以N/2秒继续嗅探,连续嗅探预设次数,仍没有收到服务器1100的回应,则认为网络不可达;如果延迟N秒收到服务器1100的回应,则所述N秒为心跳周期。The detecting, by the wireless access device 600, the NAT heartbeat period includes: sending a request message to the server 1100. If the server 1100 does not receive the response within N seconds, the device continues to sniff in N/2 seconds to continuously sniff the preset. The number of times, if the response of the server 1100 is still not received, the network is considered unreachable; if the response of the server 1100 is received after a delay of N seconds, the N seconds is a heartbeat period.
无线接入设备600,还用于向所述关联终端的公网地址发送请求报文之前,根据所述关联终端的网络类型确认所述关联终端在私网;其中,所述响应报文还携带所述关联终端的网络类型;根据所述关联终端的公网地址确认更新了所述关联终端的公网地址。The wireless access device 600 is further configured to: before the sending the request message to the public network address of the associated terminal, confirm that the associated terminal is in the private network according to the network type of the associated terminal; wherein the response packet is further carried The network type of the associated terminal; the public network address of the associated terminal is updated according to the public network address of the associated terminal.
服务器1100,用于按照心跳周期接收无线接入设备600上报的TCP应用层信息;根据所述TCP应用层信息更新关联终端的关联转发表;同时,向无线接入设备600发送响应报文,以便无线接入设备600向所述关联终端的公网地址发送请求报文;其中,所述响应报文携带所述关联终端的公网地址;在无线接入设备600没有收到回应时,接收无线接入设备600的请求通知报文后,通知所述关联终端按照所述心跳周期发起心跳嗅探包穿透NAT,便于无线接入设备600与所述关联终端进行P2P通信。The server 1100 is configured to receive the TCP application layer information reported by the wireless access device 600 according to the heartbeat period; update the associated forwarding table of the associated terminal according to the TCP application layer information; and send a response packet to the wireless access device 600, so that The wireless access device 600 sends a request message to the public network address of the associated terminal, where the response message carries the public network address of the associated terminal; when the wireless access device 600 does not receive the response, the wireless access device receives the wireless message. After the request notification message of the access device 600, the associated terminal is notified to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period, so that the wireless access device 600 can perform P2P communication with the associated terminal.
服务器1100,还用于在根据所述TCP应用层信息更新关联终端的关联转发表之前,接收所述TCP应用层报文信息;其中,所述TCP应用层报文信息包括网络地址信息;并将预存的数据包源地址与所述网络地址信息进行比较确定网络类型;其中,所述数据包源地址为所述无线接入设备通过NAT映射后的公网地址。The server 1100 is further configured to: before the update forwarding table of the associated terminal is updated according to the TCP application layer information, receive the TCP application layer packet information; where the TCP application layer packet information includes network address information; The pre-stored data packet source address is compared with the network address information to determine a network type. The data packet source address is a public network address that is mapped by the wireless access device through NAT.
服务器1100,还用于根据所述TCP应用层信息更新关联终端的关联转发表之后,将所述关联终端的关联转发表的更新内容通知给所述关联终端。The server 1100 is further configured to: after updating the associated forwarding table of the associated terminal according to the TCP application layer information, notify the associated terminal of the updated content of the associated forwarding table of the associated terminal.
需要说明的是,本领域技术人员可以理解,上述部分组件可以是可编程逻辑器件,包括:可编程阵列逻辑(Programmable Array Logic,PAL)、通用阵列逻辑(Generic Array Logic,GAL)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、复杂可编程逻辑器件(Complex  Programmable Logic Device,CPLD)中的一种或多种,本发明对此不做具体限制。It should be noted that those skilled in the art may understand that some of the above components may be programmable logic devices, including: Programmable Array Logic (PAL), Generic Array Logic (GAL), and field programmable. Field-Programmable Gate Array (FPGA), Complex Programmable Logic Device (Complex) One or more of the Programmable Logic Device (CPLD) is not specifically limited in the present invention.
本发明虽然已以较佳实施例公开如上,但其并不是用来限定本发明,任何本领域技术人员在不脱离本发明的精神和范围内,都可以利用上述揭示的方法和技术内容对本发明技术方案做出可能的变动和修改,因此,凡是未脱离本发明技术方案的内容,依据本发明的技术实质对以上实施例所作的任何简单修改、等同变化及修饰,均属于本发明技术方案的保护范围。 The present invention has been disclosed in the preferred embodiments as described above, but it is not intended to limit the invention, and the present invention may be utilized by the method and technical contents disclosed above without departing from the spirit and scope of the invention. The technical solutions make possible changes and modifications. Therefore, any simple modifications, equivalent changes, and modifications made to the above embodiments in accordance with the technical spirit of the present invention are not included in the technical solutions of the present invention. protected range.

Claims (16)

  1. 一种通过穿透NAT实现P2P通信的方法,其特征在于,所述方法包括:A method for implementing P2P communication by penetrating NAT, characterized in that the method comprises:
    无线接入设备检测NAT心跳周期;The wireless access device detects a NAT heartbeat period;
    并按照所述NAT心跳周期向服务器上报TCP应用层信息,以便所述服务器根据所述TCP应用层信息更新关联终端的关联转发表;And reporting the TCP application layer information to the server according to the NAT heartbeat period, so that the server updates the associated forwarding table of the associated terminal according to the TCP application layer information;
    接收所述服务器的响应报文,所述响应报文携带所述关联终端的公网地址;Receiving a response packet of the server, where the response packet carries a public network address of the associated terminal;
    向所述关联终端的公网地址发送请求报文;Sending a request message to the public network address of the associated terminal;
    并在检测没有收到回应时,通过中继模式或请求所述服务器通知所述关联终端按照所述心跳周期向自身发起心跳嗅探包穿透NAT,实现与所述关联终端进行P2P通信。And detecting that the response is not received, by using the relay mode or requesting the server to notify the associated terminal to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period, to implement P2P communication with the associated terminal.
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:在检测收到回应时,则直接与所述关联终端进行P2P通信。The method according to claim 1, wherein the method further comprises: performing P2P communication directly with the associated terminal when detecting the received response.
  3. 根据权利要求1所述的方法,其特征在于,在向所述关联终端的公网地址发送请求报文之前,所述方法还包括:The method according to claim 1, wherein the method further comprises: before sending the request message to the public network address of the associated terminal, the method further comprising:
    所述响应报文还携带所述关联终端的网络类型;The response packet further carries a network type of the associated terminal;
    根据所述关联终端的网络类型确认所述关联终端在私网;Confirming, according to the network type of the associated terminal, that the associated terminal is in a private network;
    根据所述关联终端的公网地址确认更新了所述关联终端的公网地址。And confirming that the public network address of the associated terminal is updated according to the public network address of the associated terminal.
  4. 根据权利要求1所述的方法,其特征在于,所述关联终端包括主设备及至少一个关联设备,所述关联终端的关联转发表格式为:The method according to claim 1, wherein the associated terminal comprises a master device and at least one associated device, and the associated forwarding table format of the associated terminal is:
    {编号;{Numbering;
    主设备标识,公网地址,网络类型,心跳周期;Primary device ID, public network address, network type, heartbeat period;
    第一关联设备标识,公网地址,网络类型,心跳周期;First associated device identifier, public network address, network type, heartbeat period;
    ……}。......}.
  5. 如权利要求1所述的方法,其特征在于,所述无线接入设备检测NAT心跳周期,具体包括: The method of claim 1, wherein the detecting, by the wireless access device, a NAT heartbeat period comprises:
    所述无线接入设备向所述服务器发送请求报文;Sending, by the wireless access device, a request message to the server;
    如果在N秒内没有收到所述服务器的回应,则以N/2秒继续嗅探,连续嗅探预设次数,仍没有收到所述服务器的回应,则认为网络不可达;If the response of the server is not received within N seconds, the sniffing is continued in N/2 seconds, the preset number of times is continuously sniffed, and the response of the server is still not received, and the network is considered unreachable;
    如果延迟N秒收到所述服务器的回应,则所述N秒为心跳周期。If the response of the server is received after a delay of N seconds, the N seconds is a heartbeat period.
  6. 一种通过穿透NAT实现P2P通信的方法,其特征在于,所述方法包括:A method for implementing P2P communication by penetrating NAT, characterized in that the method comprises:
    按照心跳周期接收无线接入设备上报的TCP应用层信息;Receiving, by the heartbeat period, the TCP application layer information reported by the wireless access device;
    根据所述TCP应用层信息更新关联终端的关联转发表;Updating an associated forwarding table of the associated terminal according to the TCP application layer information;
    并向所述无线接入设备发送响应报文,以便所述无线接入设备向所述关联终端的公网地址发送请求报文;其中,所述响应报文携带所述关联终端的公网地址;Sending a response packet to the wireless access device, so that the wireless access device sends a request packet to the public network address of the associated terminal; wherein the response packet carries the public network address of the associated terminal ;
    并在所述无线接入设备没有收到回应时,接收所述无线接入设备的请求报文后,通知所述关联终端按照所述心跳周期发起心跳嗅探包穿透NAT,便于所述无线接入设备与所述关联终端进行P2P通信。After receiving the request message of the wireless access device, the wireless terminal device notifies the associated terminal to initiate a heartbeat sniffing packet to penetrate the NAT according to the heartbeat period, thereby facilitating the wireless The access device performs P2P communication with the associated terminal.
  7. 如权利要求6所述的方法,其特征在于,在根据所述TCP应用层信息更新关联终端的关联转发表之前,所述方法还包括:The method of claim 6, wherein the method further comprises: before updating the associated forwarding table of the associated terminal according to the TCP application layer information, the method further comprising:
    接收所述TCP应用层报文信息;其中,所述TCP应用层报文信息包括网络地址信息;Receiving the TCP application layer packet information, where the TCP application layer packet information includes network address information;
    将预存的数据包源地址与所述网络地址信息进行比较确定网络类型;Comparing the pre-stored data source address with the network address information to determine a network type;
    所述数据包源地址为所述无线接入设备通过NAT映射后的公网地址。The source address of the data packet is a public network address that is mapped by the wireless access device through NAT.
  8. 根据权利要求6所述的方法,其特征在于,在根据所述TCP应用层信息更新关联终端的关联转发表之后,所述方法还包括:The method according to claim 6, wherein after updating the associated forwarding table of the associated terminal according to the TCP application layer information, the method further includes:
    将所述关联终端的关联转发表的更新内容通知给所述关联终端。Notifying the associated terminal of the updated content of the associated forwarding table of the associated terminal.
  9. 一种通过穿透NAT实现P2P通信的无线接入设备,其特征在于,所述无线接入设备包括:A radio access device that implements P2P communication by using a NAT, wherein the wireless access device includes:
    第一检测模块,用于检测NAT心跳周期; a first detecting module, configured to detect a NAT heartbeat period;
    上报模块,用于按照所述第一检测模块检测的NAT心跳周期向服务器上报TCP应用层信息,以便所述服务器根据所述TCP应用层信息更新关联终端的关联转发表;The reporting module is configured to report the TCP application layer information to the server according to the NAT heartbeat period detected by the first detecting module, so that the server updates the associated forwarding table of the associated terminal according to the TCP application layer information;
    第一接收模块,用于接收所述服务器的响应报文,所述响应报文携带所述关联终端的公网地址;a first receiving module, configured to receive a response packet of the server, where the response packet carries a public network address of the associated terminal;
    第一发送模块,用于向所述关联终端的公网地址发送请求报文;a first sending module, configured to send a request message to a public network address of the associated terminal;
    第二检测模块,检测是否收到回应;a second detecting module that detects whether a response is received;
    第一通信模块,用于当所述第二检测模块检测没有收到回应时,通过中继模式或请求所述服务器通知所述关联终端按照所述心跳周期向自身发起心跳嗅探包穿透NAT,实现与所述关联终端进行P2P通信。a first communication module, configured to: when the second detection module detects that no response is received, by using a relay mode or requesting the server to notify the associated terminal to initiate a heartbeat sniffing packet to penetrate NAT according to the heartbeat period And implementing P2P communication with the associated terminal.
  10. 根据权利要求9所述的无线接入设备,其特征在于,所述无线接入设备还包括:The wireless access device according to claim 9, wherein the wireless access device further comprises:
    第二通信模块,用于当所述第二检测模块检测收到回应时,直接与所述关联终端进行P2P通信。The second communication module is configured to perform P2P communication directly with the associated terminal when the second detecting module detects the receipt of the response.
  11. 根据权利要求9所述的无线接入设备,其特征在于,所述无线接入设备还包括:The wireless access device according to claim 9, wherein the wireless access device further comprises:
    第一确认模块,用于所述第一发送模块向所述关联终端的公网地址发送请求报文之前,根据所述关联终端的网络类型确认所述关联终端在私网;其中,所述响应报文还携带所述关联终端的网络类型;a first confirmation module, configured to: after the first sending module sends a request message to the public network address of the associated terminal, confirm that the associated terminal is in a private network according to a network type of the associated terminal; wherein the response The packet also carries the network type of the associated terminal;
    第二确认模块,用于根据所述关联终端的公网地址确认更新了所述关联终端的公网地址。The second confirmation module is configured to update the public network address of the associated terminal according to the public network address of the associated terminal.
  12. 根据权利要求9所述的无线接入设备,其特征在于,所述第一检测模块包括:The wireless access device according to claim 9, wherein the first detecting module comprises:
    请求子模块,用于向所述服务器发送请求报文;a requesting submodule, configured to send a request message to the server;
    检测子模块,用于如果在N秒内没有收到所述服务器的回应,则以N/2秒继续嗅探,连续嗅探预设次数,仍没有收到所述服务器的回应,则认为网络不可达;如果延迟N秒收到所述服务器的回应,则所述N秒为心跳周期。 The detecting submodule is configured to continue sniffing in N/2 seconds if the response of the server is not received within N seconds, continuously sniffing the preset number of times, and still not receiving the response from the server, then the network is considered Unreachable; if the response of the server is received after a delay of N seconds, the N seconds is a heartbeat period.
  13. 一种通过穿透NAT实现P2P通信的服务器,其特征在于,所述服务器包括:A server for implementing P2P communication by penetrating NAT, wherein the server includes:
    第二接收模块,用于按照心跳周期接收无线接入设备上报的TCP应用层信息;a second receiving module, configured to receive, according to a heartbeat period, TCP application layer information reported by the wireless access device;
    更新模块,用于根据所述TCP应用层信息更新关联终端的关联转发表;An update module, configured to update an associated forwarding table of the associated terminal according to the TCP application layer information;
    第二发送模块,用于向所述无线接入设备发送响应报文,以便所述无线接入设备向所述关联终端的公网地址发送请求报文;其中,所述响应报文携带所述关联终端的公网地址;a second sending module, configured to send a response packet to the wireless access device, so that the wireless access device sends a request packet to a public network address of the associated terminal, where the response packet carries the The public network address of the associated terminal;
    接收通知模块,用于在所述无线接入设备没有收到回应时,接收所述无线接入设备的请求通知报文后,通知所述关联终端按照所述心跳周期发起心跳嗅探包穿透NAT,便于所述无线接入设备与所述关联终端进行P2P通信。Receiving a notification module, configured to notify the associated terminal to initiate heartbeat sniffing packet penetration according to the heartbeat period, after receiving the request notification message of the wireless access device, when the wireless access device does not receive a response The NAT facilitates P2P communication between the wireless access device and the associated terminal.
  14. 根据权利要求13所述的服务器,其特征在于,所述服务器还包括:The server according to claim 13, wherein the server further comprises:
    第三接收模块,用于在所述更新模块根据所述TCP应用层信息更新关联终端的关联转发表之前,接收所述TCP应用层报文信息;其中,所述TCP应用层报文信息包括网络地址信息;a third receiving module, configured to receive the TCP application layer packet information, where the update application module updates the associated forwarding table of the associated terminal according to the TCP application layer information, where the TCP application layer packet information includes a network Address information;
    比较确定模块,用于将预存的数据包源地址与所述网络地址信息进行比较确定网络类型;其中,所述数据包源地址为所述无线接入设备通过NAT映射后的公网地址。And a comparison determining module, configured to compare the pre-stored data source address with the network address information to determine a network type, where the data source address is a public network address that is mapped by the wireless access device through NAT.
  15. 根据权利要求13所述的服务器,其特征在于,所述服务器还包括:The server according to claim 13, wherein the server further comprises:
    通知模块,用于所述更新模块根据所述TCP应用层信息更新关联终端的关联转发表之后,将所述关联终端的关联转发表的更新内容通知给所述关联终端。And a notification module, configured to: after the update module updates the associated forwarding table of the associated terminal according to the TCP application layer information, notify the associated terminal of the updated content of the associated forwarding table of the associated terminal.
  16. 一种通过穿透NAT实现P2P通信的***,其特征在于,所述***包括无线接入设备和服务器,A system for implementing P2P communication by penetrating NAT, characterized in that the system comprises a wireless access device and a server,
    所述无线接入设备为权利要求9-12任一项所述的无线接入设备;The wireless access device is the wireless access device of any one of claims 9-12;
    所述服务器为权利要求13-15任一项所述的服务器。 The server is the server of any one of claims 13-15.
PCT/CN2016/103902 2016-03-30 2016-10-29 Method, device, server, and system for implementing p2p communication by going through nat WO2017166808A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610190661.4A CN105610999A (en) 2016-03-30 2016-03-30 Method, device, server and system for implementing P2P communication by penetrating NAT (network address translator)
CN201610190661.4 2016-03-30

Publications (1)

Publication Number Publication Date
WO2017166808A1 true WO2017166808A1 (en) 2017-10-05

Family

ID=55990533

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/103902 WO2017166808A1 (en) 2016-03-30 2016-10-29 Method, device, server, and system for implementing p2p communication by going through nat

Country Status (2)

Country Link
CN (1) CN105610999A (en)
WO (1) WO2017166808A1 (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110691113A (en) * 2018-07-06 2020-01-14 杭州涂鸦信息技术有限公司 NAT penetration method with two asymmetric sides
CN111193794A (en) * 2019-12-30 2020-05-22 深圳市网心科技有限公司 File transmission method and device, computer equipment and storage medium
CN112073553A (en) * 2020-08-31 2020-12-11 腾讯科技(深圳)有限公司 Method, device, equipment and storage medium for detecting network address conversion type
CN112217649A (en) * 2019-07-10 2021-01-12 南宁富桂精密工业有限公司 Terminal device management method, server and terminal device
CN112437169A (en) * 2020-11-17 2021-03-02 郑炳立 NAT (network Address translation) penetration method and system
CN112449024A (en) * 2020-11-13 2021-03-05 广州朗国电子科技有限公司 Intranet penetration method, equipment and storage medium of NAT (network Address translation) simulation gateway
CN112492053A (en) * 2019-08-20 2021-03-12 厦门本能管家科技有限公司 Cross-network penetration method and system for P2P network
CN112543239A (en) * 2020-12-23 2021-03-23 杭州安司源科技有限公司 Progressive NAT (network Address translation) penetration method
CN112887187A (en) * 2021-01-19 2021-06-01 海尔数字科技(青岛)有限公司 Method, system, device, equipment and medium for establishing communication between equipment

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105610999A (en) * 2016-03-30 2016-05-25 上海斐讯数据通信技术有限公司 Method, device, server and system for implementing P2P communication by penetrating NAT (network address translator)
CN106210092B (en) * 2016-07-19 2019-08-06 天彩电子(深圳)有限公司 A kind of P2P traversing method and its system merging UPNP and STUN
CN106507028A (en) * 2016-11-29 2017-03-15 四川长虹电器股份有限公司 A kind of Intranet in television video call penetrates direct-connected method
CN107071039B (en) * 2017-04-24 2017-12-12 深圳至上移动科技有限公司 A kind of private data cloud storage system and private data cloud storage method
CN108848144B (en) * 2018-05-31 2021-03-30 中国联合网络通信集团有限公司 Method and device for accessing nodes in block chain and block chain link point
CN110830597A (en) * 2018-08-07 2020-02-21 深圳市玖胜云智联科技有限公司 Robot and method for realizing AI multimedia interaction based on Linux system
CN109120737B (en) * 2018-08-10 2021-08-31 哈尔滨工业大学(威海) Incremental symmetric NAT UDP (user Datagram protocol) penetration method and system based on Poisson model
CN109743399B (en) * 2019-01-14 2021-09-03 浙江外国语学院 Internal and external network data transmission method and system for multi-task scheduling of physical examination center
CN110266828A (en) * 2019-06-11 2019-09-20 华为技术有限公司 A kind of method, apparatus and network system for establishing end to end network connection
CN110971701B (en) * 2019-12-10 2022-08-23 广州番禺职业技术学院 Internet of things communication method and device
CN111600968B (en) * 2020-03-31 2022-07-05 普联技术有限公司 NAT (network Address translation) hole punching method, device and equipment in P2P network and readable storage medium
CN111565200B (en) * 2020-07-14 2020-10-09 成都数维通信技术有限公司 NAT (network Address translation) association detection method based on multi-path message detection analysis
CN111935333B (en) * 2020-08-12 2022-09-27 杭州萤石软件有限公司 NAT type determination method, device, system and storage medium
CN112615946B (en) * 2020-12-24 2023-03-24 苏州摩联通信技术有限公司 Terminal monitoring method and device and storage medium
CN114765614B (en) * 2020-12-31 2023-11-10 华为技术有限公司 Method for accessing local area network service equipment and electronic equipment
CN113037566B (en) * 2021-03-30 2022-07-01 深圳市西迪特科技有限公司 Method for managing PON (Passive optical network) equipment through intranet penetration
CN113709163A (en) * 2021-08-30 2021-11-26 高维亮 Method and system for realizing remote operation of computer based on wireless terminal
CN114401304B (en) * 2021-11-15 2024-04-26 广州方阵科技有限公司 IP-based decentralizing end-to-end connection communication system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060072569A1 (en) * 2004-10-04 2006-04-06 Wizzysoft Corporation Network address translation protocol for transmission control protocol connections
CN101606141A (en) * 2006-09-13 2009-12-16 阿森奇亚网络有限公司 Improve the system and method for performance of transport protocols in the multi-path environment
US20110252145A1 (en) * 2010-04-07 2011-10-13 Mike Lampell Application Programming Interface, System, and Method for Collaborative Online Applications
CN102378064A (en) * 2010-08-04 2012-03-14 中兴通讯股份有限公司 Method and device for realizing traversal of network address translators (NAT) in internet protocol television (IPTV) network
CN105049543A (en) * 2015-06-02 2015-11-11 上海斐讯数据通信技术有限公司 P2P communication system and method crossing asymmetric NAT between intelligent routers
CN105610999A (en) * 2016-03-30 2016-05-25 上海斐讯数据通信技术有限公司 Method, device, server and system for implementing P2P communication by penetrating NAT (network address translator)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7522618B2 (en) * 2005-03-18 2009-04-21 Panasonic Corporation Communication apparatus, communication system and communication method
CN101977178A (en) * 2010-08-09 2011-02-16 中兴通讯股份有限公司 Relay-based media channel establishing method and system
CN103442224A (en) * 2013-09-09 2013-12-11 杭州巨峰科技有限公司 NAT penetration-based video monitoring access strategy and realization method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060072569A1 (en) * 2004-10-04 2006-04-06 Wizzysoft Corporation Network address translation protocol for transmission control protocol connections
CN101606141A (en) * 2006-09-13 2009-12-16 阿森奇亚网络有限公司 Improve the system and method for performance of transport protocols in the multi-path environment
US20110252145A1 (en) * 2010-04-07 2011-10-13 Mike Lampell Application Programming Interface, System, and Method for Collaborative Online Applications
CN102378064A (en) * 2010-08-04 2012-03-14 中兴通讯股份有限公司 Method and device for realizing traversal of network address translators (NAT) in internet protocol television (IPTV) network
CN105049543A (en) * 2015-06-02 2015-11-11 上海斐讯数据通信技术有限公司 P2P communication system and method crossing asymmetric NAT between intelligent routers
CN105610999A (en) * 2016-03-30 2016-05-25 上海斐讯数据通信技术有限公司 Method, device, server and system for implementing P2P communication by penetrating NAT (network address translator)

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
BOULTON, C. ET AL.: "NAT Traversal Practices for Client-Server SIP", REQUEST FOR COMMENTS: 6314, 31 July 2011 (2011-07-31) *
MARJOU, X. ET AL.: "Application Mechanism for Keeping Alive the Network Address Translator ( NAT ) Mappings Associated to RTP/RTCP flows", DRAFT-IETF-AVT-APP-RTP-KEEPALIVE-10, 4 March 2011 (2011-03-04), pages 1 - 9, XP015074254 *

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110691113A (en) * 2018-07-06 2020-01-14 杭州涂鸦信息技术有限公司 NAT penetration method with two asymmetric sides
CN110691113B (en) * 2018-07-06 2023-05-05 杭州涂鸦信息技术有限公司 NAT penetration method with asymmetric two parties
CN112217649A (en) * 2019-07-10 2021-01-12 南宁富桂精密工业有限公司 Terminal device management method, server and terminal device
CN112217649B (en) * 2019-07-10 2023-07-18 南宁富联富桂精密工业有限公司 Terminal equipment management method, server and terminal equipment
CN112492053A (en) * 2019-08-20 2021-03-12 厦门本能管家科技有限公司 Cross-network penetration method and system for P2P network
CN112492053B (en) * 2019-08-20 2023-04-07 本无链科技(深圳)有限公司 Cross-network penetration method and system for P2P network
CN111193794A (en) * 2019-12-30 2020-05-22 深圳市网心科技有限公司 File transmission method and device, computer equipment and storage medium
CN112073553A (en) * 2020-08-31 2020-12-11 腾讯科技(深圳)有限公司 Method, device, equipment and storage medium for detecting network address conversion type
CN112073553B (en) * 2020-08-31 2023-09-05 腾讯科技(深圳)有限公司 Network address translation type detection method, device, equipment and storage medium
CN112449024B (en) * 2020-11-13 2022-12-30 广州朗国电子科技股份有限公司 Intranet penetration method, equipment and storage medium of NAT (network Address translation) simulation gateway
CN112449024A (en) * 2020-11-13 2021-03-05 广州朗国电子科技有限公司 Intranet penetration method, equipment and storage medium of NAT (network Address translation) simulation gateway
CN112437169A (en) * 2020-11-17 2021-03-02 郑炳立 NAT (network Address translation) penetration method and system
CN112437169B (en) * 2020-11-17 2022-10-25 郑炳立 NAT (network Address translation) penetration method and system
CN112543239B (en) * 2020-12-23 2022-06-24 杭州安司源科技有限公司 Progressive NAT (network Address translation) penetration method
CN112543239A (en) * 2020-12-23 2021-03-23 杭州安司源科技有限公司 Progressive NAT (network Address translation) penetration method
CN112887187B (en) * 2021-01-19 2022-09-06 海尔数字科技(青岛)有限公司 Method, system, device, equipment and medium for establishing communication between equipment
CN112887187A (en) * 2021-01-19 2021-06-01 海尔数字科技(青岛)有限公司 Method, system, device, equipment and medium for establishing communication between equipment

Also Published As

Publication number Publication date
CN105610999A (en) 2016-05-25

Similar Documents

Publication Publication Date Title
WO2017166808A1 (en) Method, device, server, and system for implementing p2p communication by going through nat
US20210360014A1 (en) Rule-Based Network-Threat Detection For Encrypted Communications
US11082254B2 (en) User datagram protocol tunneling in distributed application instances
US8065418B1 (en) NAT traversal for media conferencing
US6822955B1 (en) Proxy server for TCP/IP network address portability
US9231908B2 (en) Ensuring symmetric routing to private network
US8611354B2 (en) Method and apparatus for relaying packets
US20130074173A1 (en) Control of Security Application in a LAN from Outside the LAN
US9769291B2 (en) Methods, systems, and computer readable media for facilitating the resolving of endpoint hostnames in test environments with firewalls, network address translators (NATs), or clouds
US8578468B1 (en) Multi-factor client authentication
US20080165802A1 (en) Method for Controlling the Direct Penetrate Communication Two Parts of Which Are Under the Different Nats and the Device Thereof
US20150113110A1 (en) Information processing apparatus, information processing method, and program
JP2008085470A (en) Ip application service provision system
US20090138611A1 (en) System And Method For Connection Of Hosts Behind NATs
US20210029078A1 (en) Cloud access to local network addresses
WO2017041660A1 (en) Router remote management method, system and device
TWI538449B (en) Nat traversal method, computer-readable medium, and system for mediating connection
US20230031062A1 (en) Data processing method and apparatus, related device, and storage medium
US10652204B2 (en) ReNAT systems and methods
US20080225867A1 (en) Faster NAT detection for Teredo client
US9258226B2 (en) Systems and methods for dual network address translation
US20150312209A1 (en) System and method for network addressing

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16896577

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 16896577

Country of ref document: EP

Kind code of ref document: A1