Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
Distribution: Red Hat Enterprise Linux, Fedora, CentOS
Posts: 134
Rep:
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.
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
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.
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.
Distribution: Red Hat Enterprise Linux, Fedora, CentOS
Posts: 134
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.