Re: debian9.1 ifdown bug

2017-08-18 Thread Ben Caradoc-Davies

On 18/08/17 19:38, David Guyot wrote:

I'm afraid you won't get much help if you don't explain your problem in
English. These are English-speaking mailing lists.


The original poster provided a Google translation, which I thought was a 
good effort:



=
google translation
=


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.
Troubleshoot the reasons for finding ifdown -v ethx found ip addr del
ip / mask deleted is not the old address, but the new address. So in
the closed restart he just added / etc / network / interfaces in the
new ip address. Ip addr found that they both coexist the state.

#ifconfig eth3
Eth3: flags = 4099  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 # He deleted the network in the new interfaces
configuration, not the old network.
/ Bin / ip addr del 172.16.1.16/255.255.255.0 broadcast 172.16.1.255
dev eth3 label eth3

My temporary fix is:
## cat fix-network.sh
#! / Bin / bash
/etc/init.d/networking stop
$ (Ip addr | grep inet | grep -v 127.0.0.1 | awk '{printf "ip addr
del% s dev% s \ n", $ 2, $ NF}')
/etc/init.d/networking start
#ifup eth0


--
Ben Caradoc-Davies 
Director
Transient Software Limited 
New Zealand



Re: debian9.1 ifdown bug

2017-08-18 Thread Pascal Hambourg

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  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 
2) Modify  definition in /etc/network/interfaces
3) ifup 

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.




Re: debian9.1 ifdown bug

2017-08-18 Thread rhkramer
From the peanut gallery (not the OP), hurray for Henrique who:

(1) read (or skimmed) all the way to the bottom to notice that there was an 
English translation, and 

(2) provided a response / answer

On Friday, August 18, 2017 08:33:37 AM Henrique de Moraes Holschuh wrote:
> > 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.
> > Troubleshoot the reasons for finding ifdown -v ethx found ip addr del ip
> > / mask deleted is not the old address, but the new address. So in the
> > closed restart he just added / etc / network / interfaces in the new ip
> > address. Ip addr found that they both coexist the state.
> 
> 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.
> 
> If we change the ip addr del to ip addr flush, it will remove every
> address from the device, including ones with other labels, etc.  This
> breaks the way ifdown is supposed to work.
> 
> And the first ifdown has no state it can use to know otherwise.
> 
> The best I can see being done would be to:
> 
> 1. not fail if ip addr del fails,
> 2. flush the device if the state file exists and tells us all related
> interfaces (primary or secondary) are down *and* none of them is of type
> "manual".
> 
> But I am not sure this is worth the possible breakages :-(  and one has
> to test it on diskless boxes using NFS too, and wake-on-lan.  They
> create annoying border conditions for network shutdown.



Re: debian9.1 ifdown bug

2017-08-18 Thread Henrique de Moraes Holschuh
On Fri, 18 Aug 2017, Toad Zhou wrote:
> #ifconfig eth3
> eth3: flags=4099  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
> 
> 我的临时修复方案是:
> # cat fix-network.sh
> #!/bin/bash
> /etc/init.d/networking stop
> $(ip addr|grep inet|grep -v 127.0.0.1|awk '{printf "ip addr del %s dev
> %s\n", $2,$NF}')
> /etc/init.d/networking start
> #ifup eth0
> 
> 
> =
> google translation
> =
> 
> 
> 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.
> Troubleshoot the reasons for finding ifdown -v ethx found ip addr del ip /
> mask deleted is not the old address, but the new address. So in the closed
> restart he just added / etc / network / interfaces in the new ip address.
> Ip addr found that they both coexist the state.

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.

If we change the ip addr del to ip addr flush, it will remove every
address from the device, including ones with other labels, etc.  This
breaks the way ifdown is supposed to work.

And the first ifdown has no state it can use to know otherwise.

The best I can see being done would be to:

1. not fail if ip addr del fails,
2. flush the device if the state file exists and tells us all related
interfaces (primary or secondary) are down *and* none of them is of type
"manual".

But I am not sure this is worth the possible breakages :-(  and one has
to test it on diskless boxes using NFS too, and wake-on-lan.  They
create annoying border conditions for network shutdown.

-- 
  Henrique Holschuh



Re: debian9.1 ifdown bug

2017-08-18 Thread didier gaumet
嗨,

有Debian用户邮件列表中文:

debian-chinese...@lists.debian.org(简体)
debian-chinese-b...@lists.debian.org(传统)


Hi,

there are Debian user mailing lists in chinese:

debian-chinese...@lists.debian.org (simplified)
debian-chinese-b...@lists.debian.org (traditional)



Re: debian9.1 ifdown bug

2017-08-18 Thread David Guyot
Hello.

I'm afraid you won't get much help if you don't explain your problem in
English. These are English-speaking mailing lists.

Regards.

Le vendredi 18 août 2017 à 15:00 +0800, Toad Zhou a écrit :
> Hi,
>     新安装的系统,我尝试修改网络。但networking restart一直处于失效状态,但是我reboot之后他就可以使用。
> 排查了一下原因发现ifdown -v ethx 的时候发现 ip addr del
> ip/mask删除的不是老的地址,而是新的地址。所以在networking restart之后
> 他只是新加/etc/network/interfaces中的新的ip地址。ip addr 发现他们两是并存的状态。
> 
> #ifconfig eth3
> eth3: flags=4099  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
> 
> 我的临时修复方案是:
> # cat fix-network.sh 
> #!/bin/bash 
> /etc/init.d/networking stop 
> $(ip addr|grep inet|grep -v 127.0.0.1|awk '{printf "ip addr del %s
> dev %s\n", $2,$NF}')
> /etc/init.d/networking start 
> #ifup eth0
> 
> 
> =
> google translation
> =
> 
> 
> 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.
> Troubleshoot the reasons for finding ifdown -v ethx found ip addr del
> ip / mask deleted is not the old address, but the new address. So in
> the closed restart he just added / etc / network / interfaces in the
> new ip address. Ip addr found that they both coexist the state.
> 
> #ifconfig eth3
> Eth3: flags = 4099  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 # He deleted the network in the new interfaces
> configuration, not the old network.
> / Bin / ip addr del 172.16.1.16/255.255.255.0 broadcast 172.16.1.255
> dev eth3 label eth3
> 
> My temporary fix is:
> ## cat fix-network.sh
> #! / Bin / bash
> /etc/init.d/networking stop
> $ (Ip addr | grep inet | grep -v 127.0.0.1 | awk '{printf "ip addr
> del% s dev% s \ n", $ 2, $ NF}')
> /etc/init.d/networking start
> #ifup eth0
-- 
David Guyot
Administrateur système / Sysadmin
Europe Camions Interactive / Stockway
Moulin Collot F-88500 Ambacourt
Tél : +33 (0)3 29 30 47 85

signature.asc
Description: This is a digitally signed message part


debian9.1 ifdown bug

2017-08-18 Thread Toad Zhou
Hi,
新安装的系统,我尝试修改网络。但networking restart一直处于失效状态,但是我reboot之后他就可以使用。
排查了一下原因发现ifdown -v ethx 的时候发现 ip addr del
ip/mask删除的不是老的地址,而是新的地址。所以在networking restart之后
他只是新加/etc/network/interfaces中的新的ip地址。ip addr 发现他们两是并存的状态。

#ifconfig eth3
eth3: flags=4099  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

我的临时修复方案是:
# cat fix-network.sh
#!/bin/bash
/etc/init.d/networking stop
$(ip addr|grep inet|grep -v 127.0.0.1|awk '{printf "ip addr del %s dev
%s\n", $2,$NF}')
/etc/init.d/networking start
#ifup eth0


=
google translation
=


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.
Troubleshoot the reasons for finding ifdown -v ethx found ip addr del ip /
mask deleted is not the old address, but the new address. So in the closed
restart he just added / etc / network / interfaces in the new ip address.
Ip addr found that they both coexist the state.

#ifconfig eth3
Eth3: flags = 4099  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 # He deleted the network in the new interfaces
configuration, not the old network.
/ Bin / ip addr del 172.16.1.16/255.255.255.0 broadcast 172.16.1.255 dev
eth3 label eth3

My temporary fix is:
## cat fix-network.sh
#! / Bin / bash
/etc/init.d/networking stop
$ (Ip addr | grep inet | grep -v 127.0.0.1 | awk '{printf "ip addr del% s
dev% s \ n", $ 2, $ NF}')
/etc/init.d/networking start
#ifup eth0