SSH Double Hop and Google Chat

Date November 29, 2007 by Isaac

I work at a place that blocks most outgoing ports, including Google Chat (port 5222). While I don't use chat much at work it is nice for me and my wife to communicate short messages quickly. Of course I've never let a little thing like a firewall stop me, so I figured a way around this restriction.

Here's how it works: Port 5222 of my work machine is forwarded through my home machine. My home machine then bounces the connection to port 5222 on the Google chat server.

Here's the command to accomplish the double hop:

ssh -L 5222:talk.google.com:5222 my.home.computer -N -f

The command line is slightly confusing at first, but here is a breakdown of what that does:

  • -L 5222:talk.google.com:5222 -- This says to connect local port 5222 (the first 5222) to port 5222 (the 2nd 5222) on talk.google.com
  • my.home.computer -- This is the server to bounce the connection through
  • -N -- Do not start a remote shell
  • -f -- Fork the process into the background

The effect of the -N and -f together is that this command will establish the tunnel, then fork into the background. It will appear as if the command did nothing, since there is not output. In reality it will have become a background process.

Good luck and happy firewall smashing. :)

Comments are closed.