[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What is the neat way of organizing files in /etc/network/interfaces.d ?



On Mon 16 May 2022 at 01:10:20 (+0200), Stella Ashburne wrote:

> 2. In the file called wlo1, I have four parts that correspond to the four different wireless networks. is there a neater way of doing it?

Yes. Put each wlo1 configuration into a separate file called either:
  wlo1-nw1, wlo1-nw2, wlo1-nw3, wlo1-nw4
or, more sensibly:
  wlo1-nw22, wlo1-nw15, wlo1-nw51, wlo1-nw70
removing the # from all the non-comment lines.

You now have six files: lan, usb0, wlo1-nw22, wlo1-nw15, wlo1-nw51, wlo1-nw70,
which you can handle in a similar manner to however you presently
select between your three files.

You could manually (de)activate any file's definition with
ifup or ifdown.

Alternatively, you could move the ones you want activated into
/etc/network/interfaces.d/, and move the ones that you don't
somewhere else, like /etc/network/unused-interfaces/.

The point of this being to avoid having to /edit/ files in order
to change networks. Keep the files' contents fixed, and vary
the selection of files to be read. It's much less error-prone.

Cheers,
David.


Reply to: