Debian 的間歇性網際網路連接/DNS 問題
在過去的 15~20 天裡,我遇到了連接不一致的問題。我已經嘗試了幾件事,但大多數情況下我不能說他們是否有幫助。
我可以肯定地說:
- 從休眠狀態返回時,雖然我仍然連接到 WIFI,但我無法訪問網際網路上的任何內容。
- Chrome 返回
DNS_PROBE_FINISHED_NXDOMAIN
,更換瀏覽器並不能解決問題。- 斷開並重新連接,也無濟於事。
- 該命令
sudo dhclient -v
在工作時解決了問題。(詳情如下)- 這不是我的 ISP,因為網際網路仍然可以在我的台式機和智能手機上執行(連接到同一個 wifi)。$$ but maybe is a router/modem issue? $$
這些是奇怪的細節:
- 有時我仍然可以 ping 站點,但無法訪問它們,有時ping 不起作用,它會返回
connect: Network is unreachable
.- 重啟有時能解決問題,有時不能。
- 有時問題會自行解決,而我什麼都不做。
- 這個問題發生的前幾次我嘗試將 DNS 從 AUTO 更改為 Manual (8.8.8.8) 或相反,這取決於我上次離開的方式。它似乎有效,但現在它沒有,所以也許它從來沒有做任何事情來解決問題並且問題解決了它自己?
正如我所說,
sudo dhclient -v
當返回完成時,執行解決了問題,如下所示:來自 192.168.15.1 的 192.168.15.4 的 DHCPACK
綁定到 192.168.15.4 – 在 17437 秒內更新。
但是,有時,當我執行命令時,它會返回:
未收到 DHCPOFFERS。
持久數據庫中沒有工作租約 - 休眠。
問題仍然存在。
下面是一些可能有助於診斷的命令的返回:
lspci
00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 0b) 00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b) 00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 0b) 00:14.0 USB controller: Intel Corporation 8 Series USB xHCI HC (rev 04) 00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04) 00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04) 00:1c.0 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 1 (rev e4) 00:1c.2 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 3 (rev e4) 00:1c.3 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 4 (rev e4) 00:1d.0 USB controller: Intel Corporation 8 Series USB EHCI #1 (rev 04) 00:1f.0 ISA bridge: Intel Corporation 8 Series LPC Controller (rev 04) 00:1f.2 SATA controller: Intel Corporation 8 Series SATA Controller 1 [AHCI mode] (rev 04) 00:1f.3 SMBus: Intel Corporation 8 Series SMBus Controller (rev 04) 02:00.0 Network controller: Intel Corporation Wireless 7260 (rev 73) 03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTL8411B PCI Express Card Reader (rev 01) 03:00.1 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 12)
如果配置
command not found
ip路由顯示
169.254.0.0/16 dev br-7905315c0c67 scope link metric 1000 linkdown 172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 172.18.0.0/16 dev br-7905315c0c67 proto kernel scope link src 172.18.0.1 linkdown 172.19.0.0/16 dev br-bb285dfa325a proto kernel scope link src 172.19.0.1 linkdown
ip地址
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp3s0f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether b8:2a:72:c0:da:1d brd ff:ff:ff:ff:ff:ff inet 169.254.8.72/16 brd 169.254.255.255 scope link enp3s0f1:avahi valid_lft forever preferred_lft forever 3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 80:86:f2:cc:95:7f brd ff:ff:ff:ff:ff:ff inet 192.168.15.4/24 brd 192.168.15.255 scope global dynamic wlp2s0 valid_lft 42972sec preferred_lft 42972sec inet6 2804:7f2:2980:fa68:50c4:6476:6282:be9/64 scope global dynamic noprefixroute valid_lft 43168sec preferred_lft 43168sec inet6 fe80::1d23:31f:b217:e60d/64 scope link noprefixroute valid_lft forever preferred_lft forever 4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default link/ether 02:42:b9:59:21:ea brd ff:ff:ff:ff:ff:ff inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0 valid_lft forever preferred_lft forever 5: br-7905315c0c67: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default link/ether 02:42:ca:dc:1a:34 brd ff:ff:ff:ff:ff:ff inet 172.18.0.1/16 brd 172.18.255.255 scope global br-7905315c0c67 valid_lft forever preferred_lft forever 6: br-bb285dfa325a: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default link/ether 02:42:45:ee:9f:bd brd ff:ff:ff:ff:ff:ff inet 172.19.0.1/16 brd 172.19.255.255 scope global br-bb285dfa325a valid_lft forever preferred_lft forever
dhclient -v 當它不起作用時
Listening on LPF/br-bb285dfa325a/02:42:45:ee:9f:bd Sending on LPF/br-bb285dfa325a/02:42:45:ee:9f:bd Listening on LPF/br-7905315c0c67/02:42:ca:dc:1a:34 Sending on LPF/br-7905315c0c67/02:42:ca:dc:1a:34 Listening on LPF/docker0/02:42:b9:59:21:ea Sending on LPF/docker0/02:42:b9:59:21:ea Listening on LPF/wlp2s0/80:86:f2:cc:95:7f Sending on LPF/wlp2s0/80:86:f2:cc:95:7f Listening on LPF/enp3s0f1/b8:2a:72:c0:da:1d Sending on LPF/enp3s0f1/b8:2a:72:c0:da:1d Sending on Socket/fallback DHCPDISCOVER on br-bb285dfa325a to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on br-7905315c0c67 to 255.255.255.255 port 67 interval 5 DHCPDISCOVER on docker0 to 255.255.255.255 port 67 interval 4 DHCPREQUEST for 192.168.15.4 on wlp2s0 to 255.255.255.255 port 67 DHCPDISCOVER on enp3s0f1 to 255.255.255.255 port 67 interval 6 DHCPDISCOVER on docker0 to 255.255.255.255 port 67 interval 11 DHCPDISCOVER on br-7905315c0c67 to 255.255.255.255 port 67 interval 9 DHCPDISCOVER on enp3s0f1 to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on br-bb285dfa325a to 255.255.255.255 port 67 interval 7 DHCPREQUEST for 192.168.15.4 on wlp2s0 to 255.255.255.255 port 67 DHCPDISCOVER on enp3s0f1 to 255.255.255.255 port 67 interval 10 DHCPDISCOVER on br-bb285dfa325a to 255.255.255.255 port 67 interval 9 DHCPDISCOVER on br-7905315c0c67 to 255.255.255.255 port 67 interval 15 DHCPDISCOVER on docker0 to 255.255.255.255 port 67 interval 18 DHCPDISCOVER on wlp2s0 to 255.255.255.255 port 67 interval 4 DHCPDISCOVER on br-bb285dfa325a to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on enp3s0f1 to 255.255.255.255 port 67 interval 10 DHCPDISCOVER on wlp2s0 to 255.255.255.255 port 67 interval 10 DHCPDISCOVER on br-7905315c0c67 to 255.255.255.255 port 67 interval 13 DHCPDISCOVER on br-bb285dfa325a to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on docker0 to 255.255.255.255 port 67 interval 15 DHCPDISCOVER on enp3s0f1 to 255.255.255.255 port 67 interval 13 DHCPDISCOVER on wlp2s0 to 255.255.255.255 port 67 interval 15 DHCPDISCOVER on br-bb285dfa325a to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on br-7905315c0c67 to 255.255.255.255 port 67 interval 19 DHCPDISCOVER on br-bb285dfa325a to 255.255.255.255 port 67 interval 11 DHCPDISCOVER on enp3s0f1 to 255.255.255.255 port 67 interval 15 DHCPDISCOVER on docker0 to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on wlp2s0 to 255.255.255.255 port 67 interval 10 DHCPDISCOVER on br-bb285dfa325a to 255.255.255.255 port 67 interval 6 DHCPDISCOVER on docker0 to 255.255.255.255 port 67 interval 6 DHCPDISCOVER on wlp2s0 to 255.255.255.255 port 67 interval 15 DHCPOFFER of 192.168.15.4 from 192.168.15.1 DHCPREQUEST for 192.168.15.4 on wlp2s0 to 255.255.255.255 port 67 No DHCPOFFERS received. No working leases in persistent database - sleeping.
dhclient -v 什麼時候起作用
Listening on LPF/br-bb285dfa325a/02:42:3a:6c:f8:53 Sending on LPF/br-bb285dfa325a/02:42:3a:6c:f8:53 Listening on LPF/br-7905315c0c67/02:42:a9:2c:f1:4d Sending on LPF/br-7905315c0c67/02:42:a9:2c:f1:4d Listening on LPF/docker0/02:42:47:5b:95:10 Sending on LPF/docker0/02:42:47:5b:95:10 Listening on LPF/wlp2s0/80:86:f2:cc:95:7f Sending on LPF/wlp2s0/80:86:f2:cc:95:7f Listening on LPF/enp3s0f1/b8:2a:72:c0:da:1d Sending on LPF/enp3s0f1/b8:2a:72:c0:da:1d Sending on Socket/fallback DHCPDISCOVER on br-bb285dfa325a to 255.255.255.255 port 67 interval 5 DHCPDISCOVER on br-7905315c0c67 to 255.255.255.255 port 67 interval 6 DHCPDISCOVER on docker0 to 255.255.255.255 port 67 interval 6 DHCPREQUEST for 192.168.15.4 on wlp2s0 to 255.255.255.255 port 67 DHCPDISCOVER on enp3s0f1 to 255.255.255.255 port 67 interval 5 DHCPREQUEST for 192.168.15.4 on wlp2s0 to 255.255.255.255 port 67 DHCPDISCOVER on enp3s0f1 to 255.255.255.255 port 67 interval 8 DHCPDISCOVER on br-bb285dfa325a to 255.255.255.255 port 67 interval 7 DHCPREQUEST for 192.168.15.4 on wlp2s0 to 255.255.255.255 port 67 DHCPACK of 192.168.15.4 from 192.168.15.1 bound to 192.168.15.4 -- renewal in 17437 seconds.
> 編輯 =====
在@Fubar 回答之後,我做了一個
apt update
並且apt upgrade
注意到了很多可能缺少韌體的警告。不確定它以前是否發生過(如果發生過,從未註意到)或是否相關。在那之後,我無法重現這個問題,這可能是一件好事,只要它沒有“回來”。
這可能與所涉及的驅動程序有關,而不是與作業系統有關。例如,在 Windows 中從休眠狀態中恢復是由作業系統管理的,但實際上是由其他軟體位(如驅動程序)完成的。如果驅動程序不能正確處理喚醒,則它的工作效果可能會不一致。我建議,作為測試,當你下次遇到問題時,使用
lspci
或類似的東西來找出你的驅動程序的名稱,然後lsmod
查看它是否作為模組載入,而不是內置到核心中。如果是這樣,您可以嘗試使用rmmod
or解除安裝modprobe -r
然後重新載入modprobe
. 從上面提供的資訊來看,您感興趣的模組是 r8168 驅動程序,它是 RealTek 官方驅動程序。該模組可能存在依賴關係,因此您可能需要嘗試一下以確保獲得所有正確的模組,儘管網路現在可能比我使用它時具有依賴關係。將所有位排序後,您可以創建一個 shell 腳本來執行您使用的所有命令,然後在遇到問題時執行它,而不是每次都嘗試記住順序。所有這些,包括任何 shell 腳本,顯然都需要以 root 身份或使用 sudo 執行。當然,這並不肯定這會奏效,但它可能會有所幫助。您還可以在此處查看以獲取適配器的最新韌體,以確保它是最新的。如果不是,更新它也可能有助於解決問題。只看幾個地方。