1

I'm working on a server with a number of various interfaces (eth0-3) and I currently just use one for both host traffic and another for my LXC bridges traffic. Since I have a few spare ports just laying around and I have a lot of traffic running over my bridge I thought I'd use the other ports for some good old fashioned link aggregation.

This isn't something I've really messed with before, thisn't really a question more a 'is this how i'd implement this in /etc/network/interfaces'... so here we go.

By my understanding I can just using the bonding thingy to bond eth1 and eth2 say (or even eth3!) to a device bond0, and then just change the bridge_port of my bridge br0 to bond0. Now this all makes sense to me, what I'm very confused about is how'd do this if I didn't want to give bond0 an ip... I currently have my br0 set to have no IP meaning the host isn't contact-able but all the lxc containers on the host which have routable IPs so they can be contacted.

How would I implement this? Can I just not give bond0 an ip and assume it will act in the same way?

Here is my notes /etc/network/interface file on how I'd how do it (mind I haven't implemented this yet cuz I don't want to down my entire hosts networks):

# host communications times
auto eth0 inet static 
iface eth0 inet static
    blahblahblah

# first slave device
auto eth1
iface eth1 inet manual
    bond-master bond0

# second slave device
auto eth2
iface eth2 inet manual
    bond-master bond0

# our bond master or aggregation device
auto bond0
iface bond0 inet manual
    # no IP?
    gateway 192.168.1.1
    netmask 255.255.255.0
    bond-mode 0

# our bridge device
auto br0
iface br0 inet manual
    # also no IP
    bridge_ports bond0
    bridge_fd 0
    bridge_maxwait 0
0

So I was having a similar problem getting bonding + bridging working on Ubuntu 14.04. There were three key things I had to do:

  1. Disable bios dev names, and update grub.
  2. Create my own udev rules name file.
  3. Have the bridge take the IP, not the bond.

Ok step 1. Make sure you have LOCAL access to this box. Keyboard and monitor. We're going to break your network. Edit this file: /etc/default/grub and change this line:

GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 net.ifnames=1 biosdevname=0"

(We don't use IPV6, so we disable that as well)

Next, run sudo update-grub and reboot.

Ok step 2. Next, login to your box and run the following: sudo dmesg | grep eth

With any luck, you should find your devices so we can write udev rules. Normally people rename their network devices by MAC address, but bonds tend to confuse udev because the bond might take one of your NIC's MAC addresses in certain configurations, so just don't go down that road. Instead you can do it by device ID. I have Intel NICs, so this is my output. Your mileage will vary:

[ 17.888965] igb 0000:07:00.0: added PHC on eth0 [ 17.888969] igb 0000:07:00.0: eth0: (PCIe:2.5Gb/s:Width x1) d0:50:99:xx:xx:xx [ 17.889097] igb 0000:07:00.0: eth0: PBA No: 001300-000 [ 17.932484] igb 0000:08:00.0: added PHC on eth1 [ 17.932488] igb 0000:08:00.0: eth1: (PCIe:2.5Gb/s:Width x1) d0:50:99:xx:xx:xx [ 17.932615] igb 0000:08:00.0: eth1: PBA No: 001300-000

Ok, so my device IDs are 0000:07:00.0 and 0000:08:00.0. These are unique to every hardware setup.

Edit this file, and remove any existing lines from it: /etc/udev/rules.d/70-persistent-net.rules

Add your desired device names like this (notice where to sub the 0000:07:00.0 and 0000:08:00.0):

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNELS=="0000:07:00.0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNELS=="0000:08:00.0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

Woot. Almost done.

Step 3. For whatever reason, I couldn't get networking to work if the bond took the IP address, but it seems to be working just find if the bridge does. I use this /etc/network/interfaces (I also use DHCP instead of static BTW, just keep those stanzas in):

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 manual 
     bond-slaves none
     bond-mode 802.3ad
     bond-miimon 100
     bond-downdelay 200
     bond-updelay 200

auto lan0
iface lan0 inet dhcp
  bridge_ports bond0
  bridge_fd 0
  bridge_maxwait 0

Reboot and cross your toes. Good luck!

EDIT

Ubuntu has a few bugs with ordering in this configuration. I inserted some post-up delays because I wasn't consistently able to pull and IP address over DHCP:

/etc/network/interfaces:

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 manual
    bond-slaves eth0 eth1
    bond-mode 802.3ad
    bond-miimon 100
    bond-downdelay 200
    bond-updelay 200
    bond-xmit-hash-policy layer3+4
    up sleep 2

auto lan0
iface lan0 inet dhcp
    bridge_ports bond0
    bridge_waitport 10
    bridge_fd 0
    bridge_maxwait 0
    bridge_stp off
    pre-up sleep 2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.