码迷,mamicode.com
首页 > 其他好文 > 详细

AUTOSSH设置ssh隧道,实现反向代理访问内网主机

时间:2019-10-24 15:35:29      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:port   span   autossh   外网   sshd_conf   ssh   访问内网   str   SSH隧道   

内网主机上配置

autossh -M 5678 -CNR 1234:localhost:22 ubuntu@123.207.121.121

可以实现将访问主机123.207.121.121的1234端口的数据,通过隧道转发到内网主机的22端口。

外网主机上配置

/etc/ssh/sshd_config 加入 GatewayPorts yes

 sudo service sshd restart

在外网主机上测试

ssh floyd@localhost -p 1234

就可以访问到内网主机

AUTOSSH设置ssh隧道,实现反向代理访问内网主机

标签:port   span   autossh   外网   sshd_conf   ssh   访问内网   str   SSH隧道   

原文地址:https://www.cnblogs.com/rayfloyd/p/11732184.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!