P2P Technology Entry, Nat, UDP, TCP Holes

Source: Internet
Author: User

1. What is P2P:

P2P is the abbreviation of peer-to-peer. Peer has the meanings of "peer-to-peer", "peer", and "peer" in English. In this way, P2P can be understood as "peer-to-peer", or "Peer-to-Peer Networking. At present, people think that it has a bright future in strengthening the communication, file exchange, and distributed computing among others on the Internet ....

See http://www.kuqin.com/p2p/20080411/6476.html for details
What we usually call peer network is a P2P network. The concept of P2P weakens the status of servers on the Internet, making every computer a server and a user, share the resources you need.

 

2. What is Nat:

To understand P2P, you must understand Nat. When writing a general socket program, you must know that when a TCP connection is established, if the connection is on the Intranet, its Intranet IP address is 192.168.0.2 and the gateway is 192.168.0.1, how does the server send information to 192.168.0.2 on the Intranet when it requests the 61.155.8.220 public IP server?

To understand this, you must first learn about Nat?

NAT (Network Address Translation) provides a simple solution for LAN Internet sharing. When an intranet user connects to the Internet, Nat converts the user's internal IP address into an external public IP address. Otherwise, when data is returned from outside, Nat reversely replaces the destination address with the address of the initial internal user. In fact, Nat hides the internal IP address and forms a natural firewall.

Return to the preceding example. The vro itself has two IP addresses, one Intranet IP Address: 192.168.0.1 and one public IP Address: 127.123.3.37. For the Intranet machine 192.168.0.2 (the initiator port is 4000) connect 61.155.8.220 (Port 6000). The process is as follows:

192.168.0.2: 4000-> route Nat to the internet side 127.123.3.37: 60000-> 61.155.8.220: 6000;

Same feedback

61.155.8.220: 6000-> route Nat Translation: 192.168.0.1: 60000-> 192.168.0.2: 4000;

Nat converts IP addresses and ports to adapt to the Intranet and Internet environments. Of course, different routes may have different NAT forms. The following describes four main Nat methods.

1. Full cone NAT:There is a NAT device in front of the host. The Nat rules are as follows: Packets sent from host UDP port a will correspond to port B of the NAT device's egress IP address, packets sent from any external address to UDP port B of the NAT device will be forwarded to host port.

2. Restricted cone NAT:There is a NAT device in front of the host. The Nat rules are as follows: Packets sent from host UDP port a will correspond to port B of the NAT device's egress IP address, however, only the packet sent from the destination IP address of the previously sent packet to the UDP port B of the NAT device will be forwarded to host port.

3. Port restricted cone NAT:There is a NAT device in front of the host. The Nat rules are as follows: Packets sent from host UDP port a will correspond to port B of the NAT device's egress IP address, however, only the packet from the destination IP address/port of the previously sent packet from the host to the UDP port B of the NAT device will be forwarded to host port.

4. Elastic Ric NAT:There is no NAT device at the host exit, but there is a firewall, and the firewall rules are as follows: Keep the source address of the packet sent from host UDP port, however, only the packets sent from the destination IP address/port of the previously sent packet to port a of the host can pass the firewall.

Currently, the low-end routes are all full cone.
Nat is also the best support for P2P network drilling.

1. What is P2P:

P2P is the abbreviation of peer-to-peer. Peer has the meanings of "peer-to-peer", "peer", and "peer" in English. In this way, P2P can be understood as "peer-to-peer", or "Peer-to-Peer Networking. At present, people think that it has a bright future in strengthening the communication, file exchange, and distributed computing among others on the Internet ....

See http://www.kuqin.com/p2p/20080411/6476.html for details
What we usually call peer network is a P2P network. The concept of P2P weakens the status of servers on the Internet, making every computer a server and a user, share the resources you need.

 

2. What is Nat:

To understand P2P, you must understand Nat. When writing a general socket program, you must know that when a TCP connection is established, if the connection is on the Intranet, its Intranet IP address is 192.168.0.2 and the gateway is 192.168.0.1, how does the server send information to 192.168.0.2 on the Intranet when it requests the 61.155.8.220 public IP server?

To understand this, you must first learn about Nat?

NAT (Network Address Translation) provides a simple solution for LAN Internet sharing. When an intranet user connects to the Internet, Nat converts the user's internal IP address into an external public IP address. Otherwise, when data is returned from outside, Nat reversely replaces the destination address with the address of the initial internal user. In fact, Nat hides the internal IP address and forms a natural firewall.

Return to the preceding example. The vro itself has two IP addresses, one Intranet IP Address: 192.168.0.1 and one public IP Address: 127.123.3.37. For the Intranet machine 192.168.0.2 (the initiator port is 4000) connect 61.155.8.220 (Port 6000). The process is as follows:

192.168.0.2: 4000-> route Nat to the internet side 127.123.3.37: 60000-> 61.155.8.220: 6000;

Same feedback

61.155.8.220: 6000-> route Nat Translation: 192.168.0.1: 60000-> 192.168.0.2: 4000;

Nat converts IP addresses and ports to adapt to the Intranet and Internet environments. Of course, different routes may have different NAT forms. The following describes four main Nat methods.

1. Full cone NAT: There is a NAT device in front of the host. The Nat rules are as follows: Packets sent from host UDP port a will correspond to port B of the NAT device's egress IP address, packets sent from any external address to UDP port B of the NAT device will be forwarded to host port.

2. Restricted cone NAT: There is a NAT device in front of the host. The Nat rules are as follows: the packets sent from host UDP port a will correspond to port B of the NAT device's egress IP address, however, only the packet sent from the destination IP address of the previously sent packet to the UDP port B of the NAT device will be forwarded to host port.

3. Port restricted cone NAT: There is a NAT device in front of the host. The Nat rules are as follows: Packets sent from host UDP port a will correspond to port B of the NAT device's egress IP address, however, only the packet from the destination IP address/port of the previously sent packet from the host to the UDP port B of the NAT device will be forwarded to host port.

4. symmetric NAT: There is no NAT device at the host exit, but there is a firewall, and the firewall rules are as follows: Keep the source address of the packet sent from host UDP port, however, only the packets sent from the destination IP address/port of the previously sent packet to port a of the host can pass the firewall.

At present, the low-end routes are basically full cone Nat, which is also the best support for P2P network drilling.

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.