我在远程位置运行树莓派,所以我使用 autossh 设置了到我的一台服务器(CentOS 7)的反向 ssh 隧道。一切正常,我可以使用这个反向 ssh 从服务器登录到 Raspberry,但我无法让服务器转发 ssh,所以我无法从笔记本电脑通过服务器连接到 Raspberry,我总是得到拒绝连接。服务器上的防火墙已关闭 GatewayPorts 是已添加到 sshd_config 并重新启动了 sshd。
细节:
- 在覆盆子上,我打开反向 SSH 隧道:
autossh -fNC -g -M 0 -R 2223:localhost:22 [serveruser]@[server] -p2002
- 从服务器我可以毫无问题地通过 ssh 进入树莓派:
ssh [raspberryuser]@localhost -p2223
- 我在 /etc/ssh/sshd_config 添加了 next 并在之后重新启动了 sshd 服务:
网关端口 是
- 我可以从服务器成功 ssh 进入树莓派:
ssh [raspberryuser]@localhost -p2223
- 但是当我试图通过这个服务器从我的笔记本电脑连接到 Raspberry 时:
ssh [raspberryuser]@[server] -p2223 ssh: connect to host [server] port 2223: Connection refused
服务器上的防火墙已停止
SELinux 在服务器上被禁用
我的想法用完了,所以我愿意接受建议