[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?



Mon cheri

> Sent: Sunday, March 20, 2022 at 10:31 PM
> From: "David Wright" <deblis@lionunicorn.co.uk>
> To: debian-user@lists.debian.org
> Subject: Re: Under each of these scenarios, what is the neatest and simplest way to manipulate the /etc/network/interfaces file?
>
> 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
>
On Debian 11, the line

source /etc/network/interfaces.d/*

is correct.

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

On Debian 11, files with a dot are NOT ignored when the line

source /etc/network/interfaces.d/*

is present in /etc/network/interfaces

I have tried the following:

Attempt #1

When the files have the dot in /etc/network/interfaces.d/*, e.g.

lan.hidden
usb0.hidden
wlo1.hidden

username@hostname:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether e5:d3:a2:b9:c3:27 brd ff:ff:ff:ff:ff:ff
    altname wln0s7
    inet 192.168.43.51/24 brd 192.168.43.255 scope global dynamic wlo1
       valid_lft 3588sec preferred_lft 3588sec
username@hostname:~$

Attempt #2

When the files do NOT have the dot in /etc/network/interfaces.d/*, e.g.

lan
usb0
wlo1

username@hostname:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether e5:d3:a2:b9:c3:27 brd ff:ff:ff:ff:ff:ff
    altname wln0s7
    inet 192.168.43.51/24 brd 192.168.43.255 scope global dynamic wlo1
       valid_lft 3576sec preferred_lft 3576sec
username@hostname:~$

Summary: On Debian 11, files in /etc/network/interfaces.d/* do NOT require a DOT.

Best regards.

Stella



Reply to: