Why don't p2p connections need open ports?

I mean, if someone is downloading a file from me, doesn't that means that I'm the host and he is connecting to me?

Or am I connecting to him?

Either way one of us need an open port, no?

I don't have any open port routing to my computer in my router, so how is that I'm accepting connections?


If your router supports UPnP, it is possible that the p2p application that you are using is opening ports on the router without you needing to manually configuring open ports.

Wikipedia UPnP

Otherwise, it is possible that your application is using a process called NAT traversal, which is common in p2p applications and remote desktop applications such as GoToMyPC or Hamachi. This technology is designed to work through Network Address Translation, which is considered a firewall, but is also a means for having a private network sharing a single IP address on the internet (what your router uses).

Wikipedia NAT Traversal


In protocols like BitTorrent as long one one of the two sides of the connection has port forwarding turned on the open side will always act as the host. If both sides are open either end could be the "host". If both sides are closed you need a 3rd party who has a open connection to negotiate the connection, this is how things like skype does it (the 3rd party is called a Supernode)

Here is a good blog post explaining how skype uses Supernodes and how it uses it to get around firewalls.


I would compare open port with a telephone number.

Imagine you can have a telephone to dial, but not a telephone number to receive calls.

For two parties to talk to each other (or one talking all the time) it does not matter who actually dial. The important part is that at least one them has a telephone number, then the other partner just calls him.

If none of them has a telephone number, a supernode is used in some systems, which could be friend that receives two calls, one from each of them, and joins them together. This is the only way to talk if none of the two parties has a telephone number. The problem is that the conversation is then constrained to the quality of the telephone line of this supernode friend.

I hope this analogy makes it easier to understand the 3 possible scenarios.