Tribler / tribler

Privacy enhanced BitTorrent client with P2P content discovery
https://www.tribler.org
GNU General Public License v3.0
4.84k stars 449 forks source link

Analysis on the usage of NAT's #4657

Closed dsluijk closed 5 years ago

dsluijk commented 5 years ago

There was a request for an analysis of the usage of the different types of NAT's. This issue will track the attempt for doing so.

How

As it's to my knowledge not possible to detect a NAT on a IP-address passively, it has to be an active system. The easiest way to achieve this is trough a website. Using WebRTC we can find out if the user has a private IP (thus behind a NAT), and by using the flowchart below we can even know which type.

The goal is to build a simple website which can be shared with as many people as possible. If the user lands on this website it start the flow. The result of that will be stored on the server for further analysis.

STUN algorithm

ichorid commented 5 years ago

It would be interesting to get some kind of stats on the correlation between types of internet providers and types of NATs they use(e.g. 4G is ipv6, etc.). I guess there should be some prior works on these like the Internet Census .

dsluijk commented 5 years ago

That would be one of the goals of the analysis. I intend to store a few key points of data:

Any combinations of that data can be used in analysis. I think I'll store it inside an ELK stack, so data analysis would be really easy.

dsluijk commented 5 years ago

This can be used to find the private IP address: https://github.com/diafygi/webrtc-ips

ichorid commented 5 years ago

How are you going to gather the data? From Tribler clients?

dsluijk commented 5 years ago

I don't think this will be repasentitive of the general usage. Tribler has a bias towards the more tech savvy, and more importantly only supports desktop computers. This would almost entirely eliminate the mobile networks from the analysis, which is exactly the most interesting group.

The best way is to create a website which will run the test automatically. This means it can be run on almost all relevant devices, with a low bar of entry as you'd just have to click on a link. One problem is that you'd have to convince people to click on a sketchy looking link. Another possibility is so include the script on other sites like a traditional tracker.

The best method would be one like the internet census you linked, but I don't think anyone would be happy by using a 0-day like that.

ichorid commented 5 years ago

Maybe we don't need to do it by ourselves? I'm sure there should be some pretty recent information on the distribution of NAT types.

dsluijk commented 5 years ago

That would be ideal, but I couldn't find any. This could be because I don't really know where to look. Both Google and Google Scholar did not turn up anything relevant. If you could tell me where to look I'd be happy to look further.

synctext commented 5 years ago

Dupe of: https://github.com/Tribler/tribler/issues/2754

devos50 commented 5 years ago

Our lab already has some prior publications on this topic:

For more recent work, I usually go to semantic scholar, fire my query with some relevant keywords and sort the results on 'recent'. One of the top results points to this privacy-preserving NAT detection mechanism in IoT. I used this query.

dsluijk commented 5 years ago

Then I don't really see a point of doing this. I was under the impression there was a request for this kind of census. Closing it for now.

devos50 commented 5 years ago

Well, what would be nice is a way to check in Tribler whether a specific user is connectable or not. For example, a user needs to be connectable in order to start trading in the decentralized market (see #2559).

ichorid commented 5 years ago

@dsluijk , so can you now answer the question that was the reason to start this issue: what percent of our users will become connectible if you implement Kademlia-like packet routing in Tribler to circumvent NATs?

synctext commented 5 years ago

Ahhh. Now I possibly understand you. Nat puncturing for smartphone. See our prior work on that: https://github.com/Tribler/app-to-app-communicator/