Web lists-archives.com

Re: processing order for configuration files in /etc/network/interfaces.d




On Sun 26 Aug 2018 at 15:41:05 (+0300), Martin T wrote:
> On Thu, Aug 23, 2018 at 6:04 PM <tomas@xxxxxxxxxx> wrote:
> > On Thu, Aug 23, 2018 at 05:31:57PM +0300, Martin T wrote:
> > > According to "man interfaces", the ifup brings the named interfaces up
> > > in the order listed in /etc/network/interfaces file. However, what is
> > > the order for files in /etc/network/interfaces.d/? Alphabetical, i.e
> > > same as "ls -l /etc/network/interfaces.d/"?
> >
> > I assume the files there are invoked by run-parts (man interfaces(5) at
> > least hints at that). In that case yes, they are run in lexical order.
> >
> > But I'd double-check the run-parts part (heh). I've been caught spewing
> > nonsense here ;-)
> I added "pre-up echo $IFACE >> /tmp/interfaces_test" line to each
> interface configuratio file in /etc/network/interfaces.d/ and looks
> like the invoke order is not lexical. I have four files in
> /etc/network/interfaces.d/:
> 
> # ls -l /etc/network/interfaces.d/
> total 16
> -rw-r--r-- 1 root root 338 Aug 26 14:10 br0
> -rw-r--r-- 1 root root 555 Aug 26 14:10 eth0
> -rw-r--r-- 1 root root  96 Aug 26 14:09 eth0.100
> -rw-r--r-- 1 root root 109 Aug 26 14:09 lo
> #
> 
> However, the content of the /tmp/interfaces_test is alwayse(I rebooted
> the machine 5 times) following:
> 
> # cat /tmp/interfaces_test
> br0
> lo
> eth0
> eth0.100
> #
> 
> I thought that ifup processes those files in order which they appear
> in /etc/network/interfaces.d/*, but this does not seem to be true. Any
> other ideas?

You need to post your evidence, starting with your /etc/network/interfaces
file. You say you're using ifup, so we can perhaps discount this paragraph:

       Currently, "source-directory" isn't supported by
       network-manager and guessnet.

but we don't know whether you're using "source-directory" or "source",
for example. The former might not be expected to run eth0.100 at all.
There's conflicting evidence on the web about such matters.

If you care about the order in which these files are sourced,
for the time being I would source them individually in the order you
want. I'm not sure where the lexical sorting is documented, but man
interfaces(5) does not yield much when searched for "lex", "sort"
and "order".

I'd be interested to find the script(s) that the system is using to
select configuration files for execution, and to see if it agrees
with the documentation (which is a bit lax here).

Cheers,
David.