Networking

我的網路介面更改了名稱,因此 DHCP / dhclient 無法對其進行操作

  • May 18, 2021

在一些 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 dhclient@enp111s0.service

更多日誌:

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]: dhclient@enp111s0.service: Main process exited, code=exited, status=1/FAILURE
May 14 19:03:32 serverski systemd[1]: dhclient@enp111s0.service: 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

針對我自己的問題發布解決方法。

在遇到dhclient(這個問題)以及其他問題dhcpcd(我沒有完全深入了解,但簡單地切換到dhclient作為替代品解決了它們,因為你需要這樣做systemctl enable dhclient@iface.service)之後,我得出的結論是最好和最乾淨的,放棄兩者dhclientdhcpcd支持systemd-networkd,可以輕鬆配置為處理 DHCP,請參見此處,無需額外的軟體包。

在邏輯上使用systemd-networkd自己的 DHCP 處理將解決命名問題,因為我相信它與執行介面重命名的 systemd 組件相同。

引用自:https://serverfault.com/questions/1063595