打开~/.ssh/config文件,如果没有则新建一个
输入以下内容并保存:
Host dxx.sxx-bastion # jumpserver name
hostname 54.65.xx.2xx # jumpserver ip
Port 18330 # jumpserver port
User ec2-user # jumpserver user name
Host dxx.sxx-web1 # target server name
hostname 10.0.x.xx # target server ip
ProxyCommand ssh dxx.sxx-bastion -W %h:%p # ProxyCommand
User ubuntu # user name
在你本地完成上述配置以后,就可以在本机通过ssh命令直连到dxx.sxx-web1机器了(不用先登录到jumpsever然后再连接target server了)
ssh -u ubuntu@10.0.x.xx