重新安装 NetworkManager 后,互联网连接无法正常工作。仅 dhclient usb0 有效。 VPN 连接显示已连接但实际未连接

重新安装 NetworkManager 后,互联网连接无法正常工作。仅 dhclient usb0 有效。 VPN 连接显示已连接但实际未连接

我在 ubuntu 20.04 上遇到了断开互联网和 VPN 连接的问题。因此,我决定根据以下内容重新安装网络管理器这个答案

我执行了以下命令

sudo apt-get purge network-manager
sudo apt-get update
sudo apt-get autoremove
sudo apt-get upgrade
sudo apt-get install network-manager
sudo apt install ubuntu-desktop

然后重新启动系统,之后我无法连接到互联网。我的调制解调器是启用了网络共享的 Android 设备(在执行上面列出的命令之前,互联网连接已正常工作)。连接在 ubuntu GUI(右上角)上可见,名称为“USB 以太网已连接”。尽管互联网无法正常工作。

我发现我可以执行dhclient usb0,之后互联网工作正常,但每次启动系统时我都必须执行此操作。另外,我无法连接到 VPN 网络(没有错误,GUI 表示已连接,但无法访问仅在 VPN 网络中可用的服务器)。

这是我的 ifconfig

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:25:93:e5:82  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker_gwbridge: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.19.0.1  netmask 255.255.0.0  broadcast 172.19.255.255
        inet6 fe80::42:c3ff:fe60:668a  prefixlen 64  scopeid 0x20<link>
        ether 02:42:c3:60:66:8a  txqueuelen 0  (Ethernet)
        RX packets 495  bytes 47231 (47.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 520  bytes 80963 (80.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp3s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 4c:ed:fb:95:c7:9f  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 5192  bytes 487445 (487.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5192  bytes 487445 (487.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.42.109  netmask 255.255.255.0  broadcast 192.168.42.255
        inet6 fe80::e097:241:56b:9a3a  prefixlen 64  scopeid 0x20<link>
        ether 92:28:29:5f:bf:6c  txqueuelen 1000  (Ethernet)
        RX packets 5  bytes 1058 (1.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 249  bytes 32661 (32.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth05b6c07: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::782e:6ff:fe4a:bdb9  prefixlen 64  scopeid 0x20<link>
        ether 7a:2e:06:4a:bd:b9  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 48  bytes 6509 (6.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth0ba13b0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::1cc9:c1ff:fef2:b783  prefixlen 64  scopeid 0x20<link>
        ether 1e:c9:c1:f2:b7:83  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 47  bytes 6425 (6.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth0c2d06c: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::286c:9dff:fe62:d6b8  prefixlen 64  scopeid 0x20<link>
        ether 2a:6c:9d:62:d6:b8  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth0e104e0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::ac61:95ff:feb6:f31b  prefixlen 64  scopeid 0x20<link>
        ether ae:61:95:b6:f3:1b  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth1b2a54a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::8c1c:f4ff:fec1:3097  prefixlen 64  scopeid 0x20<link>
        ether 8e:1c:f4:c1:30:97  txqueuelen 0  (Ethernet)
        RX packets 495  bytes 54161 (54.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 519  bytes 80611 (80.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth1e723d5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::c463:b3ff:fe4e:992c  prefixlen 64  scopeid 0x20<link>
        ether c6:63:b3:4e:99:2c  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth20ad462: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::7cf1:a6ff:fe67:bd5  prefixlen 64  scopeid 0x20<link>
        ether 7e:f1:a6:67:0b:d5  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth2b1261a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::2091:6eff:fe36:6915  prefixlen 64  scopeid 0x20<link>
        ether 22:91:6e:36:69:15  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth3575eea: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::94f8:e5ff:fed1:3f13  prefixlen 64  scopeid 0x20<link>
        ether 96:f8:e5:d1:3f:13  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth48f5a22: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::d8e6:fcff:fe3f:c003  prefixlen 64  scopeid 0x20<link>
        ether da:e6:fc:3f:c0:03  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth4f510a3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::a870:e1ff:feb9:9cca  prefixlen 64  scopeid 0x20<link>
        ether aa:70:e1:b9:9c:ca  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 77  bytes 10671 (10.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth6ca5384: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::80ce:94ff:fe2f:8c8e  prefixlen 64  scopeid 0x20<link>
        ether 82:ce:94:2f:8c:8e  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth7249d81: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::5c70:7fff:fe9d:54a4  prefixlen 64  scopeid 0x20<link>
        ether 5e:70:7f:9d:54:a4  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth875ed12: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::1047:dfff:fef6:d885  prefixlen 64  scopeid 0x20<link>
        ether 12:47:df:f6:d8:85  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth88216b5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::98bf:c5ff:fe8f:ef44  prefixlen 64  scopeid 0x20<link>
        ether 9a:bf:c5:8f:ef:44  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6098 (6.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vetha5da662: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::9c6d:36ff:fefa:4fdc  prefixlen 64  scopeid 0x20<link>
        ether 9e:6d:36:fa:4f:dc  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vethb219fc4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::a427:5ff:fe2a:de36  prefixlen 64  scopeid 0x20<link>
        ether a6:27:05:2a:de:36  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vethb58896f: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::80e9:50ff:fe61:aee7  prefixlen 64  scopeid 0x20<link>
        ether 82:e9:50:61:ae:e7  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 48  bytes 6509 (6.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vethdceb1ac: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::387d:c8ff:fea5:4926  prefixlen 64  scopeid 0x20<link>
        ether 3a:7d:c8:a5:49:26  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6115 (6.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

这是我的/etc/network/interfaces文件(最初重新安装网络管理器后它是空的,但我同时添加了它)

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
# auto lo
# iface lo inet loopback

# The primary network interface
# auto usb0
# iface usb0 inet dhcp

这是我的网络规划配置(只有/etc/netplan/01-network-amanger-all.yaml那里)

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

/etc/NetworkManager/NetworkManager.conf

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=true

[device]
wifi.scan-rand-mac-address=no

[keyfile]
unmanaged-devices=*,except:type:wifi,except:type:wwan,except:type:ethernet

我希望在启动计算机并使用 VPN 连接后可以使用互联网。我很高兴能解释为什么它停止工作、我能做什么以及在哪里可以阅读有关 Ubuntu 中网络配置的更多信息。

编辑#1

执行以下命令似乎修复了系统启动时的互联网连接,但 VPN 仍然无法工作。

apt install resolvconf
systemctl enable systemd-resolved.service
service systemd-resolved start

编辑#2

执行sudo apt-get install --reinstall ubuntu-desktop并重新启动计算机后,可以编辑 VPN 配置,我可以连接到 VPN,但无法通过其 DNS 名称访问任何服务器。

编辑#3

问题已解决此后教程

相关内容