Ssh port forwarding from remote location to computers on server’s network


I've been hunting all over the inter webs and I cannot find a simple example of the form of port forwarding that I am looking for. Well, the truth is, I may have just simply not understood the jargon used and then overlooked a valid solution.

Here is the proposed setup. I have a computer at home (homeC) and I typically connect to a server at work (, but whenever I connect to the server, I am generally (90%+ of the time) simply hopping over to another computer on the network (localC 192.168.x.y). I would love to setup to port forward over to the other local computers ip addresses if I use a non-standard port (e.g. 12345).

Assume all computers involved are running some variant to unix, but that the user only has root access on some computers (not In fact, the username user is the same on all computers. I am trying to find ways to solve the following problems:

  1. a command to use in which will forward a port to a given local computer (I also need to know which ports are available, I suppose)
  2. the command to run on homeC to connect to localC

On a side note, it would be interesting if it were possible to limit the mac-addresses of computers that can connect to because I see this as greatly increasing my security.

If you have any other ideas or useful suggestions, I would greatly appreciate them.

Best Answer

Tunneling would be the appropriate term if you are connecting with SSH.

putty.exe -ssh username@publicip -pw password -L localport:privateip:destinationport

so as an example, if I were to tunnel through SSH to port 80 on a computer with address behind a public IP address of, on which the SSH server resides, I would do the following:

putty.exe -ssh -pw password -L 8080:

I could then open up a web browser to and up would pop whatever is being served on port 80 on the remote machine.

Related Question