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

Notices

Reply
 
LinkBack Search this Thread
Old 07-28-2005, 12:02 PM   #1
dussel
Member
 
Registered: Dec 2004
Distribution: SuSE 9.X, SuSE 10, SLES 9,RedHat, Feodora Gentoo, Solaris, and more
Posts: 50

Rep: Reputation: 15
Question Problem setup SSH tunnel over multiple servers


Hello all,

I hope someone can fast give me some help what I do wrong ;-)

What I want to do are to build a SHH tunnel from my localhost to server1 (that i no problem) and when I get the wnat I build a SSH tunnel to server2, and when there build SSH tunnel to server3.
And with another terminal be able to ssh to my localhost and be forwarded directly to server 3.

I can not build the tunnel in "one command", I must build my tunnel i several steps because of the the end address is an internal-address and Server1 does not know that internal-address.

What I have done so far is

ssh -g -L 5436:localhost:22 server1.publicnet.com -l user

that brings me to server1 (no problems), the I want to continue from server 1 to server 2

ssh -v -L 5436:server1.publicnet.com:22 server2.localnet -l user

and from server2 to server3

ssh -v -L 1984:server2.localnet:22 server3.othernet -l user

But now when I test connect to my localhost:5436 then I end up only on server1

ssh -p 5436 user@localhost

What do I wrong???

it is not authentication problem, I have set up "key-authentication" and it works without problem. I have added "ForwardAgent yes" in my $home/.ssh/config

Please help!
 
Old 07-28-2005, 12:45 PM   #2
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,506

Rep: Reputation: 116Reputation: 116
Well, I'm not sure if this will work, but here's my guess:
Code:
localhost $ ssh -L2222:server2:22 server1
localhost $ ssh -L2223:server3:22 -p2222 localhost
localhost $ ssh -p2223 locahost
That final statement should connect you to server3.
 
Old 07-28-2005, 05:54 PM   #3
dussel
Member
 
Registered: Dec 2004
Distribution: SuSE 9.X, SuSE 10, SLES 9,RedHat, Feodora Gentoo, Solaris, and more
Posts: 50

Original Poster
Rep: Reputation: 15
That does not work! but...

Thanks for your replay,

unfortunatly does it not work with your solution, but you helped me to gt one step closer to end-server. when I do SSH to my local port is stopping at server 2 now ;-)
Yeah, then I am half the way to my goal...

No, had to modify your suggestion a littel.
So now am I using as follow:

from Localhost ---> server1
test
ssh -v -L 5234:server2:22 server1.publicnet.com -l user
ssh -v -L 5235:ip-for-server3:22 server2.localnet -l user

taht brings me directly to server2 when I ssh to localport 5234.

But it is still one more step to get to my server3, and I am really confused because I the most radical and desperate solution to get my tird step to work without any success. for example:

ssh -A -p 5235 server3.othernet
ssh -L 5236:localhost:22 server3 -l user

None of above lets me to ssh localhost port and direct send me to server3

So, I am greatfull over more suggestions how it can be solved because I biggin to get really confused over it....
 
Old 07-28-2005, 09:38 PM   #4
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,506

Rep: Reputation: 116Reputation: 116
What happens when you try to ssh to port 5235?
 
Old 07-29-2005, 04:07 AM   #5
dussel
Member
 
Registered: Dec 2004
Distribution: SuSE 9.X, SuSE 10, SLES 9,RedHat, Feodora Gentoo, Solaris, and more
Posts: 50

Original Poster
Rep: Reputation: 15
It is not looking so good when I do it server2, I get...

ssh: connect to address 127.0.0.1 port 5235: Connection refused
 
Old 07-29-2005, 08:51 AM   #6
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,506

Rep: Reputation: 116Reputation: 116
And server2 does have access to server3 on ssh port?
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IPSec tunnel over multiple interfaces tylerl Linux - Networking 0 07-21-2005 05:07 PM
SSH tunnel problem jackster Linux - Security 1 02-16-2005 10:46 PM
How To guides to setup an SSH Tunnel and VPN, and Print Servers pfish Linux - Networking 1 10-29-2004 06:13 PM
Linking to multiple linux servers with SSH rwalkerphl Linux - Newbie 2 07-05-2004 12:37 PM
linking samba servers over tunnel rkatana Linux - Software 0 11-05-2003 02:37 PM


All times are GMT -5. The time now is 04:52 PM.

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