You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

同时连接以太网与WiFi时SSH无法连接的原因排查求助

同时连接以太网与WiFi时SSH无法连接的原因排查求助

大家好,我碰到了一个搞不懂的网络问题,想请大家帮忙分析下:

我有两台运行Debian 11的笔记本电脑 [L1, L2],都连接到同一个网络设备:

  • L1:同时通过以太网连接,且无线网卡处于开启状态
  • L2:仅通过WiFi连接

在这个配置下,我无法从L1(客户端)通过SSH连接到L2(服务器)。只有拔掉L1的以太网网线,或者关闭L1的WiFi后,SSH才能正常工作。我想弄清楚这背后的原因。

客户端(L1)相关信息

首先是客户端的网络接口地址输出:

~$ ip -brief addr
lo               UNKNOWN        127.0.0.1/8 ::1/128
enp1s0f1         UP             192.168.1.24/24 fe80::id1
wlp2s0           UP             192.168.1.24/24 fe80::id2

然后是执行ssh -vvv xxx@192.168.1.21的调试日志:

~$ ssh -vvv xxx@192.168.1.21
OpenSSH_8.4p1 Debian-5+deb11u1, OpenSSL 1.1.1n  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.21 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/xxx/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/xxx/.ssh/known_hosts2'
debug2: ssh_connect_direct
debug1: Connecting to 192.168.1.21 [192.168.1.21] port 22.
debug1: connect to address 192.168.1.21 port 22: No route to host
ssh: connect to host 192.168.1.21 port 22: No route to host

服务器端(L2)相关信息

服务器端开启调试模式运行sshd的日志:

~# /usr/sbin/sshd -d
debug1: sshd version OpenSSH_9.2, OpenSSL 3.0.9 30 May 2023
debug1: private host key #0: ssh-rsa
debug1: private host key #1: ecdsa-sha2-nistp256
debug1: private host key #2: ssh-ed25519
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
debug1: Set /proc/self/oom_score_adj from 0 to -1000
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
debug1: sshd version OpenSSH_9.2, OpenSSL 3.0.9 30 May 2023
debug1: private host key #0: ssh-rsa SHA256:
debug1: private host key #1: ecdsa-sha2-nistp256 SHA256:
debug1: private host key #2: ssh-ed25519 SHA256:
debug1: inetd sockets after dupping: 3, 3
Connection from 192.168.1.24 port 36154 on 192.168.1.21 port 22 rdomain ""
debug1: Local version string SSH-2.0-OpenSSH_9.2p1 Debian-2
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4p1 Debian-5+deb11u1
debug1: compat_banner: match: OpenSSH_8.4p1 Debian-5+deb11u1 pat OpenSSH* compat 0x04000000
debug1: permanently_set_uid: 115/65534 [preauth]
debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth]
debug1: SSH2_MSG_KEXINIT sent [preauth]
debug1: SSH2_MSG_KEXINIT received [preauth]
debug1: kex: algorithm: curve25519-sha256 [preauth]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256 [preauth]
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none [preauth]
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none [preauth]
debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
debug1: SSH2_MSG_KEX_ECDH_INIT received [preauth]
debug1: rekey out after 134217728 blocks [preauth]
debug1: SSH2_MSG_NEWKEYS sent [preauth]
debug1: Sending SSH2_MSG_EXT_INFO [preauth]
debug1: expecting SSH2_MSG_NEWKEYS [preauth]
debug1: SSH2_MSG_NEWKEYS received [preauth]
debug1: rekey in after 134217728 blocks [preauth]
debug1: KEX done [preauth]
debug1: userauth-request for user xxx  service ssh-connection method none [preauth]
debug1: attempt 0 failures 0 [preauth]
debug1: PAM: initializing for "xxx"
debug1: PAM: setting PAM_RHOST to "192.168.1.24"
debug1: PAM: setting PAM_TTY to "ssh"
debug1: userauth_send_banner: sent [preauth]
debug1: userauth-request for user xxx service ssh-connection method publickey [preauth]
debug1: attempt 1 failures 0 [preauth]
debug1: userauth_pubkey: publickey test pkalg rsa-sha2-512 pkblob RSA SHA256:[preauth]
debug1: temporarily_use_uid: 1000/1000 (e=0/0)
debug1: trying public key file /home/mi/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
debug1: /home/xxx/.ssh/authorized_keys:1: matching key found: RSA SHA256:
debug1: /home/xxx/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
Accepted key RSA SHA256: found at /home/xxx/.ssh/authorized_keys:1
debug1: restore_uid: 0/0
Postponed publickey for xxx from 192.168.1.24 port 36154 ssh2 [preauth]
debug1: userauth-request for user xxx service ssh-connection method publickey [preauth]
debug1: attempt 2 failures 0 [preauth]
debug1: temporarily_use_uid: 1000/1000 (e=0/0)
debug1: trying public key file /home/xxx/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
debug1: /home/xxx/.ssh/authorized_keys:1: matching key found: RSA SHA256:
debug1: /home/xxx/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
Accepted key RSA SHA256: found at /home/xxx/.ssh/authorized_keys:1
debug1: restore_uid: 0/0
debug1: auth_activate_options: setting new authentication options
debug1: do_pam_account: called
Accepted publickey for xxx from 192.168.1.24 port 36154 ssh2: RSA SHA256:
debug1: monitor_child_preauth: user xxx authenticated by privileged process
debug1: auth_activate_options: setting new authentication options [preauth]
debug1: monitor_read_log: child log fd closed
debug1: PAM: establishing credentials
User child is on pid 2553
debug1: SELinux support disabled
debug1: PAM: establishing credentials
debug1: permanently_set_uid: 1000/1000
debug1: rekey in after 134217728 blocks
debug1: rekey out after 134217728 blocks
debug1: ssh_packet_set_postauth: called
debug1: active: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Entering interactive session for SSH2.
debug1: server_init_dispatch
debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max 16384
debug1: input_session_request
debug1: channel 0: new session [server-session] (inactive timeout: 0)
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0
debug1: server_input_channel_req: channel 0 request pty-req reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req pty-req
debug1: Allocating pty.
debug1: session_new: session 0
debug1: SELinux support disabled
debug1: session_pty_req: session 0 alloc /dev/pts/1
debug1: server_input_channel_req: channel 0 request env reply 0
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req env
debug1: server_input_channel_req: channel 0 request shell reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req shell
Starting session: shell on pts/1 for xxx from 192.168.1.24 port 36154 id 0

备注:内容来源于stack exchange,提问作者mazda

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 15:28:07