How do I put a bridge on top of a bonded interface?

I'm setting up a Ubuntu Server 11.10 box with multiple Ethernet interfaces that are bonded for redundancy. I'm planning to use it as a KVM host, so I'll need a network bridge.

To accomplish this, I installed ifenslave and bridge-utils, then wrote my /etc/network/interfaces file. The relevant portion is as follows:

auto br0
iface br0 inet static
    address 10.1.254.101
    netmask 255.255.255.0
    network 10.1.254.0
    broadcast 10.1.254.255
    gateway 10.1.254.50
    dns-nameservers 10.1.254.252
    bridge_ports bond0
    bridge_stp off

iface bond0 inet manual
    bond-slaves eth0 eth3
    bond_mode balance-rr
    bond_miimon 100

Unfortunately, this isn't giving me connectivity. ifup br0 gives me "can't add bond0 to bridge br0: Invalid argument", and ifdown br0 gives me "device bond0 is not a slave of br0". If I modify my interfaces file to get rid of the bridge, I have full connectivity—but I'm going to need the bridge.

I think something in my interfaces file is wrong, but I don't know how to make it right. Does anyone know? Thanks!


Solution 1:

This is how I configured a Ubuntu 10.04 LTS system for bridging on top of bonded interfaces:

iface eth0 inet manual
iface eth5 inet manual

# eth0 & eth5 form bond0 for the x.y.z.0/25 subnet
auto bond0
iface bond0 inet static
        bond_miimon 100
        bond_mode active-backup
        bond_downdelay 200
        bond_updelay 200
    address x.y.z.35
    netmask 255.255.255.128
    network x.y.z.0
    post-up ifenslave bond0 eth0 eth5
    pre-down ifenslave -d bond0 eth0 eth5

auto br0
iface br0 inet static
    bridge_ports bond0
    address x.y.z.35
    netmask 255.255.255.128
    network x.y.z.0
    gateway x.y.z.126