[systemd-devel] systemd-networkd: bring-up interfaces

Daniel Gomez daniel at qtec.com
Thu Oct 21 14:50:41 UTC 2021


Hi,

I hope this is the right place to post this question.

We are trying to speed up the network configuration and we've noticed
the systemd-networkd takes a while before it finalizes to set up the
DHCP (ipv4) configuration on port 'eth0'. After some debugging, we
think the reason is that the network interface hasn't been brought up
when it was ready/available. Is that intended?

It seems that systemd-networkd starts too late in the process and it
first needs to bring up the interface before configuring the dhcp
client on that port. In order to speed this process up we have enabled
a service that brings the interface up as soon as it's ready:

- Linux traces loading the driver interfaces 'eth0' and 'eth1':

Oct 21 14:00:06 qt5222 kernel[302]: [    0.406772] igb 0000:03:00.0:
added PHC on eth0
Oct 21 14:00:06 qt5222 kernel[302]: [    0.406776] igb 0000:03:00.0:
Intel(R) Gigabit Ethernet Network Connection
Oct 21 14:00:06 qt5222 kernel[302]: [    0.406772] igb 0000:03:00.0:
added PHC on eth0
Oct 21 14:00:06 qt5222 kernel[302]: [    0.406776] igb 0000:03:00.0:
Intel(R) Gigabit Ethernet Network Connection
Oct 21 14:00:06 qt5222 kernel[302]: [    0.406778] igb 0000:03:00.0:
eth0: (PCIe:2.5Gb/s:Width x1) 70:b3:d5:c7:4a:18
Oct 21 14:00:06 qt5222 kernel[302]: [    0.406873] igb 0000:03:00.0:
eth0: PBA No: 000300-000
Oct 21 14:00:06 qt5222 kernel[302]: [    0.406874] igb 0000:03:00.0:
Using MSI-X interrupts. 4 rx queue(s), 4 tx queue(s)
Oct 21 14:00:06 qt5222 kernel[302]: [    0.436597] pps pps1: new PPS source ptp1
Oct 21 14:00:06 qt5222 kernel[302]: [    0.436650] igb 0000:04:00.0:
added PHC on eth1
Oct 21 14:00:06 qt5222 kernel[302]: [    0.436651] igb 0000:04:00.0:
Intel(R) Gigabit Ethernet Network Connection
Oct 21 14:00:06 qt5222 kernel[302]: [    0.436652] igb 0000:04:00.0:
eth1: (PCIe:2.5Gb/s:Width x1) 70:b3:d5:c7:4a:19
Oct 21 14:00:06 qt5222 kernel[302]: [    0.436746] igb 0000:04:00.0:
eth1: PBA No: 000300-000
Oct 21 14:00:06 qt5222 kernel[302]: [    0.436748] igb 0000:04:00.0:
Using MSI-X interrupts. 4 rx queue(s), 4 tx queue(s)

- ifup.service created:

root at qt5222:~# cat /lib/systemd/system/ifup.service
[Unit]
Description=eth0 up
Before=network-pre.target
Wants=network-pre.target

[Service]
Type=oneshot
ExecStart=/sbin/ip link set dev eth0 up
ExecReload=/sbin/ip link set dev eth0 up
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

- ifup.service in action:

Oct 21 14:00:06 qt5222 systemd[1]: Starting eth0 up...
-- Subject: A start job for unit ifup.service has begun execution
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- A start job for unit ifup.service has begun execution.
-- 
-- The job identifier is 99.

- DHCP configuration:

root at qt5222:~# cat /lib/systemd/network/80-dhcp.network
[Match]
Name=eth0

[Network]
DHCP=yes

[DHCP]
ClientIdentifier=mac
CriticalConnection=true

After adding ifup.service we've noticed the network is configured ~10s
earlier. The questions are:
- Is systemd-networkd supposed to bring up network interfaces? If
true, shouldn't I be doing it when the interfaces are ready (earlier)?
Here the systemd-networkd configuration:

# systemd-udevd.service can be dropped once tuntap is moved to netlink
After=systemd-udevd.service network-pre.target
systemd-sysusers.service systemd-sysctl.service
Before=network.target multi-user.target shutdown.target
Conflicts=shutdown.target
Wants=network.target

- If systemd-networkd can't be moved earlier in the boot process, is
there any standard service to bring up the interfaces as soon as they
are available?

Thanks,
Daniel

systemd version:

root at qt5222:~# systemctl --version
systemd 244 (244.5+)
-PAM -AUDIT -SELINUX +IMA -APPARMOR -SMACK +SYSVINIT +UTMP
-LIBCRYPTSETUP -GCRYPT -GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS
+KMOD -IDN2 -IDN -PCRE2 default-hierarchy=hybrid


More information about the systemd-devel mailing list