user8325209
user8325209

Reputation:

How does a packet know how to reach a device within a subnet?

This is a question which has been bugging me a long time. I've been searching for an answer in my studies and just always assumed that "Im sure I've missed something or that I'll learn it further ahead" but well, I haven't. Anyway assuming a packet with tcp+ip is sent:

How does this packet know which specific device it should go to within a router, judging only from public ip and port address?

To be even clearer, lets say the public ip address of my home router is 155.100.100.10 (which is the destination in the IP header) and I have three devices connected to it so all of these three devices have the same destination ip address. So the destination IP is in the IP header, the port of what process to go to is in the TCP header, but how on earth does the packet know which one of the three devices to go to?

If it's subnetting, please do explain where the sender of the packet includes the specific information on what subnet to send to, because I can't seem to find it even after some wireshark digging

Upvotes: 1

Views: 64

Answers (1)

user8325209
user8325209

Reputation:

Nevermind, I found it, I guess I'll leave the answer here for anyone else who might stumble upon the same thing:

Basically the client registers it's own local address and a unique port on a network address translator (NAT) device/"router" when sending the request. So when the server replies with only the public ip address, it uses the reserved port to see where in the subnet to send the info.

Upvotes: 1

Related Questions