Arch-Linux

linux arch:systemd-networkd - 重新啟動後介面未啟動

  • March 25, 2017

我試圖從 netctl 遷移到 systemd-networkd,但沒有成功。當我重新啟動服務 systemd-networkd 我得到:

systemctl status systemd-networkd
● systemd-networkd.service - Network Service
  Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
  Active: active (running) since Thu 2017-03-23 12:42:34 CET; 16min ago
    Docs: man:systemd-networkd.service(8)
Main PID: 1176 (systemd-network)
  Status: "Processing requests..."
  CGroup: /system.slice/systemd-networkd.service
          └─1176 /usr/lib/systemd/systemd-networkd

Mar 23 12:42:33 alarm systemd[1]: Starting Network Service...
Mar 23 12:42:34 alarm systemd-networkd[1176]: Enumeration completed
Mar 23 12:42:34 alarm systemd[1]: Started Network Service.
Mar 23 12:42:34 alarm systemd-networkd[1176]: **eth0: Could not set route: Invalid argument**

/etc/systemd/network 下的文件 eth0.service:

more /etc/systemd/network/eth0.network
[Match]
Name=eth0
[Network]
Address=192.168.1.99/24
DNS=8.8.8.8
[Route]
Gateway=192.168.1.1

此外,重新啟動後,介面 eth0 和 enp1s0 已關閉,但 loopback 和 tun0 已啟動。

據我所知,網關已在文件 eth0.network 中正確設置。什麼地方出了錯 ?有什麼想法可以做什麼以及為什麼重啟後 eth0 會關閉?如果您有任何想法,請告訴我。在閱讀了 3 天的網際網路並尋找解決方案後,我一無所知。

問候

更多資訊輸出:

systemctl list-unit-files | grep netctl
netctl-auto@.service                       disabled
netctl-ifplugd@.service                    disabled
netctl-sleep.service                       disabled
netctl.service                             enabled
netctl@.service                            static
netctl@enp1s0.service                      static
netctl@my_static_profile.service           static

systemctl list-unit-files | grep networkd
systemd-networkd-wait-online.service       disabled
systemd-networkd.service                   enabled
systemd-networkd.socket                    enabled

問候

在我的 Fedora 筆記型電腦的 man 5 systemd.network 中,我可以閱讀此內容(範例部分):

Wired adapter using a static IP

/etc/systemd/network/25-wired.network

[Match]
Name=enp1s0

[Network]
Address=10.1.10.9/24
Gateway=10.1.10.1

所以嘗試在網路部分設置網關指令。

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