For the sake of the example, assume gateway to be
10.0.0.1 and host A (my machine) to be
If gateway (
10.0.0.1) is running a service bound to a port on localhost only, the service should be inaccessible to anyone on the network. However, if I configure machine A (
10.0.0.2) to route all traffic to
10.0.0.1 then route those packets to itself? Is my assumption correct that packets sent to
127.0.0.1 regardless of their source will be sent to that address and therefore, packets which leave localhost but are addressed to
127.0.0.1 will become addressed to the next "hop"'s loopback? Does it largely depend on the network and gateway or does it work/not work in most cases?
A transcript of what I mean:
10.0.0.1 - "Hey! Send this to 127.0.0.1 for me, 10.0.0.1?" 10.0.0.2 - "Sure!" 10.0.0.2 - *oh, that's me* 10.0.0.2 - "Here's the reply 127.0.0.1 (I) gave, 10.0.0.2" 10.0.0.1 - "Thanks!"
I'm not sure if that makes sense, or is possible at all, but if so that would probably be a pretty big security hole for machines running local-only services and forwarding other machines' traffic.