VM host access via network bridge not immediately available after reboot

I have set up bridge on my host system according to the guide /docs/scale/scaletutorials/network/interfaces/settingupbridge/ and it is working fine. I have attached it to the VMs NIC.

Now, when I fully restart the (Debian) VM, all services inside it start normally using systemd, however the network seems to be unavailable at that time.
This causes my NFS mount (and some Docker containers) to fail, e.g.:

  • mount.nfs: Network is unreachable

This only happens on the first startup, when I restart the VM from inside itself using reboot there is no issue.


My current fix for the problem is a service waiting for access to the host system:

[Unit]
Description=Wait until TrueNAS host is reachable
After=network-online.target
Before=mnt-nfs-share.mount docker.service
Wants=network-online.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c "until ping -c1 -W1 10.1.0.156; do sleep 2; done"
RemainAfterExit=yes
TimeoutStartSec=120

[Install]
WantedBy=multi-user.target

However that feels wrong :thinking:

What’s also interesting is that it takes 26s until it actually reaches the host:

root@truenas-container-vm:~# systemd-analyze blame
26.051s network-wait-truenas.service
 7.044s docker.service
  705ms systemd-random-seed.service
  692ms systemd-binfmt.service
  353ms mnt-nfs-share.mount

Am I missing something here? How can I make the bridge immediately available?

Version: ElectricEel-24.10.2

I believe the delay is caused by the bridge having the spanning tree algorithm enabled.

It can be disabled