最近,我的 Ubuntu 安装 (22.04) 已创建大约 5-6 个桥接网络,这些网络似乎阻止了互联网访问。我可以手动检查并关闭每个接口,然后通过“brctl delbr”删除桥接,但每次都执行此操作很麻烦。即使重新启动,这些桥接也会重新创建。
当网桥(所有 br-* 接口)处于活动状态并阻止互联网访问时,这是路由的输出:
➜ ~ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 600 0 0 wlp0s20f3
link-local 0.0.0.0 255.255.0.0 U 1000 0 0 wlp0s20f3
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-d426659a2acb
172.19.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-fc0b0e819621
172.20.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-28a1cb513e25
172.21.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-a453127c4011
172.23.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-d80fc876a9ed
192.168.0.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp0s20f3
192.168.0.0 0.0.0.0 255.255.240.0 U 0 0 0 br-238ff410ee26
以下是其中一个桥接接口的 syslog 输出:
Nov 8 18:25:06 willis-laptop NetworkManager[1536]: <info> [1667960706.1071] manager: (br-d80fc876a9ed): new Bridge device (/org/freedesktop/NetworkManager/Devices/9)
Nov 8 18:25:06 willis-laptop avahi-daemon[1530]: Joining mDNS multicast group on interface br-d80fc876a9ed.IPv4 with address 172.23.0.1.
Nov 8 18:25:06 willis-laptop NetworkManager[1536]: <info> [1667960706.2016] device (br-d80fc876a9ed): state change: unmanaged -> unavailable (reason 'connection-assumed', sys-iface-state: 'external')
Nov 8 18:25:06 willis-laptop NetworkManager[1536]: <info> [1667960706.2026] device (br-d80fc876a9ed): state change: unavailable -> disconnected (reason 'connection-assumed', sys-iface-state: 'external')
Nov 8 18:25:06 willis-laptop avahi-daemon[1530]: New relevant interface br-d80fc876a9ed.IPv4 for mDNS.
Nov 8 18:25:06 willis-laptop avahi-daemon[1530]: Registering new address record for 172.23.0.1 on br-d80fc876a9ed.IPv4.
Nov 8 18:25:06 willis-laptop NetworkManager[1536]: <info> [1667960706.2042] device (br-d80fc876a9ed): Activation: starting connection 'br-d80fc876a9ed' (12323e12-58ee-427c-9b11-967ff562ba1a)
Nov 8 18:25:06 willis-laptop NetworkManager[1536]: <info> [1667960706.2063] device (br-d80fc876a9ed): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'external')
Nov 8 18:25:06 willis-laptop NetworkManager[1536]: <info> [1667960706.2072] device (br-d80fc876a9ed): state change: prepare -> config (reason 'none', sys-iface-state: 'external')
Nov 8 18:25:06 willis-laptop NetworkManager[1536]: <info> [1667960706.2076] device (br-d80fc876a9ed): state change: config -> ip-config (reason 'none', sys-iface-state: 'external')
Nov 8 18:25:06 willis-laptop NetworkManager[1536]: <info> [1667960706.2107] device (br-d80fc876a9ed): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'external')
Nov 8 18:25:06 willis-laptop NetworkManager[1536]: <info> [1667960706.2274] device (br-d80fc876a9ed): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'external')
Nov 8 18:25:06 willis-laptop NetworkManager[1536]: <info> [1667960706.2277] device (br-d80fc876a9ed): state change: secondaries -> activated (reason 'none', sys-iface-state: 'external')
Nov 8 18:25:06 willis-laptop NetworkManager[1536]: <info> [1667960706.2284] device (br-d80fc876a9ed): Activation: successful, device activated.
答案1
这几乎肯定与 docker 设置了太多网桥有关(见如何确定 powertop 中模糊的 `nic:br-` 设备的身份?)一个解决方案是关闭多余的docker网络:
docker network prune