我的网络接口更改了名称,因此 DHCP/dhclient 无法在其上进行操作

我的网络接口更改了名称,因此 DHCP/dhclient 无法在其上进行操作

在一些 ArchLinux 服务器上,我已从 切换到dhcpcddhclient但服务器未接收 IP。通过检查,journalctl我发现,在所有未收到 IP 的情况下,dhclient尝试在接口上进行操作,并且然后接口已重命名。有问题的行是:

dhclient[461]: Failed to get interface index: No such device
...
kernel: igc 0000:6f:00.0 enp111s0: renamed from eth1

这个“接口重命名”业务是什么?它怎么可能dhclient不是按照可预测的顺序排列的?

当然,稍后以下命令可以修复 DHCP:

sudo systemctl restart [email protected]

更多日志:

May 14 19:03:32 serverski systemd[1]: Reached target Multi-User System.
May 14 19:03:32 serverski systemd[1]: Reached target Graphical Interface.
May 14 19:03:32 serverski dhclient[487]: Cannot find device "enp111s0"
May 14 19:03:32 serverski dhclient[461]: Failed to get interface index: No such device
May 14 19:03:32 serverski dhclient[461]: Failed to get interface index: No such device
May 14 19:03:32 serverski dhclient[461]: If you think you have received this message due to a bug rather
May 14 19:03:32 serverski dhclient[461]: than a configuration issue please read the section on submitting
May 14 19:03:32 serverski dhclient[461]: bugs on either our web page at www.isc.org or in the README file
May 14 19:03:32 serverski dhclient[461]: before submitting a bug.  These pages explain the proper
May 14 19:03:32 serverski dhclient[461]: process and the information we find helpful for debugging.
May 14 19:03:32 serverski dhclient[461]: exiting.
May 14 19:03:32 serverski dhclient[461]: 
May 14 19:03:32 serverski dhclient[461]: If you think you have received this message due to a bug rather
May 14 19:03:32 serverski dhclient[461]: than a configuration issue please read the section on submitting
May 14 19:03:32 serverski dhclient[461]: bugs on either our web page at www.isc.org or in the README file
May 14 19:03:32 serverski dhclient[461]: before submitting a bug.  These pages explain the proper
May 14 19:03:32 serverski dhclient[461]: process and the information we find helpful for debugging.
May 14 19:03:32 serverski dhclient[461]: 
May 14 19:03:32 serverski dhclient[461]: exiting.
May 14 19:03:32 serverski systemd-udevd[380]: ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable.
May 14 19:03:32 serverski systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
May 14 19:03:32 serverski systemd[1]: [email protected]: Failed with result 'exit-code'.
May 14 19:03:32 serverski audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=dhclient@enp111s0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=fail>
May 14 19:03:32 serverski systemd-udevd[427]: Using default interface naming scheme 'v247'.
May 14 19:03:32 serverski systemd-udevd[427]: ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable.
May 14 19:03:32 serverski kernel: r8169 0000:70:00.1 enp112s0f1: renamed from eth0
May 14 19:03:32 serverski kernel: iTCO_vendor_support: vendor-support=0
May 14 19:03:32 serverski systemd-udevd[382]: Using default interface naming scheme 'v247'.
May 14 19:03:32 serverski systemd-udevd[382]: ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable.
May 14 19:03:32 serverski kernel: ee1004 0-0051: 512 byte EE1004-compliant SPD EEPROM, read-only
May 14 19:03:32 serverski kernel: ee1004 0-0053: 512 byte EE1004-compliant SPD EEPROM, read-only
May 14 19:03:32 serverski kernel: igc 0000:6f:00.0 enp111s0: renamed from eth1

答案1

发布针对我自己的问题的解决方法。

在遇到dhclient(这个问题)以及其他问题dhcpcd(我没有完全弄明白,但只需切换到dhclient作为替代品就可以解决它们,因为对于两者,您只需要),我得出的结论是最好和最干净的,放弃和转而使用,可以轻松配置它来处理 DHCP,请参阅systemctl enable [email protected]dhclientdhcpcdsystemd-networkd这里,无需额外的包裹。

从逻辑上讲,使用systemd-networkd自己的 DHCP 处理可以解决命名问题,因为我相信它是执行接口重命名的相同 systemd 组件。

相关内容