1、nc命令安装

dnf install nc -y

2、通过socks 5代理连接服务器(10.10.10.30为代理服务器)

ssh -o ProxyCommand="nc -X 5 -x 10.10.10.30:1080 %h %p" root@100.100.100.30

3、通过https代理连接服务器

ssh -o ProxyCommand="nc -X connect -x 10.10.10.30:8888 %h %p" root@100.100.100.30

4、通过http代理连接服务器

1、Corkscrew安装
参考:https://github.com/bryanpkc/corkscrew

2、代理连接服务器
ssh -o ProxyCommand="/usr/local/bin/corkscrew 10.10.10.30 8080 %h %p" root@100.100.100.30

5、使用ssh config

# vim ~/.ssh/config
Host db
    HostName 100.100.100.30
    User root
    ProxyCommand nc -X connect -x 10.10.10.30:1080 %h %p

Host web
    HostName 100.100.100.40
    User root
    ProxyCommand nc -X connect -x 10.10.10.30:8888 %h %p

Host cache
    HostName 100.100.100.50
    User root
    ProxyCommand /usr/local/bin/corkscrew 10.10.10.30:8080 %h %p

  

posted on 2023-02-16 11:51  a120608yby  阅读(548)  评论(0编辑  收藏  举报