The ssh Tunnel of Love

by Edd Dumbill


I'm spending this week in San Diego, at O'Reilly's Open Source Convention.
Not being the sort of person who can afford to leave work at home, there's
plenty for me to do while I'm away. Happily, the hotel has ethernet Net access
(not to mention the wireless Net access available in the conference.)



As I lead an unnecessarily complicated life while I'm away I need to get
access to two separate networks: my home office, and a remote office of
another company. My best friend when travelling like this is href="http://www.openssh.com/">ssh (my wife, accompanying me, might
disagree with this statement). By far the most common use of ssh is as a
secure replacement for telnet, but when working remotely I find that setting
up tunnels with ssh makes my life much easier.



From home, I want access to my IMAP server, which is safely behind my
firewall. So I set up a ssh-tunnel to make my remote IMAP server appear in the
right place on my Linux laptop, and have my mailer configured to look at mail
on "localhost":



ssh -L 143:mailhost.org:143 edds-home-office.org



From the office, I need to look at a web server that runs on port 3000, so
I set up a tunnel to make that web server appear on port 3000 on my local
machine:



ssh -L 3000:mailhost:3000 remote-office.org



Easy -- so now I have resources from two remote firewalled networks
appearing on my machine here, and both over secure connections. A year ago
when travelling it was a bonus if I could even get a dial-up connection, now I
can barely tell the difference from my office back in England. Apart from the
glorious San Diego weather, that is.




Got other networking travelling tips? I'd be interested to hear.