无法通过 ssh 连接到树莓派 - 挂起

无法通过 ssh 连接到树莓派 - 挂起

当我尝试使用 verbose ssh 到我的一个 rpis(我们称之为 .7)时,我得到以下输出

ssh [email protected] -v
OpenSSH_8.9p1 Ubuntu-3ubuntu0.4, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 192.168.1.7 [192.168.1.7] port 22.

它只是无休止地挂着。

我可以连接到我家里的所有其他树莓派,除了这个特定的树莓派(不知道为什么)。我什至尝试登录另一个 rpi(比如 .62),然后我能够从它 ssh 到(.7),这让我怀疑这是我笔记本电脑的配置问题,尽管我无法弄清楚知道它是什么。

更新1

ssh_config 文件

Include /etc/ssh/ssh_config.d/*.conf

Host *
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes

sshd_config 文件

Include /etc/ssh/sshd_config.d/*.conf
KbdInteractiveAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem   sftp    /usr/lib/openssh/sftp-server

并且第二个文件不存在

更新2

OpenSSH_8.9p1 Ubuntu-3ubuntu0.4, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.1.7 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/username/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/username/.ssh/known_hosts2'
debug3: ssh_connect_direct: entering
debug1: Connecting to 192.168.1.7 [192.168.1.7] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10

更新3

tcpdump的输出如下

sudo tcpdump  -i wlp0s20f3 -n 'port 22'
[sudo] password for myusername:            
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on wlp0s20f3, link-type EN10MB (Ethernet), snapshot length 262144 bytes
10:11:10.086559 IP 192.168.1.5.50418 > 192.168.1.7.22: Flags [S], seq 441937362, win 64240, options [mss 1460,sackOK,TS val 2181705493 ecr 0,nop,wscale 7], length 0
10:11:11.087399 IP 192.168.1.5.50418 > 192.168.1.7.22: Flags [S], seq 441937362, win 64240, options [mss 1460,sackOK,TS val 2181706494 ecr 0,nop,wscale 7], length 0
10:11:13.103394 IP 192.168.1.5.50418 > 192.168.1.7.22: Flags [S], seq 441937362, win 64240, options [mss 1460,sackOK,TS val 2181708510 ecr 0,nop,wscale 7], length 0
10:11:17.199574 IP 192.168.1.5.50418 > 192.168.1.7.22: Flags [S], seq 441937362, win 64240, options [mss 1460,sackOK,TS val 2181712606 ecr 0,nop,wscale 7], length 0

我的笔记本电脑是 192.168.1.5,我的无线卡接口(从 ifconfig 获得)是 wlp0s20f3。我基本上运行命令,然后在单独的终端窗口中尝试 ssh 进入 (.7)

答案1

非常感谢大家的帮助。对于根本原因最终是我的蹩脚路由器(来自 Sky Hub),我并不感到惊讶。它被设置为向 pi 提供静态 IP 地址,一旦我更改该 IP,它就重新开始工作。它一定保留了一些与以前的 IP 相关的错误配置,当我设置新的 IP 时,这些错误配置被清除了。谢谢大家。

相关内容