简体   繁体   English

无法使用 SSH 登录到本地树莓派

[英]Cannot log in to local Raspberry Pi using SSH

I've just set up Raspberry Pi and I am trying to login using SSH, but it fails with Connection timed out .我刚刚设置了 Raspberry Pi,我正在尝试使用 SSH 登录,但它失败了Connection timed out

$ ssh -v pi@192.168.1.20
OpenSSH_6.7p1, OpenSSL 1.0.1j 15 Oct 2014
debug1: Reading configuration data /cygdrive/c/Users/ironsand/.ssh/config
debug1: Connecting to 192.168.1.20 [192.168.1.20] port 22.
debug1: connect to address 192.168.1.20 port 22: Connection timed out
ssh: connect to host 192.168.1.20 port 22: Connection timed out 

Even $ ping 192.168.1.20 also fails with Destination Host Unreachable and ping from Raspberry Pi to Windows also fails.即使$ ping 192.168.1.20也会因Destination Host Unreachable而失败,并且从 Raspberry Pi 到 Windows 的 ping 也失败。

From Raspberry I can connect internet.从 Raspberry 我可以连接互联网。

Bad thing is that I don't have the right to access WiFi router configuration.不好的是,我无权访问 WiFi 路由器配置。 I'll ask share house manager, but probably I can't get the information of it.我会问共享房屋经理,但可能我无法得到它的信息。

Is there something I can do to fix the problem except for Router configuration?除了路由器配置之外,我还能做些什么来解决这个问题?

This is ifconfig result.这是 ifconfig 结果。

在此处输入图片说明

My windows-computer had (without me noticing) changed the network-settings thinking it wasn't in a safe/private network.我的 Windows 计算机(在我没有注意到的情况下)更改了网络设置,认为它不在安全/专用网络中。 Going to networks and changing this followed by the following on the raspberry pi did it for me:转到网络并更改此内容,然后在树莓派上执行以下操作为我做了:

sudo rm /etc/ssh/ssh_host_* && sudo dpkg-reconfigure openssh-server

Few steps which might help narrowing the issue down:可能有助于缩小问题范围的几个步骤:
1. try ssh 127.0.0.1 from raspberry pi itself - if it does not work it is probably some SSH issue on rpi (maybe it is disabled in raspi config - in the past it was disabled by default?) 1. 从树莓派本身尝试 ssh 127.0.0.1 - 如果它不起作用,则可能是 rpi 上的一些 SSH 问题(也许它在 raspi 配置中被禁用 - 过去它默认被禁用?)
2. try ssh 192.168.1.20 from the rpi itself 2.从rpi本身尝试ssh 192.168.1.20
3. try connecting the RPI via the ethernet cable (not wifi) 3.尝试通过以太网电缆(不是wifi)连接RPI
4. try changing the IP of RPI - sometimes it helps 4. 尝试更改 RPI 的 IP - 有时它会有所帮助
5. sometimes the power managment turns the wifi off - try running sudo /sbin/ifup --force wlan0 periodically 5. 有时电源管理会关闭 wifi - 尝试定期运行sudo /sbin/ifup --force wlan0

If you can't ping in either direction, even on the same subnet, then it sounds like your router is interfering, eg the "guest network" mode of many routers that isolate each computer on the LAN from one another.如果您无法在任一方向 ping 通,即使在同一个子网中,那么听起来您的路由器正在干扰,例如,许多路由器的“访客网络”模式将 LAN 上的每台计算机彼此隔离。 There may be nothing you can do short of installing another router downstream from the main one, and connecting both the Pi and the peer computer to that.除了在主路由器的下游安装另一个路由器,并将 Pi 和对等计算机连接到该路由器之外,您可能无能为力。

我遇到了同样的问题,结果我在路由器上启用了 AP 隔离,我禁用了它并且工作正常

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

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