因此,我知道存在类似的问题,但是到目前为止我无法使用任何解决方案来解决我的问题:
我正在尝试从运行 Ubuntu 20.04 Desktop 的 Thinkpad P14s(英特尔)连接到 LAN 网络。我一直收到:“激活网络连接失败“而我已经没有其他可行的解决方案了。我无法使用路由器,但对于 Windows 笔记本电脑来说,同样的电缆连接也可以正常工作,所以我认为这不可能是电缆或连接的问题。
我试过:
- 完全重新安装 Ubuntu
- 沿着这个步骤邮政
- 重新安装网络管理器
- 重新启动网络管理器
- 不同的 LAN 电缆
- 安装 HWE:
sudo apt install linux-generic-hwe-20.04
根据日志输出(sudo journalctl -b 0 -u NetworkManager
),dhcp 请求遇到超时:输出
以下是输出lshw -C network
*-network:0
description: Wireless interface
product: Intel Corporation
vendor: Intel Corporation
physical id: 14.3
bus info: pci@0000:00:14.3
logical name: wlp0s20f3
version: 20
serial: a0:e7:0b:d2:f7:21
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=5.11.0-40-generic firmware=59.601f3a66.0 QuZ-a0-hr-b0-59.u ip=10.181.78.114 latency=0 link=yes multicast=yes wireless=IEEE 802.11
resources: iomemory:600-5ff irq:16 memory:6053bc4000-6053bc7fff
*-network:1
description: Ethernet interface
product: Ethernet Connection (13) I219-V
vendor: Intel Corporation
physical id: 1f.6
bus info: pci@0000:00:1f.6
logical name: enp0s31f6
version: 20
serial: 90:2e:16:93:b9:4d
size: 1Gbit/s
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=5.11.0-40-generic duplex=full firmware=0.8-3 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
resources: irq:149 memory:bec80000-bec9ffff
*-network
description: Ethernet interface
physical id: 2
bus info: usb@2:3.3
logical name: enx34298f70f2f4
serial: 34:29:8f:70:f2:f4
size: 10Mbit/s
capacity: 1Gbit/s
capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8152 driverversion=v1.11.11 duplex=half firmware=rtl8153a-4 v2 02/07/20 link=no multicast=yes port=MII speed=10Mbit/s
输出nmcli connection
:
NAME UUID TYPE DEVICE
netplan-enp0s31f6 d4735e4b-9bfa-3052-b1c4-ef3302803c9a ethernet enp0s31f6
设置不同的 dhcp 客户端(如这个帖子 )我至少可以让日志发生改变:
nov 25 14:40:09 l dhclient[10449]: DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 10 (xid=0x4c152271)
nov 25 14:40:10 l NetworkManager[9427]: <info> [1637847610.7508] device (enp0s31f6): state change: ip-config -> deactivating (reason 'user-requested', sys-iface-state: 'managed')
nov 25 14:40:10 l NetworkManager[9427]: <info> [1637847610.7514] manager: NetworkManager state is now DISCONNECTING
nov 25 14:40:10 l NetworkManager[9427]: <info> [1637847610.7527] audit: op="device-disconnect" interface="enp0s31f6" ifindex=2 pid=9100 uid=1000 result="success"
nov 25 14:40:10 l NetworkManager[9427]: <info> [1637847610.7622] device (enp0s31f6): state change: deactivating -> disconnected (reason 'user-requested', sys-iface-state: 'managed')
nov 25 14:40:10 l NetworkManager[9427]: <info> [1637847610.7658] dhcp4 (enp0s31f6): canceled DHCP transaction, DHCP client pid 10449
nov 25 14:40:10 l NetworkManager[9427]: <info> [1637847610.7658] dhcp4 (enp0s31f6): state changed unknown -> done
nov 25 14:40:11 l NetworkManager[9427]: <info> [1637847611.0623] manager: NetworkManager state is now DISCONNECTED
nov 25 14:40:11 l NetworkManager[9427]: <info> [1637847611.5681] device (enp0s31f6): Activation: starting connection 'netplan-enp0s31f6' (d4735e4b-9bfa-3052-b1c4-ef3302803c9a)
nov 25 14:40:11 l NetworkManager[9427]: <info> [1637847611.5682] audit: op="connection-activate" uuid="d4735e4b-9bfa-3052-b1c4-ef3302803c9a" name="netplan-enp0s31f6" pid=9100 uid=1000 result="success"
nov 25 14:40:11 l NetworkManager[9427]: <info> [1637847611.5685] device (enp0s31f6): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
nov 25 14:40:11 l NetworkManager[9427]: <info> [1637847611.5694] manager: NetworkManager state is now CONNECTING
nov 25 14:40:11 l NetworkManager[9427]: <info> [1637847611.5699] device (enp0s31f6): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
nov 25 14:40:11 l NetworkManager[9427]: <info> [1637847611.5712] device (enp0s31f6): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
nov 25 14:40:11 l NetworkManager[9427]: <info> [1637847611.5719] dhcp4 (enp0s31f6): activation: beginning transaction (timeout in 45 seconds)
nov 25 14:40:11 l NetworkManager[9427]: <info> [1637847611.5755] dhcp4 (enp0s31f6): dhclient started with pid 10539
nov 25 14:40:11 l dhclient[10539]: DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 3 (xid=0x7d307302)
nov 25 14:40:11 l dhclient[10539]: Can't create /run/NetworkManager/dhclient-enp0s31f6.pid: Permission denied
nov 25 14:40:14 l dhclient[10539]: DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 8 (xid=0x7d307302)
提前致谢。
编辑1
正如@heynnema所问,输出cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
输出cat /etc/netplan/*.yaml
:
network:
ethernets:
enp0s31f6:
dhcp4: true
version: 2
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
network:
version: 2
renderer: NetworkManager
编辑2
按照下面的@heynnema 的步骤操作后,我仍然收到相同的错误,以下是输出journalctl -b 0 -u NetworkManager
:
nov 29 08:53:12 l NetworkManager[1034]: <info> [1638172392.1044] device (enp0s31f6): Activation: starting connection 'Wired connection 1' (5f5a5254-5476-3279-9b2a-cfc3981d7e66)
nov 29 08:53:12 l NetworkManager[1034]: <info> [1638172392.1046] audit: op="connection-activate" uuid="5f5a5254-5476-3279-9b2a-cfc3981d7e66" name="Wired connection 1" pid=3796 uid=1000 result="succe>
nov 29 08:53:12 l NetworkManager[1034]: <info> [1638172392.1047] device (enp0s31f6): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
nov 29 08:53:12 l NetworkManager[1034]: <info> [1638172392.1054] manager: NetworkManager state is now CONNECTING
nov 29 08:53:12 l NetworkManager[1034]: <info> [1638172392.1058] device (enp0s31f6): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
nov 29 08:53:12 l NetworkManager[1034]: <info> [1638172392.1069] device (enp0s31f6): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
nov 29 08:53:12 l NetworkManager[1034]: <info> [1638172392.1075] dhcp4 (enp0s31f6): activation: beginning transaction (timeout in 45 seconds)
nov 29 08:53:12 l NetworkManager[1034]: <info> [1638172392.1114] dhcp4 (enp0s31f6): dhclient started with pid 3874
nov 29 08:53:12 l dhclient[3874]: DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 3 (xid=0xbf0c12b)
nov 29 08:53:12 l dhclient[3874]: Can't create /run/NetworkManager/dhclient-enp0s31f6.pid: Permission denied
nov 29 08:53:15 l dhclient[3874]: DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 8 (xid=0xbf0c12b)
nov 29 08:53:23 l dhclient[3874]: DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 11 (xid=0xbf0c12b)
nov 29 08:53:34 l dhclient[3874]: DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 21 (xid=0xbf0c12b)
nov 29 08:53:55 l dhclient[3874]: DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 12 (xid=0xbf0c12b)
nov 29 08:53:57 l NetworkManager[1034]: <warn> [1638172437.5143] dhcp4 (enp0s31f6): request timed out
nov 29 08:53:57 l NetworkManager[1034]: <info> [1638172437.5144] dhcp4 (enp0s31f6): state changed unknown -> timeout
nov 29 08:53:57 l NetworkManager[1034]: <info> [1638172437.5144] device (enp0s31f6): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed')
nov 29 08:53:57 l NetworkManager[1034]: <info> [1638172437.5154] manager: NetworkManager state is now DISCONNECTED
nov 29 08:53:57 l NetworkManager[1034]: <warn> [1638172437.5171] device (enp0s31f6): Activation: failed for connection 'Wired connection 1'
nov 29 08:53:57 l NetworkManager[1034]: <info> [1638172437.5177] device (enp0s31f6): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
nov 29 08:53:57 l NetworkManager[1034]: <info> [1638172437.5584] dhcp4 (enp0s31f6): canceled DHCP transaction, DHCP client pid 3874
nov 29 08:53:57 l NetworkManager[1034]: <info> [1638172437.5585] dhcp4 (enp0s31f6): state changed timeout -> done
根据此论坛帖子(但是适用于 Ubuntu Sever).leases 文件可能有问题,但是在我的 /etc/passwd 文件中没有用户。这是我的目录dhcp
的内容:/var/lib/dhcp
drwxr-xr-x 2 root root 4096 nov 9 13:11 .
drwxr-xr-x 70 root root 4096 nov 22 15:02 ..
-rw-r--r-- 1 root root 0 nov 25 14:23 dhclient.leases
编辑3
正如@heynnema所问:输出ls -la /etc/network/interfaces.d
total 8
drwxr-xr-x 2 root root 4096 mag 3 2019 .
drwxr-xr-x 7 root root 4096 nov 25 14:26 .
输出ls -la /run/NetworkManager/
:
total 8
drwxr-xr-x 5 root root 160 nov 29 12:16 .
drwxr-xr-x 38 root root 1060 nov 29 12:15 ..
drwxr-xr-x 2 root root 60 nov 29 12:14 conf.d
drwxr-xr-x 2 root root 80 nov 29 12:23 devices
-rw-r--r-- 1 root root 274 nov 29 12:16 no-stub-resolv.conf
srwxr-xr-x 1 root root 0 nov 29 12:14 private-dhcp
-rw-r--r-- 1 root root 74 nov 29 12:16 resolv.conf
输出grep -i -v "#" /etc/dhcp/dhclient.conf
:
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
timeout 300;
编辑4 正如@heynnema 所问
- 输出
ls -al /etc/network/interfaces.d
(无文件):
total 8
drwxr-xr-x 2 root root 4096 May 3 2019 .
drwxr-xr-x 7 root root 4096 Mar 15 08:48 ..
- 输出
cat /etc/network/interfaces
:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
- 输出
ls -al /etc/netplan
:
total 20
drwxr-xr-x 2 root root 4096 Nov 29 08:56 .
drwxr-xr-x 145 root root 12288 Mar 16 07:52 ..
-rw-r--r-- 1 root root 104 Aug 19 2021 config.yam
- 输出
cat /etc/netplan/*.yaml
:
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
有线连接的设置都是标准的,Connect automatically
并且Make available to other users
经过检查
编辑5 正如@heynnema 所问
cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile
[ifupdown]
managed=true
[device]
wifi.scan-rand-mac-address=no
答案1
假设你正在运行 Ubuntu 20.04桌面...
看起来您在 /etc/netplan 中有多个 .yaml 文件。
删除此.yaml 文件..
network:
ethernets:
enp0s31f6:
dhcp4: true
version: 2
保留此.yaml 文件...
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
删除这个.yaml 文件...
network:
version: 2
renderer: NetworkManager
sudo netplan generate
sudo netplan apply
reboot
然后,如果需要,使用标准 NetworkManager GUI 配置您的网络连接。