Tuesday, November 24, 2020

Communication between private IP end nodes

Disclaimer: I am really new to networking, all my knowledge comes from the Google.

I was studying basics of TCP/IP protocols and was thinking about scarcity of IPv4 address space. I am familiar with how the standard server/client TCP communication works. Namely, the client (who is usually at a private IP) sends TCP request to the server (who is at a known public IP). The clients default gateway uses NAT and attaches its own public IP as a source IP and forwards the message to the server. Server reply is sent back to home router's public IP. He then translates it back to private IP and the client gets the message.

But I was wondering, can the server initiate a connection with a host on a private IP. Or even more, can two hosts on private IPs communicate directly with each other, given their gateways' public IPs are known? How?

As far as I can tell, every time I communicate with someone online, I do it using a third party (say Facebook), but I don't see why the third party's server would be necessary. I am aware that ISPs sometimes allocate only one public IP for a private network where they put a group of hundreds of their users, hence I would need some additional info about my friend, not just his public IP. I guess it has to do something with ports, but I'm not sure how. If someone could direct me to readable literature on this topic, it would be very helpful.



No comments:

Post a Comment