zoukankan      html  css  js  c++  java
  • ssh remote forward 监听 0.0.0.0 端口;How to make SSH remote port forward that listens 0.0.0.0

    今天使用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

  • 相关阅读:
    第一阶段冲刺02
    梦断代码阅读笔记01
    第一阶段冲刺01
    第十周总结报告
    单词统计
    用户模板分析
    第九周总结
    第九周课后作业
    py_11_ 0726
    Day_01
  • 原文地址:https://www.cnblogs.com/xuyaowen/p/ssh-remote-forward.html
Copyright © 2011-2022 走看看