Issue
I think this is a very strange way to use this, but I need it. the main use is to get machine C dynamic IP.
I have three Linux machine(let we call A, B, C), let assume A has IP 10.6.47.100(dynamic IP) B has IP 10.6.47.102(dynamic IP), 192.168.1.1(static IP) C has IP 10.6.47.104(dynamic IP), 192.168.1.2(static IP)
The condition is, my program is running on machine A,and I only know machine B IP(both dynamic and static IP).
I want use machine B domain 192.168.1.x to get machine C dynamic IP through "a" command line.
Which mean use machine A key in a command line, this command is ssh to B and tell B to ssh C and get info.
A and B use 10.6.47.xx domain communicate, B and C use 192.168.1.X domain communicate.
although I have tried ssh [email protected] 'ssh [email protected] 'ifconifg eth1'' , but it seems quote is a problem. and I have tried create a include ssh command's shell script to machine C, tell B to ssh to C and execute this script but still failed.
Is there any possible to ssh from another ssh node?
thanks for your help.
Solution
Sure, use ssh's tunnelling feature. Assuming you want to tunnel over port 10022 (any port number is okay as long as it's not used on your local machine, and it's 1024 or greater):
ssh -L10022:192.168.1.2:22 [email protected]
ssh -p10022 [email protected]
These two commands must be run in separate sessions (both from machine A), since the first connection must remain active in order for the second one to work.
Answered By - C. K. Young Answer Checked By - Gilberto Lyons (WPSolving Admin)