Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 11-09-2009, 06:33 AM   #1
Registered: Sep 2007
Location: In My Box
Distribution: Arch Linux
Posts: 366

Rep: Reputation: 31
SSH chain tunneling


Lets say i have ssh access into 3 servers (A, B, C).

I am the PC. Now how i can do a connection like this :

PC --> A --> B --> C through ssh connection?

So i can browse to the internet with the server's C ip.

Old 11-09-2009, 07:10 AM   #2
Senior Member
Registered: Dec 2005
Distribution: Slackware -current, 14.1
Posts: 1,066

Rep: Reputation: 184Reputation: 184
I'm thinking someone may have a more elegant solution, but you can do it thusly:

B --> C :

ssh -D <choose_port> C

A --> B

ssh -N -f -L <port>:localhost:<port> B

PC --> A

ssh -N -f -L <port>:localhost:<port> A

Set up a SOCKS proxy on PC to localhost:<port>


Last edited by mrclisdue; 11-09-2009 at 07:38 AM. Reason: clarification
Old 11-09-2009, 08:43 AM   #3
Registered: Sep 2009
Distribution: Slackware
Posts: 39

Rep: Reputation: 16

Thanks to your question - i felt motivated to read the entire ssh man page. it seems ssh is quite powerful and i am now looking forward to trying some things out.


Thanks also for your simple explanation.
Old 11-14-2009, 01:58 PM   #4
Registered: Oct 2009
Distribution: Slackware 13.0
Posts: 49

Rep: Reputation: 15
Hi there I have just found this thread after posting a similar one, (oops!) and was wondering if someone could explain how I would do this via putty, and with a PC and machine A and B? Machine B, being the server thats hosting the pages I want to view.


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH tunneling entz Linux - Networking 3 04-04-2007 08:22 AM
tunneling thru ssh c9876543210 Linux - Networking 1 07-21-2005 01:45 AM
X tunneling with SSH phekno Linux - Networking 3 05-31-2005 11:43 AM
Tunneling through SSH rech Slackware 1 11-28-2003 09:21 PM
tunneling with ssh barbanero Linux - Security 2 01-24-2002 11:53 AM

All times are GMT -5. The time now is 09:17 PM.

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