3

hi this has my head wrecked and cant get my head around it 1st some assumptions

1.

if a computer out in the big bad web tries to send my computer data my routers NAT-PAT firewall will ingore it and wont let it through or route it to my computer if however i sent them a request they can respond but i cant send them a request unless they have a port forwarded through there firewall.

2.

peer 2 peer works by users sending each other data such as in a torrent and everyone shares what they have without passing through a central server with a port forwarded to it.

question.

so when i join a torrent how does my computer start send or recieve data to and from other peers when none of us have ports forwarded?

1
  • Most firewalls allow any connection that is originated from 'inside', only being concerned about uninvited intrusion from outside. [This does not include corporate firewalls, only consumer]
    – Tetsujin
    Jan 2, 2015 at 19:36

1 Answer 1

4

so when i join a torrent how does my computer start send or recieve data to and from other peers when none of us have ports forwarded?

The answer is, for torrents you can't. To be able to connect in a p2p network one of the two sides must have a port opened in the firewall to connect. Most torrent software will use UPnP to automatically open a port in the firewall and set up port forwarding for the torrent software.

When you are connecting to someone who has a open port it is just a normal connection.

When you have the open port and you want to connect to people who do not have a port open on their firewall your torrent software lists your machine on the tracker with your IP and port you have open and then you must wait for other users to connect to you before you can start communicating with them.


Some p2p networks (torrents do not use this however) will use a 3rd party peer (another machine in the p2p network who does have his ports open) to pass through the connection, this is often known as a "Supernode". Another option to get around firewalls is you use a 3rd party to exchange "metadata" then you perform NAT Hole Punching to form a direct link with your partner.

4
  • thanks for info i have been reading up on hole punching if i understand cpu A connects to server,The server knows what port to send data back on and gives this port to cpu B, and vise versa. but i tought natpat firewall would only allow traffic on the response port if it came from the same ip it sent a request to not from any ip on that port so how does it work or am i wrong Jan 3, 2015 at 19:27
  • @buillbogger What the two computers do is they try to talk to each other with the information they got from the server, each starting a outgoing connection that they know will fail to the other computer. Once they do that that "tricks" the nat routers in to thinking a two way connection has been established, after those initial failed packets get sent future packets will start going through (but only sometimes, hole punching is not always reliable, some routers can't be "tricked" in to doing it) Jan 3, 2015 at 20:22
  • thanks for reply and sorry if im being stupid but if A send request to B B dumps it, B sends request to A A dumps it A sends request to B who will be listening on a port from the request it sent- it will still get dumped becouse it wouldint be on the right port and so how does A get the port B is listening on if the router dumps it and even if there was a publicley accessable server logging info from both peers it would be a different port the peers would be listening on due to it being a different connection THIS IS A REAL HEADWRECK Jan 3, 2015 at 20:48
  • A sends to B on port Y using source port X, B's router dumps it. A sends to server "I sent a message to B using source port X destination port Y" and starts listening on X for new messages, B gets message from server, B sends to A using destination port X source port Y. A's router thinks this new message from B was the reply to the first message A sent and forwards the message on to A, A receives the message from B on X and can now use that channel for two way communication. Jan 4, 2015 at 0:33

You must log in to answer this question.

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