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:
So here's the actual question: How widespread are such situations, if they are even used, and where?
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.
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
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.