I don't understand basic routing concept. Namely, how does remote internet server construct packet when sending it to my local IP address.
Consider real life example. I am connected to the Internet through my provider. Provider gives me and other clients ip addresses from private range 10.100.251.1-255
. Suppose that provider gives me ip address 10.100.251.4
dynamically. I wan't open stackoverflow.com(151.101.65.69)
site in browser. Heap of gateways exists between me and stackoverflow.com
. Last gateway that connects me with external Internet is 85.112.122.13
. When I open stackoverflow.com
in browser my computer constructs packet with destination address is 151.101.65.69
, looks up gateway for this address in routing table and sends packet to gateway. This first gateway does the same and forwards my packet to second gateway, and so on until packet arrives to last gateway 85.112.122.13
. Let suppose for simplicity that 85.112.122.13
sends may packet to stackoverflow.com
directly. Now stackoverflow.com
gets my packet and wants to send me response. But I don't understand how does it do this. All that stackoverflow.com
can get from packet is source ip address (10.100.251.4
). But this ip address is private and no routers in the internet knows where to send packets for this. Where am I wrong and how internet server sends response to private ip address?