Web lists-archives.com

Re: Worked example, was Re: Still unable to restart networking on Debian 9 text mode only




On Sun 25 Nov 2018 at 07:34:04 (+0100), john doe wrote:
> On 11/25/2018 3:05 AM, David Wright wrote:
> > On Sat 24 Nov 2018 at 12:25:20 (-0500), Gary Dale wrote:
> >> On 2018-11-23 8:25 a.m., Luciano Andress Martini wrote:
[…]
> >>> Just changed 10.5.0.2 to 10.5.0.3
> >>>
> >>> #ifdown enp0s3
> >>> #ifup enp0s3
[…]
> >> My own two cents on the problem is that Interfaces is meant to define
> >> how the network is brought up, not to change a running network. If you
> >> want to change a running network, use ifconfig or ip to change the
> >> address. e.g. ifconfig enp-s3 10.5.0.3 should work since all you are
> >> changing is the ip address.
> > 
> > I can't see any advantage in this as you have to do all the grunt work
> > yourself instead of letting ifdown/ifup do it for you. For example:
[…]
> > I set up two static alternatives, one using the same address (13) as I
> > get from the router, and one wacky one (213) in the "intruder" range:
[…]
> > (the rest of each file is unchanged from the normal one).
> > 
> > Running a script like:
> > 
> > #!/bin/bash
> > ifdown enp0s14
> > cp /etc/network/interfaces-static-213 /etc/network/interfaces
> > ifup enp0s14
[…]
> 
> TL-DR.
> 
> Instead of using the cp command, one could use mapping stanza:
> 
> http://manpages.ubuntu.com/manpages/bionic/man5/interfaces.5.html#mappings

You might, I suppose, if you were setting this up as a permanent
solution. As a worked example of (a) the correct order for the
operations and (b) the extra leverage obtained by using the
appropriate higher level commands, I would have had to edit the
/e/n/i file itself, adding an unnecessary layer of extra complication.

As it is, by typing: # rm -i /etc/network/interfaces-*¹ /root/to-*²
all my experiment's files have been removed, leaving just
the trace evidence in my logs.

But by all means post a working example here. Following the
documentation in   man interfaces   is obviously difficult for
many people, judging by the examples that sometimes get posted.

¹ the two nonce files and a copy of the original /e/n/i.
² the change-overscripts; typing the commands themselves
  won't work when you get disconnected halfway through
  the process.

Cheers,
David.