Sometimes I feel like I know what I’m doing, other times I realize what a noob I still am. Case in point: ssh tunnelling. Why haven’t I fallen in love with this before?

Tunnelling out of a heavily-firewalled network across the interwebs to a box on an internal lan through a public ssh-accessible box is absolutely trivial. OK, that sounded complicated, but it’s just what I need! An example is in order:

# Make sure this works from a machine inside the heavily-firewalled network
# Ask your IT department to open port 22 if needed, or you can go through a proxy on an open port
ssh me@mypublicmachine.com

# Now let's redo it, but add a tunnel from a local port to a port on a machine on the LAN side of the public box
ssh -L 8000:box_on_lan_side:80 me@mypublicmachine.com

# Now you can browse to the apache server on box_on_lan_side from within the firewalled network
firefox http://localhost:8000

Whee!

Leave a Reply