今天使用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://github.com/yaowenxu轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/308114.html
標籤:其他
上一篇:每周一個linux命令(ls)
