View Full Version : [ubuntu] Port forwarding

April 11th, 2009, 09:23 AM

The problem is as follows: I have three computers with external IPs: A - a1.a2.a3.a4, B - b1.b2.b3.b4, C - c1.c2.c3.c4. I want to forward port X on B machine in order to have the following scheme:

A tries to connect B (for example A: ssh -p X B), B forwards connection to C (if A tries to connect on port X then forward it to C on port X), so finally typing on A "ssh -p X B" we will get to C.

This I need for the software license forwading, I gave the ssh as an example.

Thank you very much in advance.


April 13th, 2009, 12:45 AM
Here (https://help.ubuntu.com/community/IptablesHowTo) is a help page on IPTables (which includes info on port forwarding). Hope it helps...

April 13th, 2009, 02:08 AM
This is very simple to do via ssh. All you need to do is run this from computer A

ssh -L LocalPortNumber:c1.c2.c3.c4:RemotePortNumber user@b1.b2.b3.b4

That's all there is to it!

Then all connections from LocalPort will be sent to computer C to the remote port number. No other configuration is necessary.