美文网首页
如何在家里访问公司内网主机 - ssh端口转发

如何在家里访问公司内网主机 - ssh端口转发

作者: 成松song | 来源:发表于2018-02-09 02:04 被阅读0次

参考1 http://blog.csdn.net/u012588561/article/details/70665197
参考2 https://www.ibm.com/developerworks/cn/linux/l-cn-sshforward/

前提:需要一台公网主机,比如阿里云服务器,假设ip为 47.93.53.267
在办公室主机执行如下命令,然后输入root密码即可
ssh -gfnNTR 7001:localhost:22 root@47.93.53.267 -o ServerAliveInterval=300
此时,公网主机会和办公室主机建立一个ssh加密通道,保持实时通信。

在公网主机中执行如下命令,之后输入用户密码,即可登录到办公室主机
ssh song@localhost -p 7002

任何主机先登录到公网主机,然后再在公网主机中登录办公室主机即可。

相关文章

网友评论

      本文标题:如何在家里访问公司内网主机 - ssh端口转发

      本文链接:https://www.haomeiwen.com/subject/jyoxtftx.html