34

What is the mechanism behind allowing BitTorrent to work with only outbound connections?

That is, without port forwarding.

Brian's BitTorrent FAQ and Guide says:

BitTorrent will usually work fine in a NAT (network address translation) environment, since it can function with only outbound connections.

Do other peers work as rendezvous servers in this case?

6 Answers 6

11

As far as I know, It works using reverse connections - basically, your client does an outgoing connection which is kept open by the remote machine and they pump data through that same connection.

If everyone used this and no one had ports setup, it would most likely fail. When I have used Bittorent with ports disabled, I get horrendous speeds, but it does work which is why I think it works like this.

4
  • Why would this method result in lower speeds than if the ports were forwarded?
    – gsgx
    May 25, 2015 at 3:45
  • @gsingh2011 there are many reasons... the most common with BT is that it may relay you through other people, so, your download speed can be limited by other people's upload speed. May 25, 2015 at 4:18
  • For tracker this is right and not a problem. but for download this is not true. because bit torrent download mechanism needs download from other peers. other peers may be behind a NAT (like you). So how bit torrent works behind a NAT? Dec 13, 2015 at 8:03
  • 13
    This is a partial answer regarding general NAT traversal techniques. True question is: How do you know that someone wants to download some file blocks from you, since you don't accept any unsollicited connection? So there only limited possibilities: either the tracker warns you, or you actively connect to several tracker clients to initiate peering sessions (so they could ask for downloads at some point in time), or you only accept requests from peers that you are actively downloading from, or these peers acts as Rendez-Vous points. So, what proposal is implemented in torrent client?
    – KrisWebDev
    Feb 27, 2016 at 15:41
10

BitTorrent works using P2P connection. Therefore there must be a way to direct connecting to peer. As you know, NAT breaks P2P to working. But there is some solution for this to works. Most (as I know all) is based on STUN protocol.

Each client get its public IP and temporary port number (UDP) using STUN server. STUN server helps client to detect presence of NAT and detecting public ip + temporary port number (assigned by NAT). Then client tries to establish a direct connection to other peer using punching hole technique (see wikipedia).

If you enabled UPnP also there is another solution too.

For more information see NAT Traversal on wikipedia.

0
8

The peers behind a NAT work through a technique called "Hole punching". There are two types of "Hole punching" for UDP and TCP, but essential idea is the same. But there is a third facilitator also sometimes called as rendezvous server which helps two peers make a connection. In case of BitTorrent a third peer may act as a rendezvous server to facilitate two other peers make a connection. From the perspective of peers intending to communicate there is only an outgoing connection from either side.

it is important to note that Hole punching may work for 60 - 70 % NATS but not necessarily all of them, because the technique depends on the NAT mapping between local and public end points made by the NAT server. if NAT server has a slightly different approach to make those mappings which are not easily predictable then hole punching does not work.

6

Yes, other peers help the parties to establish the connection. It's described in BEP 55: http://bittorrent.org/beps/bep_0055.html

In a nutshell, it's an implementation of https://en.wikipedia.org/wiki/UDP_hole_punching adapted for the distributed nature of the BitTorrent protocol.

4

There was a recent podcast on IT Conversations titled How Your ISP Plans to "Help" You, and Break the Internet where Dr. Cullen Jennings talked about various mechanisms for NAT traversals. It's only 15 minutes long and worth a listen.

1

Normally, people will connect to you to ask for data from you, and you will connect to people asking for data from them.

If incoming connections is impossible, your client will also go out and actively ask to give data to other people (and may do this if incoming connections are possible as well).

You do not upload as much this way, but it's not much of a concern on public trackers.

You must log in to answer this question.

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