How do services and applications differentiate between two PCs in the same network if they have the same public IP?

201 viewsOtherTechnology

How do services and applications differentiate between two PCs in the same network if they have the same public IP?

In: Technology

4 Answers

Anonymous 0 Comments

MAC address; local 10.0.0.0 (or is it 192.168). ip address ; local host name (less likely) 

 Devices still get a unique IP even if all traffic gets makes and exits through a single public facing IP

Anonymous 0 Comments

That’s where the network address translation (NAT) table comes in. The packets coming into your network have additional data attached to them that lets your networking equipment forward them to their correct destination. If your phone’s hostname on your local network is, say, “myphone” or whatever, the packet is marked to be delivered to “myphone” at your IP address.

Things get more complicated than that as you nest networks inside networks inside networks (you probably share your public IP with a whole bunch of other users, meaning your whole network is an entry on a larger NAT table somewhere in some “public” piece of networking equipment that serves your whole neighborhood), but that’s the gist of it.

Anonymous 0 Comments

If two PCs share a public IP, then there is a router between them and the Internet, and that router implements Network Address Translation (NAT).

Within the local network, controlled by the router, the two PCs have different IPs (like 192.168.0.something). The NAT translator in the router sends the messages from each LAN IP address with a different port so that when the data comes back it can figure our which LAN IP to sent the packets to.

There are many more details of NAT, and it’s a rather complex topic, and this is only the ELI5 simplification of the facts.

Anonymous 0 Comments

your router uses a thing called Network Address Translation (NAT). https://en.wikipedia.org/wiki/Network_address_translation

it keeps a list of all the devices on your network and their private internal ip, then when one of them sends a message to the internet, the router takes the message and swaps the private ip for the public ip, and sends it out on the internet. it also changes the “reply to this port” field (each IP has like 60000 different ports it can use to get messages).

it then keeps a table of which port is expecting a reply, and what the original private ip and port were, then when the router gets a reply on that port, it again swaps out the informztion for the original and sends the packet to the private ip internally.