When I use ifupdown, I wrote a script in if-up.d and use $IFACE to detect the name of the device affected.

Now I turn to netplan in Ubuntu Server 18.04. 2 questions need to be solved:

1 Where to put the command to run the script? https://netplan.io/faq says there should be placed in /etc/networkd-dispatcher/routable.d/50-ifup-hooks. Only this file name is allowed? Actually, no such a directory in my instance at all.

2 How to detect the affected device name?


up vote 1 down vote accepted

As described in /usr/share/doc/networkd-dispatcher/README.md.gz, the device name is passed in the IFACE environment variable, the same as is used for if-up.d.

This document also describes the naming requirements of network-dispatcher hook scripts.

Please note that as of Ubuntu 18.04, networkd-dispatcher only supports reading its hooks from /usr/lib/networkd-dispatcher, not from /etc/networkd-dispatcher. (This is a bug in the netplan.io website; but the correct fix is for the package to gain support for /etc/networkd-dispatcher.)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.