SSH Double Tunnels

2007.12.15 15:07

I’m definitely late to the party on this one, but I found it interesting.

I needed to talk to port 8080 on a box named prod. But the port was only exposed locally, and I could only get to prod from another box named dev. I have accounts on both.

For this example, prod’s IP address is 1.2.3.4.

In my .ssh/config

Host dev
  LocalForward 50522 1.2.3.4:22

Host prod
  Host localhost
  Port 50522
  LocalForward 50588 localhost:8080

So, after I ssh to both dev and prod (using ssh -fN if I don’t need active shells), I can bring up http://localhost:50588 in a browser.

I’m into it.

1 comment

Try ‘ProxyCommand “ssh dev netcat 1.2.3.4:22″‘ in prod (not sure about the exact netcat spell, though).

Comments? (moderated as hell)

allowed HTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>