You can see every hop an IP packet takes at IP level with traceroute or mtr.
post
Depends, you can set it up a few different ways.
-
you can set the dns so each subdomain resolves to a different port with your ip, in which case your router can forward that port to any local address on your network with port forwarding rules.
-
reverse proxy, this is most common. You use a service to do the translating for you. Your router forwards all requests on port 80 and 443 to your reverse proxy. The reverse proxy takes requests for subdomain1 and forwards it to the associated ip/port locally.
This is something you can easily do from the command terminal. For Windows, use Tracert. Linux and Mac, maybe even iPhone and Android have their own commands to run a trace route, too (I don't know them off the top of my head).
It's called "traceroute" on Linux and Mac because there was never a 8.3 filename limitation on them.
Microsoft had to put it on a diet. It was getting a little FAT.
With IPv4, assuming you have a residential contract without cgnat, your router has your ip. Loosely your device calls your public ip, realizes it is not on your local network, and sends it to your router. The router will nat it, and send it to its own internet-facing networking side, where the same router will realize that the target ip is the ip of it's own interface and will immediately accept it. Then it is handled like any other packet arriving from the internet, presumably port forwarded to some internal machine.
So we expect one hop to the router, then one internal hop from the private to the internet-facing interface of the router, and then presumably another internal hop back to the private network interface and another proper hop to the server on your lan.
DNS request will go to the DNS server but from what I can tell the packet wont go anywhere else. At least on my own network, traceroute gives only one entry and its the final destination. I assume this is because the router knows its own public IP and as such knows the packet doesnt need to be sent anywhere else.
Modern routers have a feature that's typically known as "hairpin NAT" or "NAT loopback". This means that if the DNS lookup resolves to the router's public IP, it routes the packet internally instead of passing it out to the internet. So for your subdomains all of the traffic should stay local. Typically this feature is enabled by default, but you may want to check just to be sure.
all 19 comments