简体   繁体   English

树莓派外网怎么ssh

[英]How to ssh raspberry pi outside the local network

I have a little problem with my ssh, I'm trying to ssh my raspberry pi from the outside of the network with the public Ip.我的 ssh 有一点问题,我正在尝试使用公共 Ip 从网络外部对我的树莓派进行 ssh。

Things I done: - Forward the port 22(TCP) on the router - Change some parameter to the ssh_config and sshd_config我所做的事情: - 转发路由器上的端口 22(TCP) - 将一些参数更改为 ssh_config 和 sshd_config

When I try to connect with the public Ip, Putty give me this error(ssh connection refused) I now my password and username are right because when I use ssh but with local up it works.当我尝试与公共 Ip 连接时,Putty 给我这个错误(ssh 连接被拒绝)我现在我的密码和用户名是正确的,因为当我使用 ssh 但在本地运行时它可以工作。

I thinks I have to change a parameter in the ssh_config to allow connections from the outside of the network.我认为我必须更改 ssh_config 中的参数以允许来自网络外部的连接。

If you have an idea please let me know Thanks如果你有想法请告诉我谢谢

Moreover, make sure you set a static IP address for the Raspi in router, because, if you don't do so, your port forwarding can become outdated.此外,请确保您在路由器中为 Raspi 设置了 static IP 地址,因为如果您不这样做,您的端口转发可能会过时。

Same happens with your public IP.您的公共 IP 也会发生同样的情况。 From time to time it can be changed by your ISP.您的 ISP 可能会不时更改它。 You should use a service for DDNS and connect through a domain to your router/raspi.您应该使用 DDNS 服务并通过域连接到您的路由器/raspi。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM