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<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

我的临时修复方案是:
# 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 <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 # 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

Reply via email to