如何控制网络接口的上行顺序?

我有/ etc / network / interfaces如下。 每次系统启动时,路由都是错误的,因此无法访问网关。 我必须ifdown br0 && ifup br0来修复路由表并使一切正常。 如何永远解决这个问题?

auto lo iface lo inet loopback auto eth0 iface eth0 inet manual bond-master bond0 auto eth1 iface eth1 inet manual bond-master bond0 auto bond0 iface bond0 inet dhcp bond-mode balance-tlb bond-slaves none auto br0 iface br0 inet dhcp bridge_ports bond0 

编辑

这是我重新启动主机后来自ip rs的路由表。 有一个额外的路由路径。

在重启br0之前:

 default via 10.69.208.129 dev bond0 metric 100 10.69.208.128/26 dev bond0 proto kernel scope link src 10.69.208.172 10.69.208.128/26 dev br0 proto kernel scope link src 10.69.208.172 169.254.0.0/16 dev br0 scope link metric 1000 192.168.1.0/24 dev lxcbr0 proto kernel scope link src 192.168.1.1 

重启br0后:

 default via 10.69.208.129 dev br0 metric 100 10.69.208.128/26 dev br0 proto kernel scope link src 10.69.208.172 169.254.0.0/16 dev br0 scope link metric 1000 192.168.1.0/24 dev lxcbr0 proto kernel scope link src 192.168.1.1 

你需要将脚本放到/etc/network/interface文件的up / down接口

ubuntu是debian,这应该对你有帮助

单击此处查看Debian网络配置

打开没有IP地址的接口

要创建一个没有IP地址的网络接口,请使用手动方法,并使用pre-up和post-down命令使接口上下移动。

  iface eth0 inet manual pre-up ifconfig $IFACE up post-down ifconfig $IFACE down 

将bond0更改为手动而不是dhcp,现在可以正常工作。