在 debian 中将两个 ips 与单个 nic 绑定后如何正确重启我的网络?

How to restart my network properly after binding two ips with single nic in debian?

我在debian中用这种方式绑定了两个ip和一个nic(网络接口卡)

第 1 步:

vim /etc/network/interfaces 转换成如下格式:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0
broadcast 192.168.1.255
auto eth0:1
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0
broadcast 192.168.1.255

现在192.168.1.100和192.168.1.100都和我本地网卡绑定了

第二步: vim /etc/network/ifstate 转换成如下格式:

lo=lo
eth0=eth0
eth0:1=eth0:1

现在是时候重启我的网络了。

 /etc/init.d/networking restart
[....] Running /etc/init.d/networking restart is deprecated because it may not r[warnble some interfaces ... (warning).
[....] Reconfiguring network interfaces...RTNETLINK answers: File exists
Failed to bring up eth0.
Ignoring unknown interface eth0:1=eth0:1.
done.

ifdown eth0 && ifup eth0
ifdown: interface eth0 not configured
RTNETLINK answers: File exists
Failed to bring up eth0.

重启电脑时两个ip都绑定了单网卡
我想知道重新启动网络而不是重新启动它的正确方法。

通常 stop/start/restart Debian 上的网络接口:

/etc/init.d/networking stop
/etc/init.d/networking start
/etc/init.d/networking restart

进行更改并重新启动后验证更改:

ifconfig -a

https://wiki.debian.org/Bonding