3

Background: I'm working on a hole punching service with UDP, and in order to differentiate users under the same public IP, I've thought of making the user also send their local IP. That way, I killed 2 birds with 1 stone: Clients are uniquely identified, while also making the server offer users to establish a direct connection (if possible), rather than hairpinning it.

All seemed perfect (especially the unique identification), until I realized this is possible:

Double PAT example

So here's the actual question: How widespread are such situations, if they are even used, and where?

Sašo
  • 1,464
  • 2
  • 9
  • 13
  • Though I have a feeling that I'm more likely to generate the same random number for 2 clients under same ip than to ever encounter such a situation. – Sašo May 08 '12 at 13:48

3 Answers3

5

This situation is quite often in countries like China, and with smaller ISPs (especially wifi ISPs) in other countries. They get a relatively small range of IPs, and then do a large-scale NAT for their users.

Of course, most of those users buy a cheap SOHO router and fall in the 192.168.1.0/24 range for the inner-NAT.

mulaz
  • 10,472
  • 1
  • 30
  • 37
4

I have seen simular setups when users run out of ports on their ISP supplied 4 port router where 2 ports are already used for TV's they just plug in a cheap soho for the upstairs wired pc's. So i dont think its that uncommon

Sibster
  • 397
  • 1
  • 3
  • Though in those situations, there's generally only one 192.168.0.x network, which in my case wouldn't cause any issues. – Sašo May 08 '12 at 14:23
  • @Sašo, Not true at all! It's very common for those 2Wire routers to provide 192.168.1.0/24, and then some other router to provide the same. This type of conflict happens all the time. – Brad May 08 '12 at 17:10
2

If I understand you correctly, you want to generate a unique client identifier using a combination of the public IP address and the local IP address of the client. But this combination is not guaranteed to be unique.

You should consider using the public IP address along with the connecting port number. That will uniquely identify the client.

Marwan
  • 21
  • 2