I have an SSH tunnel defined in
/etc/ssh/ssh_config. It contains:
LocalForward 0.0.0.0:8000 some-service:80 LocalForward 0.0.0.0:8001 some-other-service:80
I would still like to be able to access the tunnels via their original DNS names (e.g.
curl some-service should still work, rather than having to use
In an attempt to do this I added the following to my
127.0.0.2 some-service 127.0.0.3 some-other-service
Now, I think, I need some
iptables commands which will do the following:
When I see a request to 127.0.0.2:80 I should proxy it to 127.0.0.1:8000 When I see a request to 127.0.0.3:80 I should proxy it to 127.0.0.0:8001
curl some-service would resolve to
/etc/hosts, which would in turn be proxied to
iptables), which in turn hit
some-service:80 (via the ssh tunnel)
Question: I feel like there should be an easier way to achieve this? If not, what would the
iptables commands look like?