Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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 8 '12 at 13:48
add comment

3 Answers

up vote 5 down vote accepted

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.

share|improve this answer
add comment

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

share|improve this answer
    
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 8 '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 8 '12 at 17:10
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.