Ubuntu – How to control the up order of network interfaces

interfacenetwork-bondingnetwork-bridgenetworkingrouting

I have /etc/network/interfaces as follow. Every time the system boots up, the route is wrong so the gateway is not reachable. I'd have to ifdown br0 && ifup br0 to fix the route table and make everything work. How to fix this forever?

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

Edit

This is the route table from ip r s after I reboot the host. There is an extra routing path.

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

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

Best Answer

you need to put script to up/down interface to your /etc/network/interface file

ubuntu is debian and this should helps you

Click here for Debian Networking Configuration

Bringing up an interface without an IP address

To create a network interface without an IP address at all use the manual method and use pre-up and post-down commands to bring the interface up and down.

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