How to control the up order of network interfaces?

11,831

Changing bond0 to manual instead of dhcp, now it works.

Share:
11,831

Related videos on Youtube

Magicloud
Author by

Magicloud

Updated on September 18, 2022

Comments

  • Magicloud
    Magicloud over 1 year

    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
    
    • Anish
      Anish almost 11 years
      If your /etc/network/interfaces file is correct according to the documentation for ifenslave as well as the documentation for bridge-utils then I think it's a "race condition" bug if the interfaces do not come up in the correct order. If there is a mistake in your interfaces file then hopefully someone will be able to provide details in an answer here.
    • Anish
      Anish almost 11 years
      So I don't think "how do I adjust the order?" is really the right way to phrase your question. It's more "why is there a race condition here?"
    • Magicloud
      Magicloud almost 11 years
      Should I set bond0 as manual instead of dhcp? I will try next time.