1,服务器A
# cat /etc/issue
Debian GNU/Linux 9 \n \l
vim /etc/ssh/sshd_config
#GatewayPorts no
GatewayPorts yes
/etc/init.d/ssh restart
2,公司内网B
╰─➤ cat /etc/issue 130 ↵
Kali GNU/Linux Rolling \n \l
apt install -y autossh
- 公司内网B 配置免密钥ssh登陆 服务器A
autossh -M 34567 -NfR 0.0.0.0:22101:localhost:22 root@公网ip
3,家里电脑测试
ssh -p 22101 root@公网ip
参考: