![写入:对端重置连接](https://linux22.com/image/1205691/%E5%86%99%E5%85%A5%EF%BC%9A%E5%AF%B9%E7%AB%AF%E9%87%8D%E7%BD%AE%E8%BF%9E%E6%8E%A5.png)
当我打开我的电脑(Ubuntu 19.04)并尝试第一次登录我的ssh
服务器(Raspbian buster)时,我得到write: connection reset by peer
:
trp@trp-pc:~$ ssh -vvv [email protected]
OpenSSH_7.9p1 Ubuntu-10, OpenSSL 1.1.1b 26 Feb 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.2.251 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.2.251 [192.168.2.251] port 22.
debug1: Connection established.
debug1: identity file /home/trp/.ssh/id_rsa type 0
debug1: identity file /home/trp/.ssh/id_rsa-cert type -1
debug1: identity file /home/trp/.ssh/id_dsa type -1
debug1: identity file /home/trp/.ssh/id_dsa-cert type -1
debug1: identity file /home/trp/.ssh/id_ecdsa type -1
debug1: identity file /home/trp/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/trp/.ssh/id_ed25519 type -1
debug1: identity file /home/trp/.ssh/id_ed25519-cert type -1
debug1: identity file /home/trp/.ssh/id_xmss type -1
debug1: identity file /home/trp/.ssh/id_xmss-cert type -1
write: Connection reset by peer
但如果我ping
尝试ssh
两次,我就能连接上,一切都很顺利(没有断开连接等),而且我可以与服务器进行多次 ssh 会话。如果我重新启动 PC,问题会再次出现(第一次登录尝试)。
更新#1:
我检查了日志(auth.log),但即使LogLevel DEBUG3
登录尝试失败也不存在。
更新#2:
我尝试指定 Mac、Kex 和 Key,但没有任何变化()ssh -o KexAlgorithms=diffie-hellman-group16-sha512 -o [email protected] -o HostbasedKeyTypes=ssh-rsa -c aes192-ctr
答案1
问题出在我的路由器/调制解调器上。我将地址池改回默认值(从 .2 改为 .254),删除了服务器的静态 IP(已在路由器/调制解调器设置中设置),连接到服务器并设置静态 IP。现在一切都运行顺利。