Overview

Port forwarding allows you to forward a specific port from a remote server to your local computer. This is useful for working with some applications that present streams of information or communicate over a port.

Do not use port forwarding for graphics windows or programs with graphical user interfaces. Due to the ease of use and excellent performance of the SCC OnDemand system’s Desktop session, we recommended its use for these purposes.

When forwarding a network port you need to choose a local port number and the port number on the remote system. Typically the remote port number is set by the remote program that you’re connecting to.  For example, the remote program could use port 5904 as shown here.  The local port number is one that you pick. Most of the time any reasonable number greater than 1024 will work – if the port forwarding command tries to use a local port already in use by a running program it will fail with an error message. In these examples a local port value of 7070 is chosen. A local program you run that tries to communicate over local port 7070 will have its network communication forwarded to the remote program listening on port 5904.

Select your operating system below for tailored instructions.

Select your operating system




Windows

Port forwarding on Windows can be accomplished with numerous applications. This section will focus on the MobaXterm application, which was also used in the SSH and FTP guides. Other software options are listed below.

X-Forwarding Clients

Port Forwarding using MobaXterm

  • MobaXterm provides a Linux-like command window, where you can execute the port forwarding command:Command-line interface displaying port forwarding command options using MobaXterm on a black background with blue and yellow text.

Apple OS X

Port forwarding is built into the ssh utility on Apple computers and is implemented with the “-L” option.

localhost $ ssh -L 7070:localhost:5904 username@scc1.bu.edu

For more details and advanced configurations, please consult the ssh manual page ( man ssh ) or contact us for assistance.

Linux

Port forwarding is built into the ssh utility for the Linux operating system and is implemented with the “-L” option.

localhost $ ssh -L 7070:localhost:5904 username@scc1.bu.edu

For more details and advanced configurations, please consult the ssh manual page ( man ssh ) or contact us for assistance.