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

Re: How to Restart Networking in stretch



On Tue 12 Feb 2019 at 22:49:13 (-0600), Kent West wrote:
> stretch, 9.7
> 
> I've duckduckgo'd for two days, but there seems to be no definitive answer
> as to how networking is supposed to be configured in stretch. debian.org's
> link to "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.

Perhaps they spell deprecate differently, but I can only find one
occurrence of the word, on page 224, referring to SSL.

I can only find three references to ifupdown (pp. 150, 383, 396),
none making any judgment on its use.

> I've got a very minimal install of stretch. I used the network install
> .iso, and when I got to the "tasksel"-equivalent screen, I unchecked
> everything except the bottom-most "Standard system tools" (or whatever it
> says).

> When I boot into my system, it works as expected; I can ping google.com and
> 8.8.8.8, apt install more packages, etc.
> 
> 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") subsequent networking results in name
> resolution complaints or "network not available" complaints. Nor do any of
> the other methods I've tried work - "service network restart", "systemctl
> restart networking", "systemctl restart systemd-networkd",
> "/etc/init.d/networkng stop" then "...start".

It's interesting that many people seem to think that networking
behaves like a daemon, where you can just change the configuration
file and then signal the daemon to reread the new file.

Perhaps there's something to be said for ifup copying more of its
state, eg the file contents, into /run/network so that ifdown
knows what ifup did.

> I try a reboot. Still no go.
> 
> So I restore my interfaces file to DHCP, and reboot, and all is well.
> Until... I try to stop/start networking just to see if I can, using any of
> the methods above. A simple "if ... down" followed immediately by an "if
> ... up", without changing a thing between the two, results in the same
> error messages I had earlier, until I reboot.

Just so that you have a pattern against which to measure your own
network, here's what I see:

# 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 enp2s0
iface enp2s0 inet dhcp
# 
# ifdown -v enp2s0
ifdown: configuring interface enp2s0=enp2s0 (inet)
/bin/run-parts --verbose /etc/network/if-down.d
run-parts: executing /etc/network/if-down.d/resolvconf
run-parts: executing /etc/network/if-down.d/upstart
run-parts: executing /etc/network/if-down.d/wpasupplicant
/sbin/dhclient -4 -v -r -pf /run/dhclient.enp2s0.pid -lf /var/lib/dhcp/dhclient.enp2s0.leases -I -df /var/lib/dhcp/dhclient6.enp2s0.leases enp2s0
Killed old client process
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/enp2s0/00:99:99:83:0e:66
Sending on   LPF/enp2s0/00:99:99:83:0e:66
Sending on   Socket/fallback
DHCPRELEASE on enp2s0 to 192.168.1.1 port 67
/bin/ip link set dev enp2s0 down
/bin/run-parts --verbose /etc/network/if-post-down.d
run-parts: executing /etc/network/if-post-down.d/avahi-daemon
run-parts: executing /etc/network/if-post-down.d/wireless-tools
run-parts: executing /etc/network/if-post-down.d/wpasupplicant

# 
# ifup -v enp2s0

ifup: configuring interface enp2s0=enp2s0 (inet)
/bin/run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/wireless-tools
run-parts: executing /etc/network/if-pre-up.d/wpasupplicant

/sbin/dhclient -4 -v -pf /run/dhclient.enp2s0.pid -lf /var/lib/dhcp/dhclient.enp2s0.leases -I -df /var/lib/dhcp/dhclient6.enp2s0.leases enp2s0
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/enp2s0/00:99:99:83:0e:66
Sending on   LPF/enp2s0/00:99:99:83:0e:66
Sending on   Socket/fallback
DHCPDISCOVER on enp2s0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on enp2s0 to 255.255.255.255 port 67 interval 19
DHCPREQUEST of 192.168.1.19 on enp2s0 to 255.255.255.255 port 67
DHCPOFFER of 192.168.1.19 from 192.168.1.1
DHCPACK of 192.168.1.19 from 192.168.1.1
bound to 192.168.1.19 -- renewal in 34116 seconds.
/bin/run-parts --exit-on-error --verbose /etc/network/if-up.d
run-parts: executing /etc/network/if-up.d/000resolvconf
run-parts: executing /etc/network/if-up.d/avahi-daemon
run-parts: executing /etc/network/if-up.d/openssh-server
run-parts: executing /etc/network/if-up.d/upstart
run-parts: executing /etc/network/if-up.d/wpasupplicant
# 

> btw, NetworkManager (network-manager) is not installed.

Same here. I think the installer gives you that when you install
a Desktop Environment.

> So, two questions:
> 
> 1) Why can't I restore my networking after I stop it? How do I restore
> networking?

See above (when it works for you).

> 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 don't think you can have a "canonical" method because it depends on
what sort of system you're installing.

For a server, you probably want nothing more than the ifupdown that
the d-i installs by default. Most people running a DE will likely take
what's given to them; isn't that the point of a DE: why fight it.
In between are people like me who prefer the lightest tools where
possible, and so I use wicd (-curses) as a matter of course. It works
well on the road where it's essential, but it also can be useful at
home when I move machines around (altering whether they're wired
or wireless'd).

Cheers,
David.


Reply to: