LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 05-09-2019, 04:06 AM   #1
jiteshpandey
Member
 
Registered: Oct 2017
Posts: 58

Rep: Reputation: Disabled
Ssh connection with proxy computer


My main system is connected locally through lan with other computer where I place backup files, while my laptop and main are having connection with each other through wifi hotspot. I have various files to copy to and fro from one system to other (as and when needed) which is on backup computer. To reach to backup computer I have ssh to main computer and then to backup computer and then to the file I want which consumes lot of time. I want to directly reach to the backup computer from my laptop. I have attached the file to explain my scenario. Thank You
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2019-05-09 12-15-55.png
Views:	20
Size:	14.3 KB
ID:	30529  
 
Old 05-09-2019, 05:05 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,310
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
It's not clear which one in your description is A, B, or C in the diagram. However, if you can SSH from B to C then you can also SSH from A to C via B. Recent versions of the OpenSSH client support the ProxyJump (-J) option.

Code:
ssh -J userB@B userC@C
See "man ssh" and scroll down to ProxyJump for the details. If you have a really old version, then there are other methods but upgrading would be best.
 
Old 05-09-2019, 05:18 AM   #3
jiteshpandey
Member
 
Registered: Oct 2017
Posts: 58

Original Poster
Rep: Reputation: Disabled
The main system is B, the backup system is C and the third system which is laptop is system C. Further I would like to do it using ip forwarding as ssh -j option is not available.
 
Old 05-09-2019, 05:32 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,310
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
If you would like to forward packets, then look to iptables and I'll leave that for someone else here.

However, the quick way with SSH would be to use the ProxyCommand option if you cannot upgrade your instance of the OpenSSH client:

Code:
ssh -o ProxyCommand='ssh -W %h:%p userB@B' userC@C
The ssh -W %h:%p part is verbatim. Again, see "man ssh" but this time scroll down to the paragraph on ProxyCommand.

Once you have that worked out it can be added to the client's configuration file so it happens automatically for that one host.
 
Old 05-09-2019, 05:50 AM   #5
jiteshpandey
Member
 
Registered: Oct 2017
Posts: 58

Original Poster
Rep: Reputation: Disabled
That's good @Turbocapitalist but can I ping with this command, forgive if it's out of topic.
 
Old 05-09-2019, 05:53 AM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,310
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
You won't be able to ping C from A no matter what. If you looking for a way to check on C from A you can still use SSH, though there is a bit of overhead. It'd be better to ping C directly from B and then have a way to report to or from A.
 
Old 05-09-2019, 06:38 AM   #7
jiteshpandey
Member
 
Registered: Oct 2017
Posts: 58

Original Poster
Rep: Reputation: Disabled
But I can ping and ssh from C to A directly but not from other side, that is what killing me.

Last edited by jiteshpandey; 05-09-2019 at 06:43 AM.
 
Old 05-09-2019, 06:46 AM   #8
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,310
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
Then you appear to have some routing set up already on B. Check the output from iptables-save on B and pay attention to each of the tables, especially if there is a nat table active or if the FORWARD chain is in use in the main table. However, others will have more experience with iptables and can provide better pointers.
 
  


Reply

Tags
ssh



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
Opening a proxy via SSH behind NAT (router), with a middle man (Server ) to broker the connection between clients and proxy providers. ChronicUser Linux - Server 3 02-16-2017 07:31 AM
configure squid proxy with cc proxy as a parent proxy faisi Linux - Networking 1 08-10-2010 01:16 PM
Forwarding all traffic to the proxy to another proxy (transparent proxy/redirection) lakshithaww Linux - Networking 1 10-28-2009 12:54 AM
configure squid proxy with microsoft proxy as a parent proxy nintykola Linux - Software 1 08-28-2007 01:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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