我正在尝试使用Windows电脑上的SSH从我的本地网络中的Raspberry Pi进行远程端口转发。
我该如何进一步诊断我的问题?
ssh -R 5941:localhost:8000 pi@192.168.1.191
从上面的命令中,我正在尝试将来自树莓派服务器(192.168.1.191)端口5941的连接转发到我的个人电脑(localhost)上的端口8000,该端口托管了一个端口为8000的Web服务器。
以上ssh命令执行时没有错误,但是当我尝试在树莓派(192.168.1.191)上访问http://localhost:5941/时,我得到了以下错误:
ERR_EMPTY_RESPONSE
我已经尝试过:
- 关闭了我的Windows PC防火墙
- 在树莓派上运行netstat,结果如下:
$ sudo netstat -a | grep 5941
tcp 0 0 0.0.0.0:5941 0.0.0.0:* LISTEN
tcp6 0 0 [::]:5941 [::]:* LISTEN
- 当我以详细模式运行ssh命令时
ssh -R 5941:localhost:8000 pi@192.168.1.191 -v
我会得到以下输出:
debug1: Remote connections from LOCALHOST:5941 forwarded to local address localhost:8000
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: console supports the ansi parsing
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Remote: Forwarding listen address "localhost" overridden by server GatewayPorts
debug1: remote forward success for: listen 5941, connect localhost:8000
debug1: All remote forwarding requests processed
当我尝试在树莓派上(192.168.1.191)访问http://localhost:5941/时,ssh控制台上显示了以下内容:
debug1: client_input_channel_open: ctype forwarded-tcpip rchan 3 win 2097152 max 32768
debug1: client_request_forwarded_tcpip: listen localhost port 5941, originator ::1 port 58122
debug1: getsockopt TCP_NODELAY: Invalid argument
debug1: connect_next: host localhost ([::1]:8000) in progress, fd=7
debug1: channel 1: new [::1]
debug1: confirm forwarded-tcpip
debug1: channel 1: connected to localhost port 8000
debug1: channel 1: free: ::1, nchannels 2
我该如何进一步诊断我的问题?