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

Kamil Jońca kjonca at op.pl
Mon May 9 14:13:05 UTC 2022


Lennart Poettering <lennart at poettering.net> writes:

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

> 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.

>> 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.

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?

KJ

-- 
http://stopstopnop.pl/stop_stopnop.pl_o_nas.html


More information about the systemd-devel mailing list