Web lists-archives.com

Re: How to Restart Networking in stretch






On Wed, Feb 13, 2019 at 8:10 AM Greg Wooledge <wooledg@xxxxxxxxxxx> wrote:
On Tue, Feb 12, 2019 at 10:49:13PM -0600, Kent West wrote:
> "The Debian Administrator's Handbook" is for version 8, and talks
> about deprecated tools like ifup/down, which aren't even installed by
> default on stretch.

The ifupdown package has priority "important" and, as far as I know, it
is installed by default.

You might be confusing it with "ifconfig", which is in the net-tools
package, which is *not* installed by default in stretch (a departure from
previous releases).

"ifupdown" is indeed installed:

root@server-1:~# apt list ifupdown
Listing... Done
ifupdown/stable,now 0.8.19 amd64 [installed]

So you're right; I must've been confusing that package with "ifconfig".



> But in trying to convert to a static address (by editing
> /etc/network/interfaces), and then try to restart the network ("ip link set
> dev enp0s3 down", then "...up")

OK, let's back up a second.

What was in the /etc/network/interfaces file *before* you edited it?  Was
it configured for DHCP?  If so, you should bring the interface down *before*
you edit the file, so that ifdown knows there is a DHCP client daemon
running associated with this interface, that it should kill.
If you're currently configured for DHCP, and you edit the file before
bringing down the interface, the DHCP client daemon will continue running
(ifdown doesn't know about it, because you changed the file that would
have told it).  Which means you would have to kill the DHCP client daemon
yourself, either manually, or by rebooting.

I think this must've been my problem; I must've edited the interfaces file before downing the interface, which confused the system. It works as expected when I do it in the sequence you present below:


So, the proper sequence is:

1) ifdown interfacename
2) edit /etc/network/interfaces
3) ifup interfacename
 
 
What's in the /etc/network/interfaces file now?

roo@server-1:~# cat /etc/network/interfaces
# 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/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp0s31f6
iface enp0s31f6 inet dhcp

But, as mentioned, if I "ifdown enp0s3", then make the above change, then "ifup enpos3", I have working network. So this method you provide works; thanks! (The other troubleshooting questions you asked, I'm bypassing, as the basic problem has been solved.)

But, that leaves my second question unanswered:

2) What is the canonical current method in 2019 to [semi-]manually configure networking in stretch? And is it documented anywhere? (My two days of searching leads me to think "no". Or my google-fu really sucks.)

I *thought* "/etc/network/interfaces" was being phased out (perhaps as part of systemd or Network-Manager?). Then the web provides this answer then that answer - "service...", "systemctl...", "ip...", "ifup...", "if up...", and I'm confident some of these are deprecated or not preferred or apply in Case X but not Case Y, etc. With "The Handbook" being out of date, is there a definitive explanation/guide out there?

Again, thanks for getting me beyond my snag!


--
Kent West                    <")))><
Westing Peacefully - http://kentwest.blogspot.com