LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-19-2010, 06:05 PM   #1
tboyer
LQ Newbie
 
Registered: Dec 2009
Distribution: RHEL
Posts: 16

Rep: Reputation: 1
Not the usual ssh tunneling thread


OK, I've beaten my head against the wall on this one for a few days, and decided it's just not possible to do - but I'll toss it up here just in case I'm missing something obvious.

I've got two servers that I want to sync, but there are a couple of very robust firewalls between them. Normally, I'd jut tunnel - but there are also some directionality restrictions. Like so:


A <--- B <--- C ---> D --> E


I need to get data from A to E. C can ssh to B and D, but B and D can't ssh to C. B can ssh to A, but A can't ssh to B; D can get to E, but E can't get to D.

So to get from C to A or C to E is relatively easy - reverse tunnels. But I don't see any possible way of getting from A to E. If the connection went all in one direction, I'd just set up four tunnels. But this way, data gets to C and I don't see any way of getting it out of there.

Suggestions, alternatives, and RTFM references appreciated...

-- tim --
 
Old 07-19-2010, 11:21 PM   #2
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 488

Rep: Reputation: 78
I actually do this quite often, but it is not necessarily "trivial". ;-)

Code:
# Open a local forward from C to A through B
me@C ~]$  ssh -L1234:IP-of-A:22 IP-of-B

# Connect to A from C through the local tunnel and \
configure a reverse forward to D
me@C ~]$  ssh -R4321:IP-of-D:22 -p 1234 localhost

# Connect from A to D through the 2nd tunnel and \
configure a local forward to E
me@A ~]$  ssh -L2222:IP-of-E:22 -p 4321 localhost

# Connect from A to E through the local forward on A
me@A ~]$  ssh -p 2222 localhost
I think that should do it. I am not in a position to confirm with my use and once I got it working I heavily leveraged ~/.ssh/config so I do not have to remember it all so meticulously. Also, you can "piggy-back" the SSH connections without actually have to use a shell, but should save that for after you get it working this way. You will need multiple shells; I use screen when I need to do something like this until I get it all worked out and more automated.

Once you are able to successfully ssh from A to E using the various tunnels/directions, you can pretty much shove whatever you want through it using rsync, scp, sftp, sshfs, tar, np, ... it really is up to you at that point.

 
Old 07-20-2010, 05:23 AM   #3
tboyer
LQ Newbie
 
Registered: Dec 2009
Distribution: RHEL
Posts: 16

Original Poster
Rep: Reputation: 1
That makes my head hurt, and looks like exactly what I need. You've figured out what was stumping me - everything I was doing had C going in two directions at once.

Thanks VERY much - can't wait to try it out!
 
  


Reply



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
help with ssh tunneling rafa_gallego Linux - Networking 1 01-22-2008 10:45 AM
Tunneling with ssh ssherman Linux - Networking 3 07-16-2007 02:13 AM
cannot ssh forward with the usual settings kpachopoulos Linux - Software 1 09-15-2006 10:54 AM
X tunneling with SSH phekno Linux - Networking 3 05-31-2005 10:43 AM
SSH tunneling X AzZuM Linux - Security 3 11-27-2004 01:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:39 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration