[systemd-devel] Custom options and passing options via command line.
Lennart Poettering
lennart at poettering.net
Mon May 9 13:51:42 UTC 2022
On So, 08.05.22 19:19, Kamil Jońca (kjonca at op.pl) wrote:
> I have question about custom options in network interface definitions
> and passing it via command line.
> In currend Debian tools
>
> (https://manpages.debian.org/buster/ifupdown/interfaces.5.en.html)
> there is a possibility to define custom option and passing it to up/down
> script (see ENVIRONMENT VARIABLES section)
> Is it possible in *.network files?
We do not support call-outs in networkd, for security and robustness
reasons. In almost all cases callouts end up being used to hook
higher-level stuff into lower-level components, which then
synchronously block on it, which is just the wrong way.
So usually our approach is to figure out what people actually hook
into this, and find better solutions.
> Moreover: can I pass option during interface up/down?
> For example, in my if-up*/if-down* scripts I have code for replacing (or
> not!) default route when needed.[1]
You can have multiple default routes, thus normally you'd install them
all in parallel, and then configure a route metric on each to declare
which one shall win if multiple are in effect.
In networkd you can configure the route metric via Metric= in the
[Route] section. If the routes are acquired through dhcp, you can set
the metric to use in the [DHCPv4] section in the RouteMetric= setting,
and so on.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list