linux arch:systemd-networkd-重启后接口未启动

linux arch:systemd-networkd-重启后接口未启动

我尝试从 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
[email protected]                       disabled
[email protected]                    disabled
netctl-sleep.service                       disabled
netctl.service                             enabled
[email protected]                            static
[email protected]                      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

问候

答案1

在我的 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

因此,尝试在网络部分设置网关指令。

相关内容