LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 09-17-2008, 08:02 AM   #1
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Rep: Reputation: 30
Post ssh through another server


Hi
is it possible for me to ssh to a server through another server
reason is most of our servers are behind a load balancer and firewall
and they have private ip address so is it possible to ssh to a server using another server to relay the ssh request.
maybe use the server as a gateway

Last edited by mahmoud; 09-17-2008 at 08:04 AM.
 
Old 09-17-2008, 09:32 AM   #2
Linville79
Member
 
Registered: Nov 2006
Location: Indiana, U.S.A.
Distribution: Red Hat Enterprise Linux, Fedora, CentOS
Posts: 134

Rep: Reputation: 16
You can either SSH to the "gateway" machine and then from there SSH again to your destination machine, or, you can setup an SSH tunnel through your "gateway" machine if you don't want to manually perform two SSH commands.

Here's a link that will be helpful:

http://www.engadget.com/2006/03/21/h...etwork-access/
 
Old 09-17-2008, 10:23 AM   #3
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Original Poster
Rep: Reputation: 30
i dont think you understand what i want to do
there are 3 machines involved
a.Mine
b.server with public ip address and a private ip address
c.the server i want to ssh to but has a private ip address connected to a lan with server b.
and i dont want to ssh twice i want one ssh that will take me straight to c
 
Old 09-18-2008, 05:26 AM   #4
mamtasahai1
Member
 
Registered: Jan 2007
Location: India
Distribution: RHEL 5, Fedora 9, Solaris, FreeBSD
Posts: 52

Rep: Reputation: 15
u didn't mentioned that your machine is connected to which server "b" or "c". As i understand ur network - ur machine is "a", "b" is ur server and "c" is connected with "b". if u r connecting ur server "b" with ssh, redirect the ssh request to "c" with "dnat" of iptables.
 
Old 09-18-2008, 05:57 AM   #5
linuxgurusa
Member
 
Registered: Mar 2008
Location: Namibia, Swakopmund
Distribution: Redhat, Fedora, Centos, ClearOS, Mandrake
Posts: 151

Rep: Reputation: 29
Quote:
Originally Posted by mamtasahai1 View Post
u didn't mentioned that your machine is connected to which server "b" or "c". As i understand ur network - ur machine is "a", "b" is ur server and "c" is connected with "b". if u r connecting ur server "b" with ssh, redirect the ssh request to "c" with "dnat" of iptables.
Good idea ;-)
 
Old 09-18-2008, 10:06 AM   #6
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Original Poster
Rep: Reputation: 30
Hi
thanks for your reply but the wont the dnat forward all connections coming for my office ip address i am in my office LAN
 
Old 09-18-2008, 10:31 AM   #7
Linville79
Member
 
Registered: Nov 2006
Location: Indiana, U.S.A.
Distribution: Red Hat Enterprise Linux, Fedora, CentOS
Posts: 134

Rep: Reputation: 16
Quote:
a.Mine
b.server with public ip address and a private ip address
c.the server i want to ssh to but has a private ip address connected to a lan with server b.
and i dont want to ssh twice i want one ssh that will take me straight to c
I have a developer that lives 3 and a half hours from my server rack. He uses an SSH tunnel to do exactly what you are asking (actually, his is even more complex, but has the same basic parameters). His machine with his office's public IP address uses an SSH tunnel to a server in our DMZ (we specifically allow only that IP address access) with a public and private IP address (via firewall NAT) and then from that server hops in to an internal server that has no public IP address to do his development work.

Bottom line... an SSH tunnel is the proper way to accomplish what you're asking.
 
Old 09-19-2008, 03:42 AM   #8
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Original Poster
Rep: Reputation: 30
thanks but i have the idea of what to do but the problem is how do i do it
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using DSL and ssh / ssh-server to access the Windoze desktop GUI On2ndThought Linux - Server 4 11-16-2008 02:17 PM
ssh connection refused - trying to set up ssh server at home openSauce Linux - Server 10 10-18-2007 04:38 PM
kerberized ssh window client can't authenticate to kerberized Linux SSH server celeron Linux - Software 0 04-11-2007 05:36 AM
Passwordless SSH with SSH commercial server and open ssh cereal83 Linux - General 7 04-18-2006 12:34 PM
Unable to access my ssh server and ftp server from the Internet, but smtp works foxone Linux - Networking 1 05-28-2004 05:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:05 AM.

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