Hello guys.
Is there a way to forward petitions to one box to another to make use of its public ip in certain ports.
I want to public my svn repository (located in a LAN network) to checkout, commit or update from remote places but I can’t get a public ip and I only have access to an opensuse 10.3 with the public ip that I need. In normal cases port forwarding in the router configuration will solve my issue but this time is harder >:( .
Yes, SSH can definitely do this. I saw a very good tutorial from Red Hat that walks through common setups. (Applies to openSUSE as well.) They also posed a follow-up article that is equally helpful.
I finally give up trying to ‘ssh tunneling’ and I come here to ask for help again.
Apparently I can’t make double forward inside my LAN.
SVN is in A (LAN),
Public IP is in B (LAN),
Final Target (remote PC) is in C (WAN, Internet).
I forwarded port 3690 (SVN port) of B to 3690 of A.
In B
ssh -L 3690:A_IP:3690 root@A_IP
After this I am able to do in B:
svn ls svn://localhost
till this point everything works fine.
Then I tried the following:
In C:
ssh -L 3690:B_IP:3690 root@B_IP
And when I run (always in C):
svn ls svn://localhost
I get:
svn: Connection closed unexpectedly
And in STDOUT of B ssh prints:
channel 3: open failed: connect failed: Connection refused
I also tried:
In B:
ssh -R 3690:C_IP:3690 root@C_IP
but I get just the same error message
svn: Connection closed unexpectedly
If there is no svn port open and listening this should be the error message:
svn: Can't connect to host 'localhost': Connection refused
So I don’t know what is wrong. Maybe port was opened but svn of A is not responding or refuses forwarded connections. I don’t know, I’m just guessing.
In C (with the configuration before “I also tried…”) try
ssh -L 3690:localhost:3690 root@B_IP
My guess: When SSH forwards a port, by default, it only allows local connections to that port. By using B_IP instead of localhost you are using the public interface and the connection is refused. Thats why you could access “svn://localhost” but cannot access “svn://B_IP”.
Disclaimer: This guess is based on the weather conditions in Portugal and the particular taste of this morning’s coffee so it may be off.