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

Re: debian9.1 ifdown bug



Le 18/08/2017 à 14:33, Henrique de Moraes Holschuh a écrit :
On Fri, 18 Aug 2017, Toad Zhou wrote:
#ifconfig eth3
eth3: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
         inet 172.16.1.20

#cat /etc/network/interfaces
auto eth3
iface eth3 inet static
address 172.16.1.16
netmask 255.255.255.0

#ifdown -v eth3  #他删除的是新interfaces配置中的网络,而不是老的网络。
/bin/ip addr del 172.16.1.16/255.255.255.0 broadcast 172.16.1.255
dev eth3 label eth3
(...)
Newly installed system, I tried to modify the network. But networking
restart has been in a failed state, but I can use it after reboot.
(...)
I see.  This is actually somewhat hard to fix, because ifdown would need
to differentiate primary and secondary addresses due to the way it was
(naively) designed.

I did not see any hint of primary and secondary addresses in the original post.

IIUC, the OP just modified the interface definition in /etc/network/interface while the interface was up. DO NOT DO THAT, it does not work. AFAIK ifupdown does not keep track of how it configured an interface, so it needs the original definition to remain unmodified in /etc/network/interfaces in order to correctly deconfigure it.

Things become rather funny when you change and interface method from dhcp to static while the interface is running : ifdown does not stop the DHCP client daemon, so it will change the supposedly static address again after the renew time.

The right way to do things :
1) ifdown <interface>
2) Modify <interface> definition in /etc/network/interfaces
3) ifup <interface>

Also do not use networking (re)start, it is broken as it uselessly deactivate all interfaces and does not (re)start interfaces which have allow-hotplug instead of auto/allow-auto.


Reply to: