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.

** Changed in: netplan
       Status: New => Fix Committed

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1664818

Title:
  Not possible to render pre-up, pre-down, post-up, or post-down
  snippets

Status in netplan:
  Fix Committed
Status in systemd package in Ubuntu:
  Triaged

Bug description:
  Many configurations require scripts to run before or after an
  interface comes up or down.

  Example: I had a situation where I needed to render a post-up script
  to monitor an interface with ifupdown (and with the interface set to
  manual mode, because if the link was down I didn't want to require
  DHCP to run before the system continued booting). This is similar to
  what NetworkManager does in order to launch (or kill) a DHCP client.

  Other use cases involve setting up custom routes (such as when complex
  logic involving metrics or source routing is required) or anything
  else the designers of the netplan rendering engine didn't think of,
  such as invoking workarounds or special settings required for a
  particular NIC or environment, iptables rules that should be added or
  removed, etc.

  A follow-on issue is, it should be possible to ask that custom scripts
  run if the *link* is detected to come up or down. But I'll be happy if
  netplan first can simply replicate the custom-script-invoking behavior
  of ifupdown.

To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/1664818/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to