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 11-14-2013, 06:32 AM   #1
Gamma_User
LQ Newbie
 
Registered: Jan 2009
Location: Brazil, Curitiba
Distribution: Debian
Posts: 19

Rep: Reputation: 0
How can I overcome a firewall by ssh tunneling?


Let me explain. Using a laptop, I can access a remote cluster user@xxx.xx.xx.xx from anywhere. Once I have accessed this cluster, I can access another one using another_user@yyy.yy.yy.yy. But I cannot directly access the second cluster from my laptop, because it has a firewall that blocks non registered IP's. So, how can I overcome the firewall by ssh tunneling? I googled it, but I did not find a solution.
 
Old 11-14-2013, 07:01 AM   #2
voleg
Member
 
Registered: Oct 2013
Distribution: RedHat CentOS Fedora SuSE
Posts: 354

Rep: Reputation: 51
Connect and open tunnel listening on localhost (laptop) port 2222 :
Code:
$ ssh -L 2222:y.y.y.y:22 user@x.x.x.x
Then in other session, connect to y.y.y.y server (that is localhost:2222 now):
Code:
$ ssh -p 2222 another_user@localhost
 
1 members found this post helpful.
Old 11-14-2013, 08:30 AM   #3
ericson007
Member
 
Registered: Sep 2004
Location: Japan
Distribution: CentOS 7.1
Posts: 735

Rep: Reputation: 154Reputation: 154
As voleg mentioned is still a 2 step process. What you want I do not believe is doable without using 2 steps, unless the firewall permissions are changed. Seeing it is a cluster, there might be data worth protecting, so two step offer better security.

My personal setup is vpn onto lan and then ssh with private keys that are password protected into systems. Really does not take that much longer to do.
 
1 members found this post helpful.
Old 11-14-2013, 08:46 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
There is ssh's ProxyCommand that might be of use.

Scenario:
Code:
+--------+      +--------------------+      +--------------------+
| laptop | ---> | stepping.stone.com | ---> | target.machine.com |
+--------+      +--------------------+      +--------------------+
Add something like this in your ~/.ssh/config file on your laptop:
Code:
Host target.machine.com  target
  User          user
  HostName      target.machine.com
  ProxyCommand  ssh another_user@stepping.stone.com nc %h %p 2> /dev/null
You should now be able to do ssh target or ssh target.machine.com

The above does assume that netcat/nc is installed on stepping.stone.com

- Stupid SSH Tricks: ProxyCommand
- SSH ProxyCommand

Last edited by druuna; 11-14-2013 at 09:53 AM. Reason: clarified place of ~/.ssh/config
 
1 members found this post helpful.
Old 11-14-2013, 12:24 PM   #5
Gamma_User
LQ Newbie
 
Registered: Jan 2009
Location: Brazil, Curitiba
Distribution: Debian
Posts: 19

Original Poster
Rep: Reputation: 0
I could not apply voleg solution because the firewall did not allow me, as ericson007 said. druuna's solution worked fine, however I need something more.

Based on druuna's scenario

+--------+ +--------------------+ +--------------------+
| laptop | ---> | stepping.stone.com | ---> | target.machine.com |
+--------+ +--------------------+ +--------------------+

I need to transfer data between my laptop and 'target.machine.com' using rsync or scp. Since I do not know how to do that directly, I have to transfer data to 'stepping.stone.com' and then to 'target.machine.com'. I have to do that many times a day, which is boring and time wasting. Does anyone know how to overcome this problem? Something like druuna's solution will be very appreciated.

Thanks for your attention!

---------- Post added 11-14-13 at 01:24 PM ----------

I could not apply voleg solution because the firewall did not allow me, as ericson007 said. druuna's solution worked fine, however I need something more.

Based on druuna's scenario

+--------+ +--------------------+ +--------------------+
| laptop | ---> | stepping.stone.com | ---> | target.machine.com |
+--------+ +--------------------+ +--------------------+

I need to transfer data between my laptop and 'target.machine.com' using rsync or scp. Since I do not know how to do that directly, I have to transfer data to 'stepping.stone.com' and then to 'target.machine.com'. I have to do that many times a day, which is boring and time wasting. Does anyone know how to overcome this problem? Something like druuna's solution will be very appreciated.

Thanks for your attention!
 
Old 11-15-2013, 06:19 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by Gamma_User View Post
I need to transfer data between my laptop and 'target.machine.com' using rsync or scp. Since I do not know how to do that directly, I have to transfer data to 'stepping.stone.com' and then to 'target.machine.com'. I have to do that many times a day, which is boring and time wasting. Does anyone know how to overcome this problem?
Maybe this link will help:

- Using rsync through a firewall (method's 2 and 3 might interest you)
 
1 members found this post helpful.
Old 11-16-2013, 08:31 AM   #7
Gamma_User
LQ Newbie
 
Registered: Jan 2009
Location: Brazil, Curitiba
Distribution: Debian
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by druuna View Post
Maybe this link will help:

- Using rsync through a firewall (method's 2 and 3 might interest you)
Simply perfect!!!

Thanks, Druuna!
 
  


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
ssh tunneling with a firewall genderbender Linux - Software 3 07-08-2012 06:17 AM
SSH Tunneling Through Coporate Firewall txraddoc Linux - Newbie 2 06-14-2012 06:06 PM
SSH tunneling: bypass (almost) any firewall easily michux Linux - Networking 1 08-23-2006 11:29 AM
Tunneling Through a Firewall Jubalint Linux - Networking 20 09-23-2005 06:47 PM

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

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