my question does not concern how it moves through the internet, but how it moves through the router to a certain device. All devices connected to a router in a home network have the same external IP. Say device A is loading a page and packets are sent from an external source to the router because the packets know the external IP of device A and they are able to get to the router. But now, how does it get to device A? How does the router know to send it to device A instead of device B?

I think this involves the NAT, but i'm just looking for a logical explanation of what NAT does to accomplish this.

  • I can't give you a very specific answer, but the router keeps track of where a request is going and who sent it. When the external source responds, the router simply checks to see which device attempted to contact the external source initially, and forwards the response to that device. If you need more information, look into NAT. Dec 26, 2012 at 3:17
  • This question belongs to Superuser.com
    – TimothyP
    Dec 26, 2012 at 3:18

2 Answers 2


When you initiate a connection out to an external site, the router is using a different source port number each time... it then uses that source port number (which is where the data returns to) as the key to look up which machine on your internal network the request came from. This is called PORT Address Translation (as opposed to Network Address Translation, which is when you have multiple network addresses available to your router).

  • 2
    this would explain things like TCP connections, but some applications are connectionless. What about UDP packets? What if you're hosting a server on 1 device, even if it uses TCP for the connection, it wont be able to initialize a connection without the router knowing which device the server is on.
    – Dan Webster
    Dec 26, 2012 at 3:23
  • 2
    For UDP connections you usually have to pre-define a port on your router that can be used to route to a specific device. This is the "port forwarding" feature of routers, and can be used either for incoming UDP packets (either in response to an outgoing message or a fresh incoming packet) as well as for incoming TCP packets (eg those initiated by a remote client instead of your own PC.) Dec 26, 2012 at 3:26

Normally, All device from Home network have different internal address (private address, always

When a packet is send from Home network (let's say Device A:, when it pass through router, the router will translate the private address to router's external address (assume is, and the router also record this mapping in it's NAT.

When the response is back, the router mapping the NAT, and find the original source is Device A.

so the device A eventually receive the packet.

This is just a concept, for more detail, please refer wiki: NAT.