ssh remote forward 监听 0.0.0.0 端口;How to make SSH remote port forward that listens 0.0.0.0
简介今天使用ssh转发内网服务的时候,发现remote forward 转发到远程,监听的端口都是localhost。 之前还没发现这种情况,因为都是在所转发的目的主机使用服务。今天,我进行转发内网私有云
今天使用ssh转发内网服务的时候,发现remote forward 转发到远程,监听的端口都是localhost。
之前还没发现这种情况,因为都是在所转发的目的主机使用服务。今天,我进行转发内网私有云服务,到网关主机的时候,不管怎么设置都是监听localhost。
而我的需求是能够监听0.0.0.0地址,接收通过域名和ip的方式的访问。
通过查找网络,我很快发现了解决方案:
Enable GatewayPorts in sshd_config (by default it is disabled). Enabling it will instruct sshd to allow remote port forwardings to bind to a non-loopback address. AskUbuntu has a similar question about Reverse Port Tunneling that goes into more details.
主要思路是,修改sshd配置文件 的 GatewayPorts 为yes, 并重启sshd 服务即可。我想这应该是sshd默认的一种安全保护。
修改后,查看服务器端口号如下:
可见,修改生效。前面的*,表示当前接收所有目的ip的,相应端口的数据包;祝你使用愉快!
参考链接:
How to make SSH remote port forward that listens 0.0.0.0
文章来源:https://www.cnblogs.com/xuyaowen/archive/2021/10/10/ssh-remote-forward.html
Tags:
转载:感谢您对网站平台的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人站长或者朋友圈,但转载请说明文章出处“来源搜码吧-程序员大本营,技术文章内容聚合第一站”。ssh remote forward 监听 0.0.0.0 端口;How to make SSH remote port forward that listens 0.0.0.0--搜码吧-程序员大本营,技术文章内容聚合第一站