Netplan does not support any pre/post-up/down hooks on its own, but is referring to a mapping table from ifupdown to its two backend renderers “NetworkManager-dispatcher” and “networkd-dispatcher”, which we are currently updating to better explain the details, pitfalls and differences: https://github.com/canonical/netplan.io/pull/245
It’s not a 1:1 mapping, as the three hook dispatchers behave slightly differently, especially wrt. Networkd-dispatcher being a pure listener, running hook scripts asynchronous, whereas ENI and NM handle the hook scripts natively and allow them to interject the interface configuration process.
Also, systemd-networkd does not keep an internal state (in contrast to ENI & NM) but relies on the kernel’s netlink state, thus uses different stages and cannot implement a “pre-down” hook at all.
Unfortunately, this is the best we can do for now, without requiring upstream changes to systemd, inroducing a possibility to block network configuration, controlled by external hooks, which the systemd devs want to avoid, due to performance concerns.
Netplan does not support any pre/post-up/down hooks on its own, but is referring to a mapping table from ifupdown to its two backend renderers “NetworkManager -dispatcher” and “networkd- dispatcher” , which we are currently updating to better explain the details, pitfalls and differences: https:/ /github. com/canonical/ netplan. io/pull/ 245
It’s not a 1:1 mapping, as the three hook dispatchers behave slightly differently, especially wrt. Networkd-dispatcher being a pure listener, running hook scripts asynchronous, whereas ENI and NM handle the hook scripts natively and allow them to interject the interface configuration process.
Also, systemd-networkd does not keep an internal state (in contrast to ENI & NM) but relies on the kernel’s netlink state, thus uses different stages and cannot implement a “pre-down” hook at all.
Unfortunately, this is the best we can do for now, without requiring upstream changes to systemd, inroducing a possibility to block network configuration, controlled by external hooks, which the systemd devs want to avoid, due to performance concerns.