使用该命令,ssh -v -R 2255:localhost:2255 root@example.com我试图找出为什么远程端口转发不起作用,直到我意识到GatewayPorts yes主机的 sshd_config 中不存在该命令。一旦我添加了它,它就成功了。
有什么办法可以诊断出这种情况吗?
SSH 甚至输出以下内容(没有 GatewayPorts yes):
debug1: Remote connections from LOCALHOST:2255 forwarded to local address localhost:2255
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: remote forward success for: listen 2255, connect localhost:2255
debug1: All remote forwarding requests processed
Run Code Online (Sandbox Code Playgroud)
当您指定2255:localhost:2255将前面缺少的主机名填充为localhost. 这实际上只会绑定到localhost地址(环回)。如果您还想“从外部”使用它,则需要使用服务器 IP 进行远程端口转发,例如example.com:2255:localhost:2255.
| 归档时间: |
|
| 查看次数: |
10863 次 |
| 最近记录: |