How to create SSH tunneling for below scenario.
I have 3 machines..
A. Data Center A VM.
B. Machine at work (middle man).
C. Data Center C VM.
So I can SSH from B -> A and from B -> C, but not from A -> C and C->A.
Is there a way to setup an SSH tunnel, so that I can transfer the data from A(Data Center A) to C (Data Center C) using Machine B. I want to use rsync to transfer the data, please let me know after tunneling how can I use rsync?
In mentioned reply they have a access from A->B-> C. it is possible using that. In My question I have a access from B->A and B->C and I want to copy data from A->C
I found the solution, here are the details
The solution is divided in two parts:
Following command will create a tunnel between source and destination machine. To debug the connection, break this into two parts and add verbose status:
Run this command on Middle Machine [B. Machine at work (middle man)]
$ ssh -v -R 50000:(Ip address of Data Center C VM):22 (IP address of Data Center A VM) Example: ssh -v -R 50000:192.168.1.25:22 192.168.1.36
Note: To get this working you need to have ssh keys set up correctly between the two remote hosts [Data Center A VM (Source) and Data Center C VM (Destination)], with the private key on source machine and the public key on destination machine.
If 1st soltion works, then you'll get a shell access on Source machine (Data Center A VM). Now try the rsync command from Data Center A VM.
It is recommend to do this in a different terminal, so the verbose ssh info doesn't get mixed together with the rsync status information.
$ rsync -e "ssh -p 50000" -vuar /opt/source_path localhost:/opt/destination_path