有线网络在 Debian 上可以工作几秒钟

有线网络在 Debian 上可以工作几秒钟

我最近更换了我的 ISP,之后我在 Debian 10 上连接到互联网时开始遇到一些问题。起初,我认为这可能是我的 ISP 的错误,但互联网在 Windows 上运行良好(我已经双启动)和我的手机(wifi)。在 Debian 上,互联网可以工作几秒钟,足以加载一页,但之后就不再工作了。我已经尝试增加 MTU 值,因为看起来它可以帮助其他遇到此问题的人,但对我不起作用。另外,我使用我的笔记本电脑进行了测试,该笔记本电脑也安装了 Debian 10,它可以工作。我使用有线和无线网络进行了测试。

dmesg |尾-20给我:

[   13.976571] br-a16997434552: port 1(veth6622e95) entered forwarding state
[   13.976619] eth0: renamed from vethdb50e9c
[   13.996186] eth0: renamed from vethcbb270b
[   14.044342] IPv6: ADDRCONF(NETDEV_CHANGE): br-a16997434552: link becomes ready
[   14.044712] eth0: renamed from veth6bc5a88
[   14.068466] IPv6: ADDRCONF(NETDEV_CHANGE): veth94bcb37: link becomes ready
[   14.068523] br-bcf7ce342cb9: port 1(veth94bcb37) entered blocking state
[   14.068527] br-bcf7ce342cb9: port 1(veth94bcb37) entered forwarding state
[   14.068614] IPv6: ADDRCONF(NETDEV_CHANGE): vetha3f8b80: link becomes ready
[   14.068658] br-f68c9df397fa: port 1(vetha3f8b80) entered blocking state
[   14.068661] br-f68c9df397fa: port 1(vetha3f8b80) entered forwarding state
[   14.068758] IPv6: ADDRCONF(NETDEV_CHANGE): br-bcf7ce342cb9: link becomes ready
[   14.068836] IPv6: ADDRCONF(NETDEV_CHANGE): br-f68c9df397fa: link becomes ready
[   14.069028] IPv6: ADDRCONF(NETDEV_CHANGE): vetha784882: link becomes ready
[   14.069063] br-37692a4e723c: port 1(vetha784882) entered blocking state
[   14.069065] br-37692a4e723c: port 1(vetha784882) entered forwarding state
[   14.069117] IPv6: ADDRCONF(NETDEV_CHANGE): br-37692a4e723c: link becomes ready
[   14.121290] r8169 0000:03:00.0 enp3s0: Link is Up - 1Gbps/Full - flow control off
[   19.920051] snd_hda_codec_hdmi hdaudioC0D0: HDMI: invalid ELD data byte 20
[   20.224017] snd_hda_codec_hdmi hdaudioC0D0: HDMI: invalid ELD data byte 20

获取http://www.duckduckgo.com给我:

--2021-05-30 00:12:43--  http://www.duckduckgo.com/
Resolvendo www.duckduckgo.com (www.duckduckgo.com)... 191.235.123.80
Conectando-se a www.duckduckgo.com (www.duckduckgo.com)|191.235.123.80|:80... falhou: Tempo esgotado para conexão.
Tentando novamente.

--2021-05-30 00:13:23--  (tentativa: 2)  http://www.duckduckgo.com/
Conectando-se a www.duckduckgo.com (www.duckduckgo.com)|191.235.123.80|:80... falhou: Tempo esgotado para conexão.
Tentando novamente.

--2021-05-30 00:13:57--  (tentativa: 3)  http://www.duckduckgo.com/
Conectando-se a www.duckduckgo.com (www.duckduckgo.com)|191.235.123.80|:80... falhou: Tempo esgotado para conexão.
Tentando novamente.

--2021-05-30 00:14:31--  (tentativa: 4)  http://www.duckduckgo.com/
Conectando-se a www.duckduckgo.com (www.duckduckgo.com)|191.235.123.80|:80... ^C

ip 路由获取 1.1.1.1给我:

1.1.1.1 via 192.168.0.1 dev enp3s0 src 192.168.0.102 uid 1000 
    cache

ip -br 链接; ip -br 地址; ip路由给我:

lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> 
enp3s0           UP             18:31:bf:b3:38:7d <BROADCAST,MULTICAST,UP,LOWER_UP> 
br-9ca719aa01c7  DOWN           02:42:97:ea:72:b0 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-b97158ffcc3c  DOWN           02:42:74:c5:64:57 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
docker0          DOWN           02:42:c9:ef:9e:71 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-55cb011b3e0d  DOWN           02:42:04:1a:72:0a <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-777211ddb717  DOWN           02:42:4f:08:86:92 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-a16997434552  UP             02:42:55:72:e0:b8 <BROADCAST,MULTICAST,UP,LOWER_UP> 
br-bcf7ce342cb9  UP             02:42:f1:f0:8e:7b <BROADCAST,MULTICAST,UP,LOWER_UP> 
br-d4e258cd683a  DOWN           02:42:05:9b:2d:27 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-4b3e4deacee9  DOWN           02:42:9d:07:40:5b <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-f68c9df397fa  UP             02:42:92:59:d5:6c <BROADCAST,MULTICAST,UP,LOWER_UP> 
br-131ad989692b  DOWN           02:42:84:4e:6e:12 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-194e7a613502  DOWN           02:42:61:b8:5d:7a <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-2a67d8f8b954  DOWN           02:42:c2:d1:b4:e1 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-37692a4e723c  UP             02:42:a9:7b:1f:3a <BROADCAST,MULTICAST,UP,LOWER_UP> 
br-3f32a31d3339  UP             02:42:06:e1:4b:19 <BROADCAST,MULTICAST,UP,LOWER_UP> 
br-499e90637a6b  DOWN           02:42:3c:d7:50:ca <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-552074ecc891  DOWN           02:42:f8:04:ed:b7 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-0e204ce773a5  DOWN           02:42:a5:2c:56:25 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-68d74d345015  DOWN           02:42:42:d7:7a:37 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-c41dfb61e164  DOWN           02:42:ee:61:a9:ae <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-cf71a6f7b6d3  DOWN           02:42:52:85:a0:b7 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-f0c082f01e56  DOWN           02:42:d3:80:d0:bf <NO-CARRIER,BROADCAST,MULTICAST,UP> 
br-639bfb1bea34  DOWN           02:42:2f:93:cc:d2 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
veth759ec1c@if26 UP             2e:8a:16:fd:f5:de <BROADCAST,MULTICAST,UP,LOWER_UP> 
veth44148ca@if28 UP             62:b4:1f:13:bc:51 <BROADCAST,MULTICAST,UP,LOWER_UP> 
vethc7f2d65@if30 UP             52:9e:00:cb:c7:46 <BROADCAST,MULTICAST,UP,LOWER_UP> 
veth0067bf4@if32 UP             5e:6f:bb:a0:28:1c <BROADCAST,MULTICAST,UP,LOWER_UP> 
veth443e622@if34 UP             d2:97:46:de:79:91 <BROADCAST,MULTICAST,UP,LOWER_UP> 
lo               UNKNOWN        127.0.0.1/8 ::1/128 
enp3s0           UP             192.168.0.102/24 2804:14c:6583:5e7f::1000/128 2804:14c:6583:5e7f:c496:f510:ca8c:79ce/64 fe80::9847:c342:d509:4024/64 
br-9ca719aa01c7  DOWN           192.168.96.1/20 
br-b97158ffcc3c  DOWN           172.20.0.1/16 
docker0          DOWN           172.17.0.1/16 
br-55cb011b3e0d  DOWN           192.168.160.1/20 
br-777211ddb717  DOWN           172.26.0.1/16 
br-a16997434552  UP             172.28.0.1/16 fe80::42:55ff:fe72:e0b8/64 
br-bcf7ce342cb9  UP             172.22.0.1/16 fe80::42:f1ff:fef0:8e7b/64 
br-d4e258cd683a  DOWN           172.24.0.1/16 
br-4b3e4deacee9  DOWN           192.168.48.1/20 
br-f68c9df397fa  UP             172.27.0.1/16 fe80::42:92ff:fe59:d56c/64 
br-131ad989692b  DOWN           172.23.0.1/16 
br-194e7a613502  DOWN           192.168.80.1/20 
br-2a67d8f8b954  DOWN           192.168.240.1/20 
br-37692a4e723c  UP             172.29.0.1/16 fe80::42:a9ff:fe7b:1f3a/64 
br-3f32a31d3339  UP             172.31.0.1/16 fe80::42:6ff:fee1:4b19/64 
br-499e90637a6b  DOWN           172.18.0.1/16 
br-552074ecc891  DOWN           172.19.0.1/16 
br-0e204ce773a5  DOWN           172.30.0.1/16 
br-68d74d345015  DOWN           192.168.16.1/20 
br-c41dfb61e164  DOWN           192.168.0.1/20 
br-cf71a6f7b6d3  DOWN           172.25.0.1/16 
br-f0c082f01e56  DOWN           172.21.0.1/16 
br-639bfb1bea34  DOWN           192.168.112.1/20 
veth759ec1c@if26 UP             fe80::2c8a:16ff:fefd:f5de/64

Lucas Andrade, [30.05.21 09:50]
veth44148ca@if28 UP             fe80::60b4:1fff:fe13:bc51/64 
vethc7f2d65@if30 UP             fe80::509e:ff:fecb:c746/64 
veth0067bf4@if32 UP             fe80::5c6f:bbff:fea0:281c/64 
veth443e622@if34 UP             fe80::d097:46ff:fede:7991/64 
default via 192.168.0.1 dev enp3s0 proto dhcp metric 100 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 
172.18.0.0/16 dev br-499e90637a6b proto kernel scope link src 172.18.0.1 linkdown 
172.19.0.0/16 dev br-552074ecc891 proto kernel scope link src 172.19.0.1 linkdown 
172.20.0.0/16 dev br-b97158ffcc3c proto kernel scope link src 172.20.0.1 linkdown 
172.21.0.0/16 dev br-f0c082f01e56 proto kernel scope link src 172.21.0.1 linkdown 
172.22.0.0/16 dev br-bcf7ce342cb9 proto kernel scope link src 172.22.0.1 
172.23.0.0/16 dev br-131ad989692b proto kernel scope link src 172.23.0.1 linkdown 
172.24.0.0/16 dev br-d4e258cd683a proto kernel scope link src 172.24.0.1 linkdown 
172.25.0.0/16 dev br-cf71a6f7b6d3 proto kernel scope link src 172.25.0.1 linkdown 
172.26.0.0/16 dev br-777211ddb717 proto kernel scope link src 172.26.0.1 linkdown 
172.27.0.0/16 dev br-f68c9df397fa proto kernel scope link src 172.27.0.1 
172.28.0.0/16 dev br-a16997434552 proto kernel scope link src 172.28.0.1 
172.29.0.0/16 dev br-37692a4e723c proto kernel scope link src 172.29.0.1 
172.30.0.0/16 dev br-0e204ce773a5 proto kernel scope link src 172.30.0.1 linkdown 
172.31.0.0/16 dev br-3f32a31d3339 proto kernel scope link src 172.31.0.1 
192.168.0.0/24 dev enp3s0 proto kernel scope link src 192.168.0.102 metric 100 
192.168.0.0/20 dev br-c41dfb61e164 proto kernel scope link src 192.168.0.1 linkdown 
192.168.16.0/20 dev br-68d74d345015 proto kernel scope link src 192.168.16.1 linkdown 
192.168.48.0/20 dev br-4b3e4deacee9 proto kernel scope link src 192.168.48.1 linkdown 
192.168.80.0/20 dev br-194e7a613502 proto kernel scope link src 192.168.80.1 linkdown 
192.168.96.0/20 dev br-9ca719aa01c7 proto kernel scope link src 192.168.96.1 linkdown 
192.168.112.0/20 dev br-639bfb1bea34 proto kernel scope link src 192.168.112.1 linkdown 
192.168.160.0/20 dev br-55cb011b3e0d proto kernel scope link src 192.168.160.1 linkdown 
192.168.240.0/20 dev br-2a67d8f8b954 proto kernel scope link src 192.168.240.1 linkdown

答案1

OP实际上有一个很多网络设置:几个 Docker 网络。

其中之一如下所示:

地址:

br-c41dfb61e164  DOWN           192.168.0.1/20 

路线:

192.168.0.0/20 dev br-c41dfb61e164 proto kernel scope link src 192.168.0.1 linkdown 

向主机添加新地址:192.168.0.1/20。 Linux 遵循弱者主机型号,该地址始终可用(向上)无论状态如何br-c41dfb61e164

它与主机路由器(也称为网关)设置的 DHCP 设置冲突,该路由器使用 192.168.0.1/24。 Linux 上的 DHCP 使用带外方法(原始套接字)来工作,因此绕过任何网络“异常”:当 DHCP 工作时,它会设置:

default via 192.168.0.1 dev enp3s0 proto dhcp metric 100 

当主机有自己的地址作为网关时,就好像它没有使用任何网关一样:对 Internet 上任何地址的任何请求都会触发 ARP 请求,该请求将失败,而不是通过路由器发送数据包(这将是唯一的地址)应该使用正确的网络设置进行 ARP)。此外,这还可能随机中断使用该网络的其他设备,因为它还会应答对网关地址的 ARP 请求。

快速解决方法是禁用并停止 Docker,如果没有正确清理,则可能需要重新启动,如下所示OP在评论中证实:

systemctl disable --now docker

(也可以选择关联systemctl mask docker.socket以避免任何“虚假”启动)

长期修复与 Docker 设置有关,超出了本问题的范围。这里有两个建议:

  • 清理未使用的容器和相关网络

  • 更改 Docker 设置,以便新网络的分配更小(例如 /24),并且位于未使用的地址空间中,可能位于 10.0.0.0/8 中的某个位置,但要注意与某些 VPN 发生冲突。

    可以从这个 SF Q/A 中获取示例:将 Docker 配置为不使用 172.17.0.0 范围

相关内容