systemctl 状态 systemd-networkd 显示为死亡

systemctl 状态 systemd-networkd 显示为死亡

我正在进行 Debian 测试/strech。我在看debian 用户可以通过 systemd-networkd 连接到网络吗? 并做了同样的事情。

[$] cat /etc/systemd/network/wired.network

[Match]
Name=eth0

[Network]
DHCP=ipv4
DNS=8.8.8.8
DNS=8.8.4.4

[DHCP]
RouteMetric=10%   


[$] sudo systemctl start systemd-resolved

[$] sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

[$] sudo systemctl enable systemd-networkd systemd-resolved

Created symlink /etc/systemd/system/multi-user.target.wants/systemd-networkd.service → /lib/systemd/system/systemd-networkd.service.
Created symlink /etc/systemd/system/sockets.target.wants/systemd-networkd.socket → /lib/systemd/system/systemd-networkd.socket.
Created symlink /etc/systemd/system/multi-user.target.wants/systemd-resolved.service → /lib/systemd/system/systemd-resolved.service.

[$] sudo mv /etc/xdg/autostart/nm-applet.desktop /etc/xdg/autostart/nm-applet-desktop

最后——

[$] sudo systemctl status systemd-networkd

● systemd-networkd.service - Network Service
   Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd-networkd.service(8)

知道这里出了什么问题吗?为什么 systemd-networkd.service 显示为死亡?

更新 - 重新启动系统并不得不 -

$ sudo ifdown eth0

进而 -

$ sudo ifup eth0

然后这两件事就完美地展现出来了——

[$] sudo systemctl status systemd-networkd

[sudo] password for shirish: 
● systemd-networkd.service - Network Service
   Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2016-11-07 20:44:52 IST; 5min ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 764 (systemd-network)
   Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/systemd-networkd.service
           └─764 /lib/systemd/systemd-networkd


[$] sudo systemctl status systemd-resolved

● systemd-resolved.service - Network Name Resolution
   Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/systemd-resolved.service.d
           └─resolvconf.conf
   Active: active (running) since Mon 2016-11-07 20:44:54 IST; 5min ago
     Docs: man:systemd-resolved.service(8)
           http://www.freedesktop.org/wiki/Software/systemd/resolved
           http://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
           http://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
  Process: 962 ExecStartPost=/bin/sh -c [ ! -e /run/resolvconf/enable-updates ] || echo "nameserver 127.0.0.53" | /sbin/resolvconf -a systemd-re
 Main PID: 896 (systemd-resolve)
   Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/systemd-resolved.service
           └─896 /lib/systemd/systemd-resolved

我想这已经成功了。该系统是一个过时的工作站,因此主板上没有无线网络芯片,芯片本身也没有支持,因此没有做任何事情wpa_supplicant

答案1

编辑文件:/etc/systemd/resolved.conf

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
#DNS= ajouter votre nom de domaine ici
#FallbackDNS= votre ip
#Domains= votre domaine
#LLMNR=yes
#DNSSEC=no

然后输入:

$ systemctl start  systemd-resolved.service 
$ systemctl status systemd-networkd systemd-resolved

相关内容