<>mac-ProxyCommand 代理

内网进不去,但是想看生产的内容怎么办

前提是要有一台本地能ssh的机器 这台机器要和内网打通

在本地
ssh-keygen -t rsa
到跳板机
vim .ssh/authorized_keys 添加本地的public key
去跳板机做跳板的用户目录 例如root
ssh-keygen -t rsa
然后在跳板机ssh root@1x.9x.1x.2x。输入密码登录下

<>安装ProxyCommand

brew install proxychains-ng

<>配置
在~/.ssh/config 添加 Host dxx.sxx-bastion hostname 54.65.xx.2xx Port 18330 User
ec2-user Host dxx.sxx-web1 hostname 10.0.x.xx ProxyCommand ssh dxx.sxx-bastion
-W %h:%p User ubuntu 例如 # jd_test Host one-machine //要叫的名字 HostName 1x.9x.1x.2x
//服务器地址 # 1x.9x.1x.2x对应的email或者用户名 User root //用户 #PreferredAuthentications
publickey # 1x.9x.1x.2x对应的私钥 IdentityFile ~/.ssh/id_rsa //跳板机的私钥 ForwardAgent
yes Host 161-machine //最终代理到的机器 HostName 17x.2x.1x.1x User zhangsan
//登录这台机器的用户名 Port 22 ProxyCommand ssh -q -W %h:%p noah-machine
ps:
%h 表示 hostname
%p 表示 port

主备好上面 在本地mac配置
vim /etc/hosts 1x.9x.1x.2x one-machine 17x.2x.1x.1x 161-machine
然后节能直接登陆了。在本地

因为跳板机家了publickey 不用密码就能登陆 在登陆目标机器直接输入密码就可以了

技术
今日推荐
PPT
阅读数 128
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信