Peer-to-peer is a networking model where the two parties involved in either sides of a connection have the same functionality. In contrast, Server-Client model offers one party to run a service while the other uses it. In P2P, both parties are servers+clients themselves and each party is called a 'node'.
For two devices to connect P2P,
They must;
- be able to communicate with each other
- be able to see whether the partner is accepting connections or not.
P2P networking can be observed at 2 levels.
1. Within a LAN (Local Area Network)
P2P Within LAN
P2P within a LAN is quite simple and most Operating Systems have builtin P2P functionality. A familiar example would be file, device sharing within the LAN.
- There's no problem communicating within the LAN
- And each node can fairly easily detect which other nodes are available
P2P Over the Internet
P2P over the Internet was also fairly simple at the past stages of the Internet where each an every computer/device had a unique Public and Static IP address. But that's no longer the situation.
- The IPv4 addressing system became inadequate to assign Public IP addresses to every device. As a result, only LANs may be assigned a public IP. Then, all the devices within the LAN will have the same public IP and it's going to be hard to lock on to a single device among them.
- NATs(Network Address Translaters) are the gateways that rest between such LANs and the WAN- mostly the router. Because of its design, NATs will refuse connections from the WAN into the LAN. The only connections possible should originate from within the LAN.(This is the worst case)
- Devices with dynamic IP addresses are much difficult to be tracked.
Relatively, its much more tough to work on purely P2P basis. Each node will have to scan the Internet to detect other available nodes which is going to be very very consuming. Besides, there's no simple way of keeping track of nodes with dynamic IPs; each time those nodes connect on and off the Internet, they'll have different different IP addresses.
Solution
Therefore, the easiest way for establishing P2P involves mixing a little bit of server-client architecture and use support from a central server. The central server keeps track of the nodes and provide connectivity information between the nodes. Other than that, there's no data streaming through the server.
Each time a node joins the WAN, it connects to the central server and introduces itself as a node. The server maintains a list of active nodes. With the help of this, nodes can virtually see each other and will get to know the exact IPs of each other. Thus, nodes can see each other.
However, this doesn't solve all the cases. Even if nodes see each other and know where they are, they may not be able to connect! This is because NAT gateway devices don't allow connections from the Internet to reach a device under it. If both nodes are under NATs, connection seems impossible. However, there are some ways around to get past the NAT. One such technique is called 'UDP Hole Punching' where both nodes send 'connect' signals to each other simultaneously and eventually trick the NATs to think connection started from within its territory.
Conclusion
P2P is considered a bit advanced technology implementation. It allows two devices to utilize maximum performance while transferring payloads between each other. Skype and Bittorrent are some famous uses of P2P. P2P may also be used by hackers for creating and commanding botnets. Even though Peer-to-peer was supposed to mean a decentralized the Internet, it has become difficult to implement its strict sense. That is why most people argue P2P is not pure P2P. It has come clear centralization is not something to give-up easily neither something which can be so easily.
Comments
Post a Comment