ssh -N -L 5904:127.0.0.1:5901 username@remoteserver
The above command forwards everything on localhost port 5904 to the port 5901 on remoteserver. This is what I use to connect to a VNC service on port 5901 on a remoteserver at my job from my home computer. Thus, at home, after establishing the above tunnel I can use a vncviewer as follows:vncviewer :4