webdevqa.jp.net

networkdが起動時にeth0を起動しない

私はギガバイトbrixプロにDebian 8をインストールしましたが、ネットワークを除いてすべてが正しく動作しているようです。

systemd-networkd.serviceを有効にし、networking.serviceを無効にし、/etc/systemd/networkに適切なnetworkファイルを作成しました。ワイヤレスアダプターもwpasupplicantを構成して有効にしました。

システムが起動すると、wlan0.networkファイルが見つかり、インターフェースが起動し、リンクが検出されて完全に機能しますが、何らかの理由で、作成したeth0.networkファイルが表示されません(または記録されません)。リンクを検出せず、eth0をまったく立ち上げません。

システムが完全に起動した後、systemctl restart systemd-networkd.serviceまたはifup eth0を実行すると、インターフェイスが起動し、正常に機能する時点で適切に構成されます。起動時に起動しません。

/ etc/systemd/network/wlan0.network

[Match]
Name=wlan0

[Network]
Address=192.168.1.21/24
DNS=192.168.1.1

/ etc/systemd/network/eth0.network

[Match]
Name=eth0

[Network]
Address=192.168.1.10/24
Gateway=192.168.1.1
DNS=192.168.1.1

IPリンク

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether fc:aa:14:db:cf:40 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether dc:85:de:ee:96:af brd ff:ff:ff:ff:ff:ff

lspci -v

03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
        Subsystem: Gigabyte Technology Co., Ltd Motherboard
        Flags: bus master, fast devsel, latency 0, IRQ 43
        I/O ports at d000 [size=256]
        Memory at f7c00000 (64-bit, non-prefetchable) [size=4K]
        Memory at f0000000 (64-bit, prefetchable) [size=16K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable- Count=4 Masked-
        Capabilities: [d0] Vital Product Data
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Virtual Channel
        Capabilities: [160] Device Serial Number 01-00-00-00-68-4c-e0-00
        Capabilities: [170] Latency Tolerance Reporting
        Kernel driver in use: r8168

journalctl

kernel: r8168 Gigabit Ethernet driver 8.040.00-NAPI loaded
kernel: r8168 0000:03:00.0: irq 43 for MSI/MSI-X

...

kernel: r8168: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
kernel: r8168  Copyright (C) 2015  Realtek NIC software team <[email protected]>
                    This program comes with ABSOLUTELY NO WARRANTY; for details, please see <http://www.gnu.org/licenses/>.
                    This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/>.

...

systemd-networkd[456]: wlan0           : link 3 added
systemd-networkd[456]: wlan0           : udev initialized link
systemd-networkd[456]: wlan0           : flags change: +UP +RUNNING +MULTICAST +BROADCAST
systemd-networkd[456]: wlan0           : flags change: -RUNNING
systemd-networkd[456]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus object=/org/freedesktop/DBus interface=org.freedesktop.DBus member=H
systemd-networkd[456]: sd-rtnl: discarding 20 bytes of incoming message
systemd-networkd[456]: wlan0           : link state is up-to-date
systemd-networkd[456]: wlan0           : found matching network '/etc/systemd/network/wlan0.network'
systemd-networkd[456]: wlan0           : enslaved
systemd-networkd[456]: wlan0           : setting addresses
systemd-networkd[456]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.2 object=n/a interface=n/a member=n/a cookie=1 reply_cookie=1 error=
systemd-networkd[456]: Got message type=signal sender=org.freedesktop.DBus destination=:1.2 object=/org/freedesktop/DBus interface=org.freedesktop.DBus member=NameAc
systemd-networkd[456]: sd-rtnl: discarding 20 bytes of incoming message
systemd-networkd[456]: rtnl: received address for a nonexistent link, ignoring
systemd-networkd[456]: rtnl: received address for a nonexistent link, ignoring
systemd-networkd[456]: wlan0           : added address: 192.168.1.21/24
systemd-networkd[456]: wlan0           : addresses set
systemd-networkd[456]: wlan0           : link configured

systemctl status systemd-networkd.service(from boot)

systemd-networkd[456]: sd-rtnl: discarding 20 bytes of incoming message
systemd-networkd[456]: rtnl: received address for a nonexistent link, ignoring
systemd-networkd[456]: rtnl: received address for a nonexistent link, ignoring
systemd-networkd[456]: wlan0           : added address: 192.168.1.21/24
systemd-networkd[456]: wlan0           : addresses set
systemd-networkd[456]: wlan0           : link configured
systemd-networkd[456]: wlan0           : flags change: +LOWER_UP
systemd-networkd[456]: wlan0           : flags change: +RUNNING
systemd-networkd[456]: wlan0           : gained carrier
systemd-networkd[456]: wlan0           : added address: fe80::de85:deff:feee:96af/64

systemctl status systemd-networkd.service(networkdの再起動後)

systemd-networkd[877]: wlan0           : link configured
systemd-networkd[877]: eth0            : flags change: +UP
systemd-networkd[877]: eth0            : added address: 192.168.1.10/24
systemd-networkd[877]: eth0            : addresses set
systemd-networkd[877]: eth0            : setting routes
systemd-networkd[877]: eth0            : routes set
systemd-networkd[877]: eth0            : link configured
systemd-networkd[877]: eth0            : flags change: +LOWER_UP +RUNNING
systemd-networkd[877]: eth0            : gained carrier
systemd-networkd[877]: eth0            : added address: fe80::feaa:14ff:fedb:cf40/64

これに対する解決策を見つけるために、他にどのような情報を提供する必要がありますか?

[〜#〜]更新[〜#〜]

次の行を/etc/network/interfacesに追加し、networking.serviceを有効にすると問題が修正され、すべてが起動時に表示されますが、古いinit.dシステムは使用しません。新しいsystemd-networkdを使用したいのですが、その環境でこれが発生している理由を知りたいのですが。

auto eth0
iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    gateway 192.168.1.1

[〜#〜]編集[〜#〜]

wpa_supplicant.serviceは、私がそれを無効にしたため欠落しており、networking.serviceは、現在機能している唯一のものであるため、有効になっています。

systemctl -t service

UNIT                                            LOAD   ACTIVE SUB     DESCRIPTION
acpid.service                                   loaded active running ACPI event daemon
atd.service                                     loaded active running Deferred execution scheduler
console-setup.service                           loaded active exited  LSB: Set console font and keymap
cron.service                                    loaded active running Regular background program processing daemon
dbus.service                                    loaded active running D-Bus System Message Bus
exim4.service                                   loaded active running LSB: exim Mail Transport Agent
[email protected]                              loaded active running Getty on tty1
kbd.service                                     loaded active exited  LSB: Prepare console
keyboard-setup.service                          loaded active exited  LSB: Set preliminary keymap
kmod-static-nodes.service                       loaded active exited  Create list of required static device nodes for the current kernel
lm-sensors.service                              loaded active exited  Initialize hardware monitoring sensors
networking.service                              loaded active exited  LSB: Raise network interfaces.
nfs-common.service                              loaded active exited  LSB: NFS support files common to client and server
rc-local.service                                loaded active exited  /etc/rc.local Compatibility
rpcbind.service                                 loaded active running LSB: RPC portmapper replacement
rsyslog.service                                 loaded active running System Logging Service
ssh.service                                     loaded active running OpenBSD Secure Shell server
[email protected]:acpi_video0.service loaded active exited  Load/Save Screen Backlight Brightness of backlight:acpi_video0
systemd-journald.service                        loaded active running Journal Service
systemd-logind.service                          loaded active running Login Service
systemd-modules-load.service                    loaded active exited  Load Kernel Modules
systemd-networkd.service                        loaded active running Network Service
systemd-random-seed.service                     loaded active exited  Load/Save Random Seed
systemd-remount-fs.service                      loaded active exited  Remount Root and Kernel File Systems
systemd-resolved.service                        loaded active running Network Name Resolution
[email protected]                  loaded active exited  Load/Save RF Kill Switch Status of rfkill0
systemd-setup-dgram-qlen.service                loaded active exited  Increase datagram queue length
systemd-sysctl.service                          loaded active exited  Apply Kernel Variables
systemd-tmpfiles-setup-dev.service              loaded active exited  Create Static Device Nodes in /dev
systemd-tmpfiles-setup.service                  loaded active exited  Create Volatile Files and Directories
systemd-udev-trigger.service                    loaded active exited  udev Coldplug all Devices
systemd-udevd.service                           loaded active running udev Kernel Device Manager
systemd-update-utmp.service                     loaded active exited  Update UTMP about System Boot/Shutdown
systemd-user-sessions.service                   loaded active exited  Permit User Sessions
udev-finish.service                             loaded active exited  Copy rules generated while the root was ro
5
vane

スタンザを/etc/networking/interfacesに追加すると問題が解決するのは、networking.serviceが有効になっているためです。 networking.serviceファイルを見ると、次のように表示されます(一部編集されています)。

[Unit]
SourcePath=/etc/init.d/networking
Description=LSB: Raise network interfaces.
.....
[Service]
.....
ExecStart=/etc/init.d/networking start
ExecStop=/etc/init.d/networking stop
ExecReload=/etc/init.d/networking reload

これは、これが避けたい古いSysVスクリプトとの互換性を提供するサービスであることを明確に示しています。

これはどこにも明確に記載されていませんが(私が見つけた可能性があります!)、SysVとの互換性はありませんが、まったく同じサービスを提供できるsystemd-networkd.serviceと競合すると思います。

したがって、私の推測では、networkingを無効にし、再起動してこれが(唯一の)ソリューションであることを確認します。

4
MariusMatutiae

ここで同様の症状。

ログbr0: DHCPv6 lease lostで不審になりました:

[email protected]:/home/bue# systemctl status systemd-networkd
● systemd-networkd.service - Network Service
   Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2019-03-08 09:02:14 UTC; 2min 42s ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 906 (systemd-network)
   Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/systemd-networkd.service
           └─906 /lib/systemd/systemd-networkd

Mar 08 09:02:22 lorank8 systemd-networkd[906]: br0: Lost carrier
Mar 08 09:02:22 lorank8 systemd-networkd[906]: br0: DHCPv6 lease lost
Mar 08 09:02:27 lorank8 systemd-networkd[906]: eth0: Gained IPv6LL
Mar 08 09:02:30 lorank8 systemd-networkd[906]: usb0: Gained carrier
Mar 08 09:02:30 lorank8 systemd-networkd[906]: usb1: Gained carrier
Mar 08 09:02:31 lorank8 systemd-networkd[906]: usb0: Gained IPv6LL
Mar 08 09:02:31 lorank8 systemd-networkd[906]: usb1: Gained IPv6LL

connman.serviceがsystemd-networkdに干渉しました

Connmanを無効にした後、bridgeとeth0が期待通りに起動しました。

0
bue