Latest LQ Deal: Linux Power User Bundle
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 10-26-2009, 09:42 PM   #1
LQ Newbie
Registered: Aug 2009
Location: Guildford
Distribution: Ubuntu Jaunty
Posts: 12

Rep: Reputation: 0
Reverse Tunneling / Reverse port forwarding in SSH

I want to know how to do reverse port forwarding or reverse tunneling using SSH.
Reason: I have set up VNC server in my lab system (labby) and want to work on that, from hostel, using my laptop (noty). Needless to say the labby is behind firewall (131.x.y.z).

I have set up a VNC viewer in my noty to work on labby through VNC. I can establish a SSH connection to my Lab using this tunnel forwarding method.

# ssh -L 5900:labby:22 131.x.y.z -l user_name_in_labby
Then in another new terminal
# ssh -Y -p 5900 -l user_name_in_labby

The first command is to set up a local host in labby and second command is to connect to that using my noty's port 22 (please correct me if I am wrong, I am a mechanical engineer)

But now I want to do reverse tunneling. I searched several tips from google and failed to find the answer to the case I wanted.
Please refer the attachment to see the network diagram (vnc_rpf.png

What I want is reverse port forwarding from labby and listening in noty.
Means my noty should listen to labby using a ssh command in my noty.

Attached Thumbnails
Click image for larger version

Name:	vnc_rpf.png
Views:	33
Size:	55.4 KB
ID:	1812  
Old 10-27-2009, 10:59 AM   #2
Senior Member
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,448

Rep: Reputation: 1359Reputation: 1359Reputation: 1359Reputation: 1359Reputation: 1359Reputation: 1359Reputation: 1359Reputation: 1359Reputation: 1359Reputation: 1359
To achieve your goal, I think that you should consider using FreeNX with a reverse SSH tunnel.
This link is for FreeNX (note the Enable reverse connections under Advanced topics).
This link is what I used to set up the reverse SSH tunnel that I use. It contains a script that can be run as a cron job to bring up the tunnel at specified times. You may want to adapt the script for your needs.
Old 10-27-2009, 03:03 PM   #3
LQ Newbie
Registered: Aug 2009
Location: Guildford
Distribution: Ubuntu Jaunty
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you very much.
I will try this.
Old 11-23-2009, 11:31 AM   #4
LQ Newbie
Registered: Feb 2005
Posts: 2

Rep: Reputation: 0
I don't know if I follow your setup 100% because I am here looking for details on something a little different. But, I will explain how I would get vnc to work the way I think you're looking to do.

On the machine behind the firewall, start an ssh tunnel outbound to your home computer with a command something like this:

ssh -R -p 5900 -l user_name_in_labby

-R is setting up a reverse port, when you access localhost:5900 in vnc in your home computer, it will go backwards through the tunnel you started from labby and access labby's port 5900. I home this is atleast something you're looking for.

Now if I could just figure out how to get a port being forwarded to a computer to get sent through the reverse port tunnel I would be in good shape :/


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
ssh tutorial, for reverse tunneling for vinagre & sftp manwithaplan Linux - Networking 1 11-02-2009 10:52 PM
Reverse,Port Forwarding via SSH and connecting from two different location metallica1973 Linux - Networking 2 12-20-2008 05:42 PM
LXer: Reverse SSH Tunneling LXer Syndicated Linux News 0 09-19-2008 03:21 PM
SSH tunneling/port forwarding cougem Linux - Networking 1 06-30-2006 07:06 AM

All times are GMT -5. The time now is 07:51 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