Ubuntu 18.04 网络管理器未为 USB 以太网设备创建新连接

Ubuntu 18.04 网络管理器未为 USB 以太网设备创建新连接

问题是,当我添加 USB 以太网设备时,网络管理器不会为添加的设备创建新连接。它正确地管理它,但它会卡在断开连接状态,直到您手动使用网络管理器添加连接。这不是常规安装的行为方式,常规安装会让网络管理器在内存中创建连接并将其连接到您刚插入的设备。

我使用替代安装程序安装了 ubuntu,并使用预置文件设置机器。在预置文件中,我们安装了 ubuntu 桌面的所有软件包和其他一些软件包。这可能与问题有关。预置文件可能相关部分,其他所有内容都与分区和加密有关。

d-i netcfg/choose_interface select auto
tasksel tasksel/first multiselect ubuntu-desktop
d-i pkgsel/include string ssh build-essential python-minimal ubuntu-desktop vim

以这种方式安装的原因不明。可以更改,但此错误会影响已以这种方式设置的设备,并且无法“重新安装”来修复它们。

当主板上有以太网连接和两个 USB 以太网连接时 nmcli 输出的示例。

eno1: connected to netplan-eno1

enx8cae4cfea138: connected to Wired connection 1

enx00e08f005933: disconnected
        "Realtek USB 10/100/1000 LAN"
        1 connection available
        ethernet (r8152), 00:E0:8F:00:59:33, hw, mtu 1500

似乎在安装过程中的某个地方,网络管理器创建了“有线连接 1”,然后/etc/NetworkManager/system-connections/将其应用于任何连接的 USB 设备。eno1 似乎正在使用 netplan 生成的东西。我不确定我应该在哪里寻找所有这些,这台怪异的机器产生的 netplan、networkmanager 和 systemd-networkd 的混合有点令人困惑,但这里有一些相关的配置文件。这些是全新安装的,没有改变。

/etc/NetworkManager/NetworkManager.conf

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

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

/etc/NetworkManager/system-connections/有线连接 1

[connection]
id=Wired connection 1
uuid=5da83520-ee6d-4e0a-a21d-27d0c9eb5b77
type=802-3-ethernet

[802-3-ethernet]

[ipv4]
method=auto

[ipv6]
method=auto
ip6-privacy=2

/etc/netplan/01-netcfg.yml

# This file describes the network interfaces available on your system
# For more information, see netplan(5)
network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: yes

/etc/netplan/01-网络管理器-all.yaml

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

/var/运行/网络管理器/系统连接/netplan-eno1

[connection]
id=netplan-eno1
type=ethernet
interface-name=eno1

[ethernet]
wake-on-lan=0

[ipv4]
method=auto

[ipv6]
method=ignore

/etc/网络/接口

source-directory /etc/network/interfaces.d

并且interfaced.d是一个空目录。

NetworkManager 是已启用的服务,而 systemd-networkd 未启用。

当我将 USB 以太网插入设备时,网络管理器无法为其分配连接,因此我从网络管理器运行 Journalctl。

Aug 09 15:06:25 <computer> NetworkManager[1011]: <info>  [1565388385.0741] manager: (eth0): new Ethernet device (/org/freedesktop/NetworkManager/Devices/8)
Aug 09 15:06:25 <computer> NetworkManager[1011]: <info>  [1565388385.1246] devices added (path: /sys/devices/pci0000:00/0000:00:14.0/usb2/2-8/2-8.1/2-8.1:1.0/net/enx8cae4ce9dc04, iface: enx8cae4ce9dc04)
Aug 09 15:06:25 <computer> NetworkManager[1011]: <info>  [1565388385.1246] device added (path: /sys/devices/pci0000:00/0000:00:14.0/usb2/2-8/2-8.1/2-8.1:1.0/net/enx8cae4ce9dc04, iface: enx8cae4ce9dc04): no ifupdown configuration found.
Aug 09 15:06:25 <computer> NetworkManager[1011]: <info>  [1565388385.1247] device (enx8cae4ce9dc04): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
Aug 09 15:06:28 <computer> NetworkManager[1011]: <info>  [1565388388.4869] device (enx8cae4ce9dc04): carrier: link connected
Aug 09 15:06:28 <computer> NetworkManager[1011]: <info>  [1565388388.4897] device (enx8cae4ce9dc04): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')

当我将 USB 设备插入自己的桌面时,网络管理器中的 Journalctl。

Aug 09 15:04:25 <computer> NetworkManager[2382]: <info>  [1565388265.0379] manager: (eth0): new Ethernet device (/org/freedesktop/NetworkManager/Devices/11)
Aug 09 15:04:25 <computer> NetworkManager[2382]: <info>  [1565388265.0961] devices added (path: /sys/devices/pci0000:00/0000:00:14.0/usb2/2-4/2-4:1.0/net/enx8cae4ce9dc04, iface: enx8cae4ce9dc04)
Aug 09 15:04:25 <computer> NetworkManager[2382]: <info>  [1565388265.0961] device added (path: /sys/devices/pci0000:00/0000:00:14.0/usb2/2-4/2-4:1.0/net/enx8cae4ce9dc04, iface: enx8cae4ce9dc04): no ifupdown configuration found.
Aug 09 15:04:25 <computer> NetworkManager[2382]: <info>  [1565388265.0964] device (enx8cae4ce9dc04): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
Aug 09 15:04:25 <computer> NetworkManager[2382]: <info>  [1565388265.4268] keyfile: add connection in-memory (15600b6f-63ad-37ae-9f6c-2f2e28f05489,"Wired connection 4")
Aug 09 15:04:25 <computer> NetworkManager[2382]: <info>  [1565388265.4272] settings: (enx8cae4ce9dc04): created default wired connection 'Wired connection 4'
Aug 09 15:04:28 <computer> NetworkManager[2382]: <info>  [1565388268.5839] device (enx8cae4ce9dc04): carrier: link connected
Aug 09 15:04:28 <computer> NetworkManager[2382]: <info>  [1565388268.5877] device (enx8cae4ce9dc04): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
Aug 09 15:04:28 <computer> NetworkManager[2382]: <info>  [1565388268.5899] policy: auto-activating connection 'Wired connection 4'
Aug 09 15:04:28 <computer> NetworkManager[2382]: <info>  [1565388268.5926] device (enx8cae4ce9dc04): Activation: starting connection 'Wired connection 4' (15600b6f-63ad-37ae-9f6c-2f2e28f05489)
Aug 09 15:04:28 <computer> NetworkManager[2382]: <info>  [1565388268.5935] device (enx8cae4ce9dc04): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Aug 09 15:04:28 <computer> NetworkManager[2382]: <info>  [1565388268.5949] device (enx8cae4ce9dc04): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Aug 09 15:04:28 <computer> NetworkManager[2382]: <info>  [1565388268.5961] device (enx8cae4ce9dc04): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Aug 09 15:04:28 <computer> NetworkManager[2382]: <info>  [1565388268.5972] dhcp4 (enx8cae4ce9dc04): activation: beginning transaction (timeout in 45 seconds)
Aug 09 15:04:28 <computer> NetworkManager[2382]: <info>  [1565388268.6012] dhcp4 (enx8cae4ce9dc04): dhclient started with pid 25848
Aug 09 15:04:28 <computer> dhclient[25848]: DHCPREQUEST of 10.15.1.104 on enx8cae4ce9dc04 to 255.255.255.255 port 67 (xid=0x46cb0eef)

设备日志中缺少“在内存中创建连接”这一行。我是否缺少一些设置来让网络管理器能够执行此操作?

答案1

我还收到“运营商更改”错误,导致我的以太网连接频繁断开。

我通过将 CAT5 电缆升级为 CAT7 电缆解决了该问题(10米跑)

显然,旧的 CAT5 电缆无法处理我的 ISP 升级后的速度(Virgin Media,英国)。新的 CAT7 电缆不仅阻止了掉线,而且现在允许速度自动从 100Mb/s 配置为 1000Mb/s。希望这对任何想要修复“运营商更改”错误的人有所帮助。

相关内容