Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 12-18-2006, 05:03 PM   #1
LQ Newbie
Registered: Jan 2006
Posts: 6

Rep: Reputation: 0
Reverse SSH tunnel active only from localhost

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:


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?
Old 12-18-2006, 05:22 PM   #2
Senior Member
Registered: Sep 2005
Location: Russia
Distribution: NixOS (
Posts: 1,899

Rep: Reputation: 68
man ssh


Especially -g - allow connections from everywhere.
Old 12-19-2006, 02:05 AM   #3
LQ Newbie
Registered: Mar 2006
Posts: 8

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PPTP Reverse(synchronous) Tunnel otisthegbs Linux - Networking 2 09-13-2006 07:07 PM
SSH reverse tunnel (lo only? why not eth0) Dinomight Linux - Networking 3 08-17-2006 09:44 PM
ssh + pop3 with kmail: Could not connect to host localhost, but ok without ssh Emmanuel_uk Linux - Networking 0 07-20-2006 04:56 PM
djbdns -- Can't reverse localhost on OpenBSD -- please help me b:z *BSD 1 06-12-2005 09:58 AM
Reverse SSH Tunnel sniggleflop Linux - Security 1 10-13-2002 01:24 PM

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration