CN114221931A - Network layer NAT (network Address translation) traversal algorithm of distributed network - Google Patents

Network layer NAT (network Address translation) traversal algorithm of distributed network Download PDF

Info

Publication number
CN114221931A
CN114221931A CN202111283857.5A CN202111283857A CN114221931A CN 114221931 A CN114221931 A CN 114221931A CN 202111283857 A CN202111283857 A CN 202111283857A CN 114221931 A CN114221931 A CN 114221931A
Authority
CN
China
Prior art keywords
node
traversing
traversed
scheduling
port number
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111283857.5A
Other languages
Chinese (zh)
Inventor
陈霁红
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zhonghegu Investment Co ltd
Original Assignee
Beijing Zhonghegu Investment Co ltd
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 Beijing Zhonghegu Investment Co ltd filed Critical Beijing Zhonghegu Investment Co ltd
Priority to CN202111283857.5A priority Critical patent/CN114221931A/en
Publication of CN114221931A publication Critical patent/CN114221931A/en
Pending legal-status Critical Current

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
    • 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

Landscapes

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

Abstract

The invention provides a network layer NAT traversal algorithm of a distributed network, which comprises the following steps: s1: any scheduling node in the same distributed network receives a data packet sent by an adjacent traversing node, wherein the data packet comprises an IP (Internet protocol) of the traversing node, a port number and a hash value corresponding to request content; s2: the scheduling node positions the traversed node storing the request content according to the hash value corresponding to the request content in the data packet; s3: the scheduling node guides the traversing node and the traversed node to traverse; the network layer NAT traversal algorithm of the distributed network provided by the invention receives the data packet which is sent by the adjacent traversal node and has the hash value corresponding to the request content through any scheduling node in the same distributed network, and can position the specific traversed node according to the content, so that the traversal can be rapidly and accurately carried out between the traversal node and the traversed node, and the connection can be established.

Description

Network layer NAT (network Address translation) traversal algorithm of distributed network
Technical Field
The invention relates to the technical field of communication, in particular to a network layer NAT traversal algorithm of a distributed network.
Background
Libp2P is the infrastructure of IPFS and filechoice, and is the infrastructure of all future P2P and block chains, internet of things, Libp2P is a P2P network, which is divided into network layer, routing layer, and switching layer, and discovers nodes through a set of point-to-point protocols, connects them, discovers content, and transfers them, one node using Libp2P can communicate with another node, and can use various transmission modes, including connection delay, and communicate through different protocols, and negotiate according to requirements, Libp2P module is mainly responsible for data transfer functions in IPFS, namely routing, network, switching, and the like. With the increasing popularization of networks, more and more computers accessing the Internet are provided, IP address resources are increasingly difficult to match with the Internet, and the NAT technology appearing in 1994 can solve the problems, but hosts located in different local area networks are difficult to directly connect, so that an intranet traversing technology appears, and the traversing technology generally needs a server to coordinate and punch holes, namely, an extranet server needs to participate in traversing between two nodes, and potential safety hazards are increased.
Disclosure of Invention
Aiming at the problems, the invention provides a network layer NAT traversal algorithm of a distributed network, which comprises the following steps:
s1: any scheduling node in the same distributed network receives a data packet sent by an adjacent traversing node, wherein the data packet comprises an IP (Internet protocol) of the traversing node, a port number and a hash value corresponding to request content;
s2: the scheduling node positions the traversed node storing the request content according to the hash value corresponding to the request content in the data packet;
s3: and the scheduling node guides the traversing node and the traversed node to traverse.
The invention also provides a network layer of the distributed network, and the network layer realizes the step of the network layer NAT traversal algorithm of the distributed network when executing;
the invention has the following beneficial effects:
the network layer NAT traversal algorithm of the distributed network provided by the invention receives the data packet which is sent by the adjacent traversal node and has the hash value corresponding to the request content through any scheduling node in the same distributed network, and can position the specific traversed node according to the content, so that the traversal can be rapidly and accurately carried out between the traversal node and the traversed node, and the connection can be established.
Drawings
FIG. 1 is a flow chart of an algorithm for a network layer NAT traversal algorithm of a distributed network;
FIG. 2 is a structural diagram of a scheduling node guiding a traversing node and a traversed node to traverse;
FIG. 3 is a structural diagram of a scheduling node guiding a traversing node and a traversed node to traverse;
FIG. 4 is a structural diagram of a scheduling node directing traversing nodes and traversed nodes to traverse;
FIG. 5 is a block diagram of a scheduling node directing traversal of nodes and traversed nodes;
fig. 6 is a schematic diagram of a scheduling node replacement.
Detailed Description
The present invention will be described in further detail with reference to the following examples and drawings.
In some embodiments, as shown in fig. 1, a network layer NAT traversal algorithm for a distributed network is provided, the NAT traversal algorithm comprising the steps of:
s1: any scheduling node in the same distributed network receives a data packet sent by an adjacent traversing node, wherein the data packet comprises an IP (Internet protocol) of the traversing node, a port number and a hash value corresponding to request content;
s2: the scheduling node positions the traversed node storing the request content according to the hash value corresponding to the request content in the data packet;
s3: and the scheduling node guides the traversing node and the traversed node to traverse.
Each node discovers adjacent nodes through random-walk or bootstrap-list protocols, the same node can be used as a regulating node, a traversing node or a traversed node in different scenes, and the same node can play different roles according to different requirements; the algorithm disclosed in this embodiment is mainly that a scheduling node discovers a scheduling node adjacent to the scheduling node through a protocol, the scheduling node can quickly locate a traversed node storing request content and guide the traversed node to send a UDP packet with a destination port converted by an opposite-side NAT to an opposite-side public network address, and then the traversing node and the traversed node feed back a result to the scheduling node.
In some embodiments, as shown in fig. 2, the step S3 of the scheduling node directing the traversing node and the traversed node to traverse includes the following steps:
s311: the scheduling node sends the IP and the port number of the traversing node to the traversed node;
s312: the dispatching node sends the IP and the port number of the traversed node to the traversing node;
wherein, the crossing node in all embodiments of the invention is represented by A, the scheduling node is represented by B, and the crossed node is represented by C; the IP and port number of the traversing node a are represented by a, the IP and port number of the traversing node C are represented by C, as can be seen from fig. 2, the traversing node a first sends the hash value (not shown in the figure) corresponding to the IP, port number a and request content to the scheduling node B, the scheduling node B rapidly locates a traversing node C storing the request content according to the hash value corresponding to the request content, sends the IP and port number a of the traversing node a to the traversing node C, and sends the IP and port number C of the traversing node C to the traversing node a, so that the traversing node a and the traversing node C respectively send UDP messages with destination ports being port numbers converted by the NAT of the opposite party to the public network address of the opposite party, and then the traversing node a and the traversing node C feed back results to the scheduling node.
In some embodiments, as shown in fig. 3, the step S3 of dispatching the node to guide the traversing node and the traversed node to traverse includes the following steps:
s321: the dispatching node sends the IP and the port number of the traversed node to the traversing node;
s322: the traversing node sends its own IP and port number to the traversed node.
In this embodiment, as can be seen from fig. 3, the traversal node a first sends the IP, the port number a, and the hash value corresponding to the request content to the scheduling node B, the scheduling node B quickly locates, according to the hash value corresponding to the request content, a traversed node C storing the request content, and sends the IP and the port number C of the traversed node C to the traversal node a, the traversal node a sends its own IP and the port number a to the traversed node C, so that the traversal node a and the traversed node C respectively send UDP packets whose destination ports are port numbers converted by the peer NAT to the public network address of the peer, and then the traversal node a and the traversed node C feed back results to the scheduling node.
In some embodiments, as shown in fig. 4, the step S3 of dispatching the node to guide the traversing node and the traversed node to traverse includes the following steps:
s331: the dispatching node sends the IP and the port number of the traversing node to the traversed node;
s332: the traversed node sends its own IP and port number to the traversing node.
In this embodiment, as can be seen from fig. 4, the traversal node a first sends the IP, the port number a, and the hash value corresponding to the request content to the scheduling node B, the scheduling node B quickly locates, according to the hash value corresponding to the request content, a traversed node C storing the request content, and sends the IP and the port number a of the traversal node a to the traversed node C, and the traversed node C sends its own IP and port number C to the traversal node a, so that the traversal node a and the traversed node C respectively send UDP packets whose destination ports are port numbers converted by the peer NAT to the public network address of the peer, and then the traversal node a and the traversed node C feed back results to the scheduling node.
In some embodiments, as shown in fig. 5, the step S3 of dispatching the node to guide the traversing node and the traversed node to traverse includes the following steps:
s341: the dispatching node sends the IP and the port number of the traversed node to the traversing node, and simultaneously sends the IP and the port number of the traversing node to the traversed node;
s342: the traversing node also sends the IP and the port number of the traversing node to the traversed node after receiving the IP and the port number of the traversed node; the traversed node, upon receiving the IP and port number of the traversing node, also sends its own IP and port number to the traversing node.
In this embodiment, as can be seen from fig. 5, the traversal node a first sends the IP, the port number a, and the hash value corresponding to the request content to the scheduling node B, the scheduling node B quickly locates, according to the hash value corresponding to the request content, a traversed node C storing the request content, and sends the IP and the port number a of the traversal node a to the traversed node C, and at the same time sends the IP and the port number C of the traversed node C to the traversal node a, and the traversed node C sends the IP and the port number C of itself to the traversal node a, and the traversal node a also sends the IP and the port number a of itself to the traversed node C, so that the traversal node a and the traversed node C respectively send UDP packets whose destination ports are port numbers converted by the NAT of the opposite party to the public network address of the opposite party, and then the traversal node a and the traversed node C feed back the result to the scheduling node.
In some embodiments, a specific scenario is provided, for example, tsuga located in beijing wants to download a "kungfu" movie resource on a content-addressable distributed network where flight is located through a node (traversing node a) where a client is located, the node (traversing node a) where the client is located sends a packet to one or more nodes (scheduling node B) located in the same distributed network (CDN + P2P) and adjacent to the node, the packet includes an IP (201.1.1.90) of the traversing node, a port number (900) of the traversing node, and a hash value corresponding to the "kungfu" movie resource, the scheduling node B sends the IP (201.1.1.90) and the port number (900) of the traversing node a to a traversed node C, and simultaneously sends the IP (201.1.1.90) and the port number (900) of the traversed node C to the traversing node a, so that the traversing node and the traversed node respectively send UDP packets whose destination ports are port numbers after being converted by the partner to the partner's public network address, and then the traversing node and the traversed node feed back results to the scheduling node, the traversed node C and the traversing node A complete traversing at the moment, and connection is established, at the moment, the node where the client is located (the traversing node A) can send a packet to the traversed node C and send a request instruction for downloading the 'kungfu' movie resource so as to obtain the 'kungfu' movie resource.
In some embodiments, during the period that the scheduling node guides the traversing node and the traversed node to traverse, when the scheduling node is in an offline state, other adjacent nodes of the traversing node replace the role of the scheduling node and continue to guide the traversing node and the traversed node to traverse.
As shown in fig. 6, the process of guiding the traversing node a and the traversed node C to complete traversing is a scheduling process, the scheduling node is not constant in a complete scheduling process, the scheduling node may be the same node B1 from beginning to end or may start to be B1, and in the scheduling process, the scheduling node is replaced by node B2 and B3 … Bn, since nodes adjacent to the node are calculated by a protocol, when any scheduling node B1 is in an offline state, it cannot complete scheduling, and at this time, the scheduling node may be replaced by other nodes (B2 and B3 … Bn) adjacent to the traversing node to replace node B1 to continue to execute the remaining scheduling process.
In some embodiments, the number of the neighboring nodes of any node is 4 to 6, the scheduling nodes in the step S3 where the scheduling node directs the traversing node and the traversed node to traverse includes scheduling node 1 and scheduling node 2 …, where n is less than or equal to 6, multiple scheduling nodes neighboring the traversing node direct the traversing node and the traversed node to traverse at the same time, and the traversed nodes located by multiple scheduling nodes are the same or different.
In this embodiment, the number of neighboring nodes of any node is limited to 4 to 6, so that congestion caused by excessive neighboring nodes is avoided, and it is ensured that the number of neighboring nodes is enough to guide a traversing node and a traversed node to traverse, and the method defined in this embodiment can simultaneously guide a traversing node and a traversed node to traverse through a plurality of scheduling nodes neighboring the traversing node, so as to improve traversing efficiency.
In certain embodiments, the step S3 of the scheduling node directing the traversing node and the traversed node to traverse further comprises the steps of:
judging whether a plurality of scheduling nodes are in an online state, if at least one scheduling node is online, processing is not carried out, if all the scheduling nodes are offline, n nodes adjacent to the crossing node are redefined to be used as the scheduling nodes, the redefined n scheduling nodes correspondingly replace the original roles of the n scheduling nodes, and the crossing node and the crossed node are continuously guided to cross.
In this embodiment, through the above determination logic, it may be ensured that at least one scheduling node is online, and the traversing node and the traversed node are guided to traverse, and when all scheduling nodes are offline, the scheduling node is redefined to ensure that the traversing node and the traversed node are continuously guided to traverse.
In certain embodiments, the step S3 of the scheduling node directing the traversing node and the traversed node to traverse further comprises the steps of:
in some embodiments, the network layer NAT traversal algorithm for a distributed network further comprises the steps of: after the traversing node establishes connection with other nodes in the same distributed network, when a content request is sent to other nodes, the public key is sent at the same time, the other nodes encrypt the requested content by using the public key and send the encrypted content back to the traversing node, and the traversing node decrypts the requested content by using a private key to obtain the requested content.
The invention also provides a network layer of the distributed network, and the network layer realizes the step of the network layer NAT traversal algorithm of the distributed network when executing;
preferably, the network layer of the distributed network is further constructed based on libnice protocol, libwebrtc protocol or natty protocol.
The above examples are merely illustrative of the preferred embodiments of the present invention, and are not intended to limit the scope of the present invention, and various modifications and improvements made to the technical solution of the present invention by those skilled in the art without departing from the spirit of the present invention are intended to fall within the scope of the present invention defined by the claims.

Claims (10)

1. A network layer NAT traversal algorithm of a distributed network is characterized by comprising the following steps:
s1: any scheduling node in the same distributed network receives a data packet sent by an adjacent traversing node, wherein the data packet comprises an IP (Internet protocol) of the traversing node, a port number and a hash value corresponding to request content;
s2: the scheduling node positions a traversed node storing the request content according to the hash value corresponding to the request content in the data packet;
s3: and the scheduling node guides the traversing node and the traversed node to traverse.
2. The network layer NAT traversal algorithm for a distributed network of claim 1, wherein the step S3 for the scheduling node to direct the traversing node and the traversed node to traverse comprises the steps of:
s311: the dispatching node sends the IP and the port number of the traversing node to the traversed node;
s312: and the dispatching node sends the IP and the port number of the traversed node to the traversing node.
3. The network layer NAT traversal algorithm for a distributed network of claim 1, wherein the step S3 for the scheduling node to direct the traversing node and the traversed node to traverse comprises the steps of:
s321: the dispatching node sends the IP and the port number of the traversed node to the traversing node;
s322: the traversing node sends its own IP and port number to the traversed node.
4. The network layer NAT traversal algorithm for a distributed network of claim 1, wherein the step S3 for the scheduling node to direct the traversing node and the traversed node to traverse comprises the steps of:
s331: the dispatching node sends the IP and the port number of the traversing node to the traversed node;
s332: the traversed node sends its own IP and port number to the traversing node.
5. The network layer NAT traversal algorithm for a distributed network of claim 1, wherein the step S3 for the scheduling node to direct the traversing node and the traversed node to traverse comprises the steps of:
s341: the dispatching node sends the IP and the port number of the traversed node to the traversing node, and simultaneously sends the IP and the port number of the traversing node to the traversed node;
s342: the traversing node receives the IP and the port number of the traversed node and then sends the IP and the port number of the traversing node to the traversed node; the traversed node also sends its own IP and port number to the traversing node after receiving the IP and port number of the traversing node.
6. The network layer NAT traversal algorithm for the distributed network of claim 1, wherein during traversal of the traversing node and the traversed node by the scheduling node, other neighboring nodes of the traversing node take over the role of scheduling node and continue to direct traversal of the traversing node and the traversed node while the scheduling node is offline.
7. The network layer NAT traversal algorithm of claim 1, wherein the number of neighboring nodes of any one of the nodes is 4-6, the scheduling node directing the traversing node and the traversed node to traverse in step S3 includes scheduling node 1, scheduling node 2 … scheduling node n, n is less than or equal to 6, multiple scheduling nodes neighboring the traversing node direct the traversing node and the traversed node to traverse at the same time, and multiple scheduling nodes are located at the same or different traversed nodes.
8. The network layer NAT traversal algorithm for a distributed network of claim 7, wherein the step S3 for the scheduling node directing the traversing node and the traversed node to traverse further comprises the steps of:
judging whether a plurality of scheduling nodes are in an online state, if at least one scheduling node is online, processing is not carried out, if all the scheduling nodes are offline, n nodes adjacent to the traversing node are redefined to be used as the scheduling nodes, the redefined n scheduling nodes correspondingly replace the original roles of the n scheduling nodes, and the traversing node and the traversed node are continuously guided to traverse.
9. The network layer NAT traversal algorithm for a distributed network of claim 1, wherein the distributed network is constructed based on libp2 p.
10. A network layer of a distributed network, characterized in that the network layer when executing performs the steps of implementing the network layer NAT traversal algorithm of the distributed network of claims 1-9; preferably, the network layer of the distributed network is further constructed based on libnice protocol, libwebrtc protocol or natty protocol.
CN202111283857.5A 2021-11-01 2021-11-01 Network layer NAT (network Address translation) traversal algorithm of distributed network Pending CN114221931A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111283857.5A CN114221931A (en) 2021-11-01 2021-11-01 Network layer NAT (network Address translation) traversal algorithm of distributed network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111283857.5A CN114221931A (en) 2021-11-01 2021-11-01 Network layer NAT (network Address translation) traversal algorithm of distributed network

Publications (1)

Publication Number Publication Date
CN114221931A true CN114221931A (en) 2022-03-22

Family

ID=80696375

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111283857.5A Pending CN114221931A (en) 2021-11-01 2021-11-01 Network layer NAT (network Address translation) traversal algorithm of distributed network

Country Status (1)

Country Link
CN (1) CN114221931A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101471878A (en) * 2007-12-28 2009-07-01 华为技术有限公司 Safety routing method, network system and equipment for peer-to-peer session initiation protocol network
CN101841484A (en) * 2010-05-12 2010-09-22 中国科学院计算技术研究所 Method and system for realizing NAT traversal in structured P2P network
US20180103128A1 (en) * 2016-10-07 2018-04-12 Cisco Technology, Inc. System and method to facilitate integration of information-centric networking into internet protocol networks
CN110933197A (en) * 2019-11-27 2020-03-27 太仓市同维电子有限公司 Distributed proxy network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101471878A (en) * 2007-12-28 2009-07-01 华为技术有限公司 Safety routing method, network system and equipment for peer-to-peer session initiation protocol network
CN101841484A (en) * 2010-05-12 2010-09-22 中国科学院计算技术研究所 Method and system for realizing NAT traversal in structured P2P network
US20180103128A1 (en) * 2016-10-07 2018-04-12 Cisco Technology, Inc. System and method to facilitate integration of information-centric networking into internet protocol networks
CN110933197A (en) * 2019-11-27 2020-03-27 太仓市同维电子有限公司 Distributed proxy network

Similar Documents

Publication Publication Date Title
CN108551464B (en) Connection establishment and data transmission method, device and system of hybrid cloud
US9647954B2 (en) Method and system for optimizing a network by independently scaling control segments and data flow
US8380854B2 (en) Simplified method for processing multiple connections from the same client
US11219824B2 (en) Cloud gaming system and method of initiating a gaming session
CN100521663C (en) Method for crossing network address conversion in point-to-point communication
CN100454905C (en) Method for passing through network address switching
JP2004179811A (en) Packet repeating device
US20150358171A1 (en) Dynamic Configuration of a Conference System with Distributed Media Agents
JP2005514867A (en) Method and system for peer-to-peer communication in a network environment
CN111435922B (en) Bandwidth sharing method
CN112055048B (en) P2P network communication method and system for high-throughput distributed account book
WO2012065531A1 (en) Method, device, and system for implementing relay selection
WO2018077304A1 (en) Service information processing method, apparatus and system
EP3817308A1 (en) Method, device and system for responding to request and applied to bt system
JP2001326681A (en) Packet communication system, mobile communication system and communication addressing system
US8179891B2 (en) Method and apparatus for interdomain multicast routing
AU2008232640B2 (en) Providing distributed convergence nodes in a communication network environment
CN114221931A (en) Network layer NAT (network Address translation) traversal algorithm of distributed network
Glebke et al. Service-based forwarding via programmable dataplanes
US11671487B1 (en) Port prediction for peer-to-peer communications
CN115396623A (en) Network transmission optimization method, device and system
Hladká et al. User empowered virtual multicast for multimedia communication
Liao et al. Prototype for customized multicast services in software defined networks
CN105991629B (en) TCP connection method for building up and device
CN113014855A (en) Video conference acceleration method and system and video conference acceleration platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination