LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Reverse SSH tunnel active only from localhost (https://www.linuxquestions.org/questions/linux-networking-3/reverse-ssh-tunnel-active-only-from-localhost-511724/)

andreag 12-18-2006 06:03 PM

Reverse SSH tunnel active only from localhost
 
hi.
I'm finding a little difficult to set up a remote tunnel.
the situation is this: I am running a webserver but my ISP uses NAT and I can't connect to it when I'm not at home.
since I have another working linux box with public static IP I figured a reverse tunnel on port 80 would solve all my troubles.
the situation looks like this:

MYWEBSERVER<-->ISP[NAT]<--WWW-->MYLINUXBOX

so I googled a little and found this way to set up a tunnel (the ssh command was run from the MYWEBSERVER shell, hence the 'localhost'):

ssh -nNT -R 80:localhost:80 root@MYLINUXBOX

seems all fine (no error messages) but when I type MYLINUXBOX's address into the web browser all I get is a 'connection refused' message.
BUT (and here is the big mystery) if I open an ssh shell on MYLINUXBOX and type 'lynx localhost' , I can see MYWEBSERVER's website!
btw, before anybody asks, iptables is not installed.

what could be the problem?

raskin 12-18-2006 06:22 PM

man ssh

Carefully.

Especially -g - allow connections from everywhere.

asgozzi 12-19-2006 03:05 AM

hey thanks for the immediate answer.
btw I also had to add to 'sshd_config' the 'GatewayPorts yes' option.
now works flawlessly!


All times are GMT -5. The time now is 12:53 AM.