debian – How to make systemd network-online.target wait for multiple networks?

We have an ESXi virtual machine running Debian 10 and are encountering a problem with postfix starting too early. This is causing issues with resolv.conf not being populated before the postfix chroot. I’ve ensured that both

  • /lib/systemd/system/postfix.service
  • /lib/systemd/system/postfix@.service

files have the line

After=network-online.target nss-lookup.target

However we have multiple nics installed in this VM, with the /etc/network/interfaces file containing

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens192
iface ens192 inet static
        address 10.1.0.29/21
        dns-nameservers 10.1.0.20 10.1.0.23 

# The secondary network interface
allow-hotplug ens224
iface ens224 inet static
        address 192.168.1.8/24
        gateway 192.168.1.240

When I run

grep -E "(Postfix Mail Transport Agent|e1000|Link is Up|link is not ready|link becomes ready|resolv.conf differ|target)" /var/log/syslog

I see that network-online.target only waits for one of the nics to be online.

Jan 12 18:46:54 assp0 kernel: (    1.738897) e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
Jan 12 18:46:54 assp0 kernel: (    1.738897) e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
Jan 12 18:46:54 assp0 kernel: (    1.739922) e1000e 0000:0b:00.0: Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode
Jan 12 18:46:54 assp0 kernel: (    1.795419) e1000e 0000:0b:00.0 0000:0b:00.0 (uninitialized): registered PHC clock
Jan 12 18:46:54 assp0 kernel: (    1.859484) e1000e 0000:0b:00.0 eth0: (PCI Express:2.5GT/s:Width x1)
Jan 12 18:46:54 assp0 kernel: (    1.859486) e1000e 0000:0b:00.0 eth0: Intel(R) PRO/1000 Network Connection
Jan 12 18:46:54 assp0 kernel: (    1.859558) e1000e 0000:0b:00.0 eth0: MAC: 3, PHY: 8, PBA No: 000000-000
Jan 12 18:46:54 assp0 kernel: (    1.860245) e1000e 0000:13:00.0: Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode
Jan 12 18:46:54 assp0 kernel: (    1.915403) e1000e 0000:13:00.0 0000:13:00.0 (uninitialized): registered PHC clock
Jan 12 18:46:54 assp0 kernel: (    1.979239) e1000e 0000:13:00.0 eth1: (PCI Express:2.5GT/s:Width x1)
Jan 12 18:46:54 assp0 kernel: (    1.979240) e1000e 0000:13:00.0 eth1: Intel(R) PRO/1000 Network Connection
Jan 12 18:46:54 assp0 kernel: (    1.979290) e1000e 0000:13:00.0 eth1: MAC: 3, PHY: 8, PBA No: 000000-000
Jan 12 18:46:54 assp0 kernel: (    1.981312) e1000e 0000:0b:00.0 ens192: renamed from eth0
Jan 12 18:46:54 assp0 kernel: (    1.994070) e1000e 0000:13:00.0 ens224: renamed from eth1
Jan 12 18:46:54 assp0 kernel: (    4.577652) IPv6: ADDRCONF(NETDEV_UP): ens224: link is not ready
Jan 12 18:46:54 assp0 kernel: (    4.583595) e1000e: ens224 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
Jan 12 18:46:54 assp0 systemd(1): Reached target Swap.
Jan 12 18:46:54 assp0 systemd(1): Reached target System Initialization.
Jan 12 18:46:54 assp0 systemd(1): Reached target Sockets.
Jan 12 18:46:54 assp0 systemd(1): Reached target Basic System.
Jan 12 18:46:54 assp0 systemd(1): Reached target Timers.
Jan 12 18:46:54 assp0 systemd(1): Reached target Network.
Jan 12 18:46:54 assp0 systemd(1): Reached target Network is Online.
Jan 12 18:46:54 assp0 systemd(1): Starting Postfix Mail Transport Agent (instance -)...
Jan 12 18:46:54 assp0 systemd(1): Reached target Login Prompts.
Jan 12 18:46:54 assp0 kernel: (    4.671007) IPv6: ADDRCONF(NETDEV_UP): ens192: link is not ready
Jan 12 18:46:54 assp0 kernel: (    4.671206) IPv6: ADDRCONF(NETDEV_CHANGE): ens224: link becomes ready
Jan 12 18:46:54 assp0 kernel: (    4.675749) e1000e: ens192 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
Jan 12 18:46:54 assp0 kernel: (    4.676553) IPv6: ADDRCONF(NETDEV_CHANGE): ens192: link becomes ready
Jan 12 18:46:55 assp0 postfix/postfix-script(750): warning: /var/spool/postfix/etc/resolv.conf and /etc/resolv.conf differ

I thought there was something you could write in the network config to indicate that connection was required before the OS would consider the network to be up, but I can’t seem to find that info.

Before I cludge together something that works enough for us, I would like to know how to make network-online.target wait for either all nics, or preferably, the ones I specify.