Peer-to-peer Penetration Research _p2p

Source: Internet
Author: User

The so-called peer-to-peer is point-to-point communication. Search related articles before, a lot of "peer-to-peer network penetration", thinking about whether there are "outside the net penetrate." Intranet is not easy. The extranet is not more difficult and more advanced. Here on the laughable, peer-to-peer penetration, refers to the intranet (LAN) penetration.

1, why the peer-to-peer need to penetrate, or to say what penetrating is.

First of all, understand that all networked devices can communicate, not only BS (Browser-server browser-server) communication, not only CS (client-server client-server) communication, but also two devices to communicate directly, It can actually be understood as CC (client-client) communication because there is usually a client running there.

There are no servers in the communication between the two devices (of course, the server will need help to penetrate, said the latter).

Theoretically, if two devices have public network IP, for example, two servers with public network IP, can communicate directly. These devices are prevented from communicating because these devices do not have a public IP. Usually our general network, a general device, a PC or a mobile phone via WiFi, is connected to the router, and the router is responsible for the communication with the outside. In the intranet, these devices have an intranet address, they share an external network address, and then through the router allocation port number, using the same public network ip+ different port number corresponding to each intranet equipment. There is a name called NAT (Network address translation), which refers to a function, or a protocol, that is not necessarily a specific device, where we usually assume that the router performs this NAT function.

In other words, if we know an intranet device of the public network IP and his corresponding port number, you can communicate with him, of course, there is a small problem, is that the first visit will not be successful, because the router does not record this visitor's information (session), When the next time the same device (if his IP and port does not change) he will be able to recognize him, and release, let him and the corresponding device connection.

2, how to achieve penetration.

The so-called implementation of the penetration of course is to obtain the IP and port of the other device and then communicate.

Frankly speaking, because the intranet device IP and port is unknown, so need to penetrate. If it is known, the direct request is that the first request will not pass, and then ask him again. This is the first time the penetration of the action (NAT generated a session, so that the next access can be connected), in fact, the difficulty is the IP and port, rather than this attempt request.

3, how to obtain IP and port number.

Assuming that devices A and B are two computers located on different LANs, they cannot penetrate them without the help of other devices. Do not know the IP does not know that the port is not able to connect. If you know the IP does not know the port can not connect. Suppose a situation, equipment a-> equipment B for each port number to request 2 times, the first will not penetrate, the second on the through, in the device B listening to requests, if received to meet the expectations of the request is recorded, so seemingly also can connect, of course, this efficiency is too low, not to consider. So here's the introduction of a medium, a server, that any device can be connected to.

Let devices A and B request Server C, respectively, Server C will get devices A and b IP and port number, then c to tell A-b IP and port, tell B-a IP and port, then A and B on each other's IP and port, then A and B communication becomes feasible.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.