2

How come bittorrent clients manage to communicate to servers and other peers even if the user has not configured port forwarding on their routers?

Of course the speed will be reduced compared to when port forwarding is done, but still they manage to communicate? How???

Are there any inbound ports which are always open?

sysadmin1138
  • 135,853

2 Answers2

4

Inbound connections are accomplished by a third peer.

Say peer A wants to connect to peer F which is behind a firewall. Then peer A instructs peer B which is already connected to F that it wants to connect to F. F then gets the message and connects instead to A. I do not know the interna of the BT protocol, but B could be e.g. the tracker as it is well-known to both peers. For this scenario to work, A must accept incoming connections. AFAIK in Gnutella, F's ultrapeer played the role of B. This scenario generally works for TCP.

For UDP connections, check also UDP hole punching.

1

If a client has no port open (in the language of most small residental routers), that only blocks incoming connections.

A machine behind that router can still initiate connections with others. Once it does, the router remembers that and allows two-way communication. NAT, the function that lets you have more than one machine share a single public IP, has to do this to work.

So communication is possible with no open ports on your router, it's just your computer has to initiate it; an external machine cannot initiate connection with any computer behind that router unless you open a port, and connect a port to a specific IP behind your router.

I'm not too keen on the low-level details of the bittorrent protocol, but I think it or some revision thereof allows machines to receive data by initiating connections with others somehow, rather than just listening on an open port and waiting for an external machine to start a connection.

LawrenceC
  • 1,262