[systemd-devel] Custom options and passing options via command line.

Lennart Poettering lennart at poettering.net
Mon May 9 15:03:10 UTC 2022


On Mo, 09.05.22 16:13, Kamil Jońca (kjonca at op.pl) wrote:

> >> (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.
>
> Hm. What is the network dispatcher then?

Do you mean networkd-dispatcher? That's an Ubuntu thing. It does not
exist upstream. Maintained by different people, unrelated to the
systemd project.

> > So usually our approach is to figure out what people actually hook
> > into this, and find better solutions.
>
> I am afraid you will not cover all cases with networking.

Well, I am not sure. I am pretty sure there are almost always better
ways to fix the issues that people address with network callout stuff.

> > 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.
>
> But sometimes I want to "override" default route, i.e. I have two
> interfaces configured by DHCP and I want to "force" use particular
> interface. Is this possible via cli? Or I have to deal with creating
> and removing files and "daemon-reload"ing?

You can use RouteMetric= in the [DHCPv4] section if one of the two
interfaces shall always be the preferred one over the other.

or are you saying that you intend to change which one is preferred
dynamically? but the network callouts à la networkd-dispatcher run at
configuration time, not on request iiuc...

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list