如何查找谁在设置接口?

如何查找谁在设置接口?

我有一台装有 ubuntu 20.04 的计算机,有两个 LAN 端口。我希望左边的端口为 eth0,另一个为 eth1。因此我编写了一个 udev 规则

SUBSYSTEM=="net", ACTION=="add",  ATTR{address}=="<mac left>", NAME:="eth0"

并将其置于/etc/udev/rules.d/10-eth0.rules然后我期望重命名会在我重新启动时发生...但是重新启动后 eth0 和 eth1 仍然交换并且 journalctl 告诉我:

eth1: Failed to rename network interface 3 from 'eth1' to 'eth0': File exists
eth1: Failed to process device, ignoring: File exists

所以似乎在 udev 运行之前就设置了接口名称?过去几天我一直在谷歌上搜索原因,但找不到任何适用的东西。建议检查“sysconfig”,当然它不存在于 ubuntu 中,或者检查 NetworkManager,我没有安装它。我也没有安装 netplan,但我有 ifupdown。Ifupdown 应该使用/etc/网络/接口文件进行配置,但只有界面。

有没有办法检查谁在设置接口以及为什么在 udev 启动之前会发生这种情况?

相关内容