- sshconf配置如下:
Host f4
Hostname 172.17.0.16
Port 8022
Host f4 sysops
ProxyCommand ssh root@509 -W %h:%p
ssh f4
发现登录到了gitlab服务器[tomcat@f4 ~]$ sudo netstat -anotlp|grep -i listen
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 5523/nginx: worker off (0.00/0/0)
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 17187/ssh off (0.00/0/0)
tcp 0 0 172.17.0.16:8022 0.0.0.0:* LISTEN 12596/sshd off (0.00/0/0)
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 5523/nginx: worker off (0.00/0/0)
tcp6 0 0 :::22 :::* LISTEN 17187/ssh off (0.00/0/0)
发现ssh端口被转发了。
- 原来22端口被转发到了gitlab,f4的ssh服务在8022端口。于是启用上面的#Port 8022,可以直接登录f4了。
服务器账号信息参见 account_final 文件