Commit

ValdikSS committed 77c859e

Switch from ifupdown to systemd-networkd for network configuration

It seems that ifupdown does not handle hotplug events ('allow-hotplug'
configuration) inside container and does not allow to ignore
missing interface on boot ('auto' configuration), which is not
suitable for this container configuration.

For some reason, in case of failure ifupdown will successfully
configure networking but kills DHCP client, so the network works
only until first IP address renew.

Use systemd-networkd instead. Debian 10 documentation recommends it
as a 'modern' network configuration method, making ifupdown 'legacy'.

Comments (0)

Files changed (5)

File mkosi/mkosi.default Modified

View file
  • Ignore whitespace
  • Hide word diff
 WithNetwork=true
 Packages=bash python3-dnslib ipcalc gawk idn iptables ferm
          openvpn knot-resolver
-         ifupdown isc-dhcp-client inetutils-ping
+         inetutils-ping
          curl wget ca-certificates openssl
          host dnsutils
          bsdmainutils procps

File mkosi/mkosi.extra/etc/network/interfaces Deleted

  • Ignore whitespace
  • Hide word diff
-# This file describes the network interfaces available on your system
-# and how to activate them. For more information, see interfaces(5).
-
-# The loopback network interface
-auto lo
-iface lo inet loopback
-
-auto eth0
-iface eth0 inet dhcp
-
-auto host0
-iface host0 inet dhcp
-
-source /etc/network/interfaces.d/*.cfg

File mkosi/mkosi.extra/etc/systemd/network/eth.network Added

View file
  • Ignore whitespace
  • Hide word diff
+[Match]
+Name=eth*
+
+[Network]
+DHCP=yes

File mkosi/mkosi.extra/etc/systemd/network/host.network Added

View file
  • Ignore whitespace
  • Hide word diff
+[Match]
+Name=host*
+
+[Network]
+DHCP=yes

File mkosi/mkosi.postinst Modified

View file
  • Ignore whitespace
  • Hide word diff
 # host resolv.conf. We don't need that.
 umount /etc/resolv.conf || true
 echo nameserver 127.0.0.1 > /etc/resolv.conf
+
+# Run all needed service on boot
+systemctl enable systemd-networkd