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.
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:
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
)
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.