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

Re: Under each of these scenarios, what is the neatest and simplest way to manipulate the /etc/network/interfaces file?



On Sun, 20 Mar 2022, David Wright wrote:

On Sat 19 Mar 2022 at 03:14:54 (+0100), Stella Ashburne wrote:

There are instances in which my machine is connected to a mobile hotspot. And in some situations, it's connected to a smartphone via USB tethering. And when I'm in the office, I may connect it to a LAN cable.

Below are the contents of my /etc/network/interfaces file:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

I would change this line to

source-directory /etc/network/interfaces.d

(which was the default on new buster installations).

I would then hive off all your interface configurations into
separate files in the directory /etc/network/interfaces.d
using all-ASCII filenames constructed from upper/lower-case
letters, digits, underscores, and minus-hyphens, as specified
on the man page, but with the string ".hidden" added to the end,
thus:

myphone-tethered.hidden
office-wired.hidden
wifi.hidden
hotspot.hidden

and so on. Files with a dot are ignored when included by means of
a source-directory directive.


I think just commenting out the allow-hotplug lines is sufficient. Then
you can use ifup/ifdown at will. The only 'problem' will be that an
interface doesn't start at boot.

(I'd second splitting into separate files anyway)


Reply to: