Nat – How to connect to P2P clients behind a router

nat;p2p

Apologies if this question has been asked before, but I don't think any of the ones I've found are asking quite the same thing.

I'm designing a simple P2P protocol whereby a known server provides clients with each others' addresses, and they then communicate. I'd imagine there are some similarities to BitTorrent, Skype, and other P2P applications.

My question is, how can hosts that use NAT, being behind some router or firewall (i.e. 99% of home users) be identified and communicated with without manual port forwarding? I know it's possible, because BitTorrent and Skype work just fine.

I'm a relative novice in networking, so I greatly appreciate being able to call upon the collective wisdom of this community.

Best Answer

You need nat traversal (nat-t) or nat hole punching. This is a partial solution, as many nat gateways will not allow that. This means you'll need servers with public IPs to pass the traffic between restricted nat clients as part of your solution.

Related Topic