在某些 wifi 网络中,我的笔记本电脑似乎会以随机的时间间隔不断重新连接,时间间隔在 1 到 60 分钟之间。在日志中,我发现了以下消息:
wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-SIGNAL-CHANGE above=0 signal=-76 noise=9999 txrate=26000
NetworkManager[1177]: <info> [1681913817.0277] dhcp4 (wlp1s0): state changed new lease, address=10.13.2.61
系统为何决定断开 wifi 连接?是因为信号强度(如上所示,信号 = -76)还是无关紧要?
这是一个问题,因为重新连接到 wifi 后,系统会获取一个新的 IP 地址,这会导致所有现有的 ssh 连接冻结。
更详细地说,来自初始连接的日志:
Apr 19 15:45:34 xlap NetworkManager[1177]: <info> [1681911934.3419] device (wlp1s0): supplicant interface state: 4way_handshake -> completed
Apr 19 15:45:34 xlap NetworkManager[1177]: <info> [1681911934.3420] device (wlp1s0): Activation: (wifi) Stage 2 of 5 (Device Configure) successful. Connected to wireless network "eduroam"
Apr 19 15:45:34 xlap NetworkManager[1177]: <info> [1681911934.3420] device (p2p-dev-wlp1s0): supplicant management interface state: 4way_handshake -> completed
Apr 19 15:45:34 xlap NetworkManager[1177]: <info> [1681911934.3422] device (wlp1s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Apr 19 15:45:34 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-SIGNAL-CHANGE above=0 signal=-58 noise=9999 txrate=26000
Apr 19 15:45:34 xlap NetworkManager[1177]: <info> [1681911934.3462] dhcp4 (wlp1s0): activation: beginning transaction (timeout in 45 seconds)
Apr 19 15:45:34 xlap avahi-daemon[1119]: Joining mDNS multicast group on interface wlp1s0.IPv6 with address fe80::33e0:44c4:f396:7975.
Apr 19 15:45:34 xlap avahi-daemon[1119]: New relevant interface wlp1s0.IPv6 for mDNS.
Apr 19 15:45:34 xlap avahi-daemon[1119]: Registering new address record for fe80::33e0:44c4:f396:7975 on wlp1s0.*.
Apr 19 15:45:35 xlap NetworkManager[1177]: <info> [1681911935.4593] dhcp4 (wlp1s0): state changed new lease, address=10.13.0.162
Apr 19 15:45:35 xlap avahi-daemon[1119]: Joining mDNS multicast group on interface wlp1s0.IPv4 with address 10.13.0.162.
Apr 19 15:45:35 xlap avahi-daemon[1119]: New relevant interface wlp1s0.IPv4 for mDNS.
Apr 19 15:45:35 xlap avahi-daemon[1119]: Registering new address record for 10.13.0.162 on wlp1s0.IPv4.
Apr 19 15:45:35 xlap NetworkManager[1177]: <info> [1681911935.4633] device (wlp1s0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Apr 19 15:45:35 xlap NetworkManager[1177]: <info> [1681911935.4651] device (wlp1s0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Apr 19 15:45:35 xlap NetworkManager[1177]: <info> [1681911935.4652] device (wlp1s0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Apr 19 15:45:35 xlap NetworkManager[1177]: <info> [1681911935.4656] manager: NetworkManager state is now CONNECTED_LOCAL
Apr 19 15:45:35 xlap NetworkManager[1177]: <info> [1681911935.4666] manager: NetworkManager state is now CONNECTED_SITE
Apr 19 15:45:35 xlap NetworkManager[1177]: <info> [1681911935.4667] policy: set 'eduroam' (wlp1s0) as default for IPv4 routing and DNS
Apr 19 15:45:35 xlap NetworkManager[1177]: <info> [1681911935.4669] device (wlp1s0): Activation: successful, device activated.
Apr 19 15:45:35 xlap NetworkManager[1177]: <info> [1681911935.4671] manager: NetworkManager state is now CONNECTED_GLOBAL
Apr 19 15:45:35 xlap NetworkManager[1177]: <info> [1681911935.4673] manager: startup complete
然后 Wifi 重新连接并获取新的 IP 地址:
Apr 19 16:15:03 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-SIGNAL-CHANGE above=1 signal=-61 noise=9999 txrate=130000
Apr 19 16:15:39 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-EAP-STARTED EAP authentication started
Apr 19 16:15:39 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=21 -> NAK
Apr 19 16:15:39 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=25
Apr 19 16:15:39 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-EAP-METHOD EAP vendor 0 method 25 (PEAP) selected
Apr 19 16:15:40 xlap wpa_supplicant[1179]: EAP-TLV: TLV Result - Success - EAP-TLV/Phase2 Completed
Apr 19 16:15:40 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
Apr 19 16:15:40 xlap wpa_supplicant[1179]: wlp1s0: PMKSA-CACHE-REMOVED 00:a7:42:b9:cf:cf 0
Apr 19 16:15:40 xlap wpa_supplicant[1179]: wlp1s0: PMKSA-CACHE-REMOVED 5c:83:8f:3c:8b:f0 0
Apr 19 16:15:40 xlap wpa_supplicant[1179]: wlp1s0: PMKSA-CACHE-REMOVED 00:a7:42:b9:cf:c0 0
Apr 19 16:15:40 xlap wpa_supplicant[1179]: wlp1s0: PMKSA-CACHE-ADDED 00:a7:42:b9:cf:c0 0
Apr 19 16:15:40 xlap NetworkManager[1177]: <info> [1681913740.2369] device (wlp1s0): supplicant interface state: completed -> 4way_handshake
Apr 19 16:15:40 xlap NetworkManager[1177]: <info> [1681913740.2370] device (p2p-dev-wlp1s0): supplicant management interface state: completed -> 4way_handshake
Apr 19 16:15:40 xlap wpa_supplicant[1179]: wlp1s0: WPA: Key negotiation completed with 00:a7:42:b9:cf:c0 [PTK=CCMP GTK=CCMP]
Apr 19 16:15:40 xlap NetworkManager[1177]: <info> [1681913740.3235] device (wlp1s0): supplicant interface state: 4way_handshake -> completed
Apr 19 16:15:40 xlap NetworkManager[1177]: <info> [1681913740.3257] device (p2p-dev-wlp1s0): supplicant management interface state: 4way_handshake -> completed
Apr 19 16:15:43 xlap kernel: Rekeying PTK for STA 00:a7:42:b9:cf:c0 but driver can't safely do that.
Apr 19 16:15:43 xlap kernel: wlp1s0: deauthenticated from 00:a7:42:b9:cf:c0 (Reason: 15=4WAY_HANDSHAKE_TIMEOUT)
Apr 19 16:15:43 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-SIGNAL-CHANGE above=0 signal=-9999 noise=9999 txrate=0
Apr 19 16:15:43 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-DISCONNECTED bssid=00:a7:42:b9:cf:c0 reason=15
Apr 19 16:15:43 xlap wpa_supplicant[1179]: BSSID 00:a7:42:b9:cf:c0 ignore list count incremented to 2, ignoring for 10 seconds
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.4085] device (wlp1s0): supplicant interface state: completed -> disconnected
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.4086] device (p2p-dev-wlp1s0): supplicant management interface state: completed -> disconnected
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.4849] device (wlp1s0): supplicant interface state: disconnected -> scanning
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.4850] device (p2p-dev-wlp1s0): supplicant management interface state: disconnected -> scanning
Apr 19 16:15:43 xlap wpa_supplicant[1179]: wlp1s0: PMKSA-CACHE-ADDED 00:a7:42:b9:cf:cf 0
Apr 19 16:15:43 xlap wpa_supplicant[1179]: wlp1s0: PMKSA-CACHE-ADDED 5c:83:8f:3c:8b:f0 0
Apr 19 16:15:43 xlap wpa_supplicant[1179]: wlp1s0: SME: Trying to authenticate with 00:a7:42:b9:cf:cf (SSID='eduroam' freq=5320 MHz)
Apr 19 16:15:43 xlap kernel: wlp1s0: authenticate with 00:a7:42:b9:cf:cf
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.6487] device (wlp1s0): supplicant interface state: scanning -> authenticating
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.6487] device (p2p-dev-wlp1s0): supplicant management interface state: scanning -> authenticating
Apr 19 16:15:43 xlap kernel: wlp1s0: send auth to 00:a7:42:b9:cf:cf (try 1/3)
Apr 19 16:15:43 xlap wpa_supplicant[1179]: wlp1s0: Trying to associate with 00:a7:42:b9:cf:cf (SSID='eduroam' freq=5320 MHz)
Apr 19 16:15:43 xlap kernel: wlp1s0: authenticated
Apr 19 16:15:43 xlap kernel: wlp1s0: associate with 00:a7:42:b9:cf:cf (try 1/3)
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.6812] device (wlp1s0): supplicant interface state: authenticating -> associating
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.6813] device (p2p-dev-wlp1s0): supplicant management interface state: authenticating -> associating
Apr 19 16:15:43 xlap kernel: wlp1s0: RX AssocResp from 00:a7:42:b9:cf:cf (capab=0x111 status=0 aid=2)
Apr 19 16:15:43 xlap wpa_supplicant[1179]: wlp1s0: Associated with 00:a7:42:b9:cf:cf
Apr 19 16:15:43 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-EAP-STARTED EAP authentication started
Apr 19 16:15:43 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Apr 19 16:15:43 xlap kernel: wlp1s0: associated
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.7255] device (wlp1s0): supplicant interface state: associating -> associated
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.7256] device (p2p-dev-wlp1s0): supplicant management interface state: associating -> associated
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.7256] device (wlp1s0): ip:dhcp4: restarting
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.7575] dhcp4 (wlp1s0): canceled DHCP transaction
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.7576] dhcp4 (wlp1s0): activation: beginning transaction (timeout in 45 seconds)
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.7576] dhcp4 (wlp1s0): state changed no lease
Apr 19 16:15:43 xlap NetworkManager[1177]: <info> [1681913743.7577] dhcp4 (wlp1s0): activation: beginning transaction (timeout in 45 seconds)
Apr 19 16:15:43 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=21 -> NAK
Apr 19 16:15:43 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=25
Apr 19 16:15:43 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-EAP-METHOD EAP vendor 0 method 25 (PEAP) selected
Apr 19 16:15:43 xlap kernel: wlp1s0: Limiting TX power to 17 dBm as advertised by 00:a7:42:b9:cf:cf
Apr 19 16:15:44 xlap wpa_supplicant[1179]: EAP-TLV: TLV Result - Success - EAP-TLV/Phase2 Completed
Apr 19 16:15:44 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
Apr 19 16:15:44 xlap wpa_supplicant[1179]: wlp1s0: PMKSA-CACHE-REMOVED 00:a7:42:b9:cf:cf 0
Apr 19 16:15:44 xlap wpa_supplicant[1179]: wlp1s0: PMKSA-CACHE-ADDED 00:a7:42:b9:cf:cf 0
Apr 19 16:15:44 xlap wpa_supplicant[1179]: wlp1s0: WPA: Key negotiation completed with 00:a7:42:b9:cf:cf [PTK=CCMP GTK=CCMP]
Apr 19 16:15:44 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-CONNECTED - Connection to 00:a7:42:b9:cf:cf completed [id=0 id_str=]
Apr 19 16:15:44 xlap NetworkManager[1177]: <info> [1681913744.3398] device (wlp1s0): supplicant interface state: associated -> completed
Apr 19 16:15:44 xlap wpa_supplicant[1179]: wlp1s0: CTRL-EVENT-SIGNAL-CHANGE above=0 signal=-76 noise=9999 txrate=26000
Apr 19 16:15:44 xlap NetworkManager[1177]: <info> [1681913744.3407] device (p2p-dev-wlp1s0): supplicant management interface state: associated -> completed
Apr 19 16:15:49 xlap NetworkManager[1177]: <info> [1681913749.4690] dhcp4 (wlp1s0): state changed new lease, address=10.13.3.14
Apr 19 16:15:49 xlap avahi-daemon[1119]: Withdrawing address record for 10.13.0.162 on wlp1s0.
Apr 19 16:15:49 xlap avahi-daemon[1119]: Leaving mDNS multicast group on interface wlp1s0.IPv4 with address 10.13.0.162.
Apr 19 16:15:49 xlap avahi-daemon[1119]: Interface wlp1s0.IPv4 no longer relevant for mDNS.
Apr 19 16:15:49 xlap avahi-daemon[1119]: Joining mDNS multicast group on interface wlp1s0.IPv4 with address 10.13.3.14.
Apr 19 16:15:49 xlap avahi-daemon[1119]: New relevant interface wlp1s0.IPv4 for mDNS.
Apr 19 16:15:49 xlap avahi-daemon[1119]: Registering new address record for 10.13.3.14 on wlp1s0.IPv4.
答案1
这是由于网络管理器中的错误。
如果该错误是由您的客户端在单个接入点上在 5GHz 和 2.4GHz 之间切换触发的,那么您可以通过强制使用特定频段来解决此问题:(使用“a”表示 5GHz 或使用“bg”表示 2.4GHz)
nmcli connection modify <SSID> 802-11-wireless.band a
如果该错误是由接入点之间的漫游触发的,那么您可以通过从 NetworkManager 的内部 DHCP 客户端切换到外部 DHCP 客户端来解决此问题(使用 NetworkManager 中的 main/dhcp 设置)。