A.local -> B.local (jumpbox) -> C.local
To do this, please follow below steps:
Host B.local
DynamicForward localhost:1080
Host C.local
ProxyCommand /usr/bin/nc -x localhost:1080 %h %p
[A.local]$ ssh -D 1080 aladdin@B.local
Open another terminal, and run ssh as if you have direct connection to C.local
[A.local]$ ssh aladdin@C.local
Voila, your ssh session will go through as if you have direct connection to C.local.
If you just doesn't want to put it into your config, you can use it on the fly by using below command after you have initiate the socks proxy:
[A.local]$ ssh -o "ProxyCommand /usr/bin/nc -x localhost:1080 %h %p" aladdin@C.local
Or you can also put it as alias for easy usage:
[A.local]$ alias alias proxyssh='ssh -o "ProxyCommand /usr/bin/nc -x localhost:1080 %h %p"'
This is cool!
ReplyDelete