For a comprehensive guide to ssh tunneling please check out Using SSH Tunneling.
$ ssh <username>@riviera.nuigalway.ie -L 3022:proxy.nuigalway.ie:8080
Reverse tunnels can also be created. These tunnels allow you to use a port on a remote machine and have it redirected back your local machine.
For example:
Johnny is in his student accomodation and has created a webpage for his group project. Johnny decides he wants to show his buddy Jimmy the website he's made but can't redirect port 80 on his gateway. Both Johnny and Jimmy are members of their local CompSoc which run an SSH server.
Johhny can use a reverse tunnel to let Jimmy view his website via their CompSoc server.
Johnny used the following code:
$ ssh username@domain.com -NR REMOTEPORT:localhost:LOCALPORT -v
Jimmy used the following tunnel to redirect his traffic from local port 8080 through Johhny's reverse tunnel:
$ ssh username@domain.com -N -L REMOTEPORT:localhost:8080 -v
Now all Jimmy needs to do is enter http://localhost:8080 into his web browser and he'll be redirected to the web server running on Johhny's laptop.
Of course the same can be used for VNC, FTP, SFTP and all other TCP protocols.