Web lists-archives.com

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




On 2018-11-25 10:14 a.m., David Wright wrote:
On Sat 24 Nov 2018 at 21:33:18 (-0500), Gary Dale wrote:
On 2018-11-24 9:05 p.m., David Wright wrote:
So you can see the extra work (worth more than two cents) that
the higher level commands do for you automatically, thanks to
/etc/network/if-*.d/*
That, of course, assumes that ifup and ifdown work on your system.
They don't work on two of my systems that uses systemd-networkd to
control the network.
I don't understand why you would *want* to use ifup/ifdown on a system
where you've chosen to control the interface with systemd-networkd.
The only reason I bothered to actually perform the worked example was
because I have one host that's still using what the installer left
as its default.

I don't but the OP seems to and your assistance used it. You defended the use of "high level tools" even when they make things more complicated.



However ifconfig works on one and ip works on the
other (although they are both running Stretch, one is a new
server-type install while the other has been upgraded over the years
from earlier versions).
Perhaps it would be useful to discover why, and then post any helpful
hints on what to do or avoid if other shave such a problem.

It's not a problem. It's how the two systems developed. Ifconfig no longer is installed by default on Debian systems. Ip is used instead.



The lower-level tools tend to be more flexible and are more agnostic
regarding how your network is set up.
Yes, one might suppose that the high-level tools use the low-level ones
in a pre-arranged (hence less flexible) manner to do the actual work.

In the case of the OP, he needs to change his interfaces file no
matter how he changes the network. However the order of commands isn't
important when he uses ifconfig or ip to update the ip address - he
can do it before or after editing interfaces. Moreover, it takes one
fewer command. And it's worth learning how to use these tools if you
are working with networks.
I don't understand why you'd recommend using a particular method when
you've just explained that you can't get it to run consistently on
your own systems. Nor do I understand why the number of commands
required is of such importance: isn't that what scripts are for.
One reply suggested installing network manager just to reduce the
command count to two. That's a 15 package installation on my system.

Again, its a matter of using what you have. If you have ifconfig, it's straightforward to change the ip address of a running network. Ip is only slightly more complicated and should be used since ifconfig seems to be losing favour.

Ip works on systems that don't use /etc/network/interfaces, such as ones that use systemd-networkd to control their network, while ifup/down only work with the interfaces file. Learn how to use it and your knowledge will be worth something for a longer time.

You don't need network manager to reduce the command count. Just use the tools you already have.