2

I want to know how p2p protocol routes over networks.(for example in torrent) In the client-server architecture we have a valid ip address for server,but in the p2p we do not have that .when we have local ip addresses,how packets are routes over the internet? Thanks alot.

1

3 Answers 3

5

"Peer-to-peer" really means any node, or peer, can act as either a client or server in some capacity. So things that work in such a fashion don't require a single central node to work.

Peers must know the IP addresses of other peers to successfully do whatever the peer-to-peer protocol is trying to accomplish. So some type of discovery mechanism or protocol is needed, and some type of centrally available point is really needed, even if it only plays an introductory role.

Bittorrent relies on a tracker as such a central point - it's nothing but an HTTP server that responds with other IPs on the swarm when a peer asks for that information. Other things like distributed hash tables can be used - these are traded amongst all peers, but rely on a few well-known IP addresses to get "bootstrapped."

2
  • Ok,when a peer request tracker the ip addresses,what ip address send to it?because it does not have any valid ip.how can a peer connect to other peer? Oct 5, 2013 at 13:49
  • Tracker sends the peer that makes the request the IP addresses of other peers. Once the peer consults the tracker it can make connections with other peers. Tracker DNS hostname or IP is embedded in the .torrent file itself.
    – LawrenceC
    Oct 5, 2013 at 14:28
3

For the most simple p2p connections one of the two sides of the connection must have port forwarding (be it uPnP or manual setup) for a p2p connection to be established.

After that you just talk to the IP of the router that has port forwarding set up, then it forwards those packets to the computer that acts as the "server" in the p2p connection (the "client" side that has no port forwarding is the one that initiates the connection)

There are some work arounds where you can use a 3rd party to do things like NAT hole punching and is only involved in the setup of the p2p communication.

There always must be at least one computer involved that can accept incoming connections at some point in the setup of a p2p communication connection.

1

A peer to peer network, whether as part of a physical network configuration, or done over the internet, is a common use for a mesh network. From that Wikipedia article:

When using a routing technique, the message is propagated along a path, by hopping from node to node until the destination is reached. To ensure all its paths' availability, a routing network must allow for continuous connections and reconfiguration around broken or blocked paths, using self-healing algorithms.

If you're interested in the BitTorrent protocol (which is a bit more specific than general p2p), you can read the specification, or browse BitTorrent's site and forums for more information.

Not the answer you're looking for? Browse other questions tagged .