Bonded Interfaces With Optional VLAN
From openSUSE
SuSE10.3
This seems to have been broken in 10.3, as the /etc/sysconfig/network/scripts/functions script fails with an error; I am working on it. speculatrix
Why Ethernet bonding?
It allows multiple physical interfaces connected to different switches to have the same IP address, and thus, to have resilience in the event of the failure of either network card, cable or switch, provided the switches are doing their bit to be resilient. Note that the mac address of the interfaces become the same, and this means the switches need to have spanning tree, otherwise they will get upset at seeing the same mac in two places!
Contents |
Technical notes on Ethernet bonding
- the ifcfg-eth-XX files will have different names according to the mac addresses of the machine.
- create additional ifcfg-bondN.M to create vlan M on interface bondN, the provided startup script handles things automagically.
- use "lspci" to find out the bonded slave; you could use eth0 or eth1 as the slave names but these might change if you change kernel.
Configuration examples
Bond interfaces without being an 802.1q trunk
Here's some typical example config files from /etc/sysconfig/network:
ifcfg-bond0
change the bonding slave line according to the result from "lspci".
BOOTPROTO="static" STARTMODE="onboot" USERCTL=no IPADDR=10.0.0.221 NETMASK=255.255.255.0 NETWORK=10.0.0.0 BROADCAST=10.0.0.255 BONDING_MASTER="yes" BONDING_MODULE_OPTS="mode=active-backup miimon=100" BONDING_SLAVE1=bus-pci-0000:04:00.0 BONDING_SLAVE2=bus-pci-0000:05:00.0 POST_UP_SCRIPT=vlans
ifcfg-eth-id-00:11:22:33:44:55
You don't really need config files for the individual ethernets - the pci identifiers in the main bond0 script do everything.
BOOTPROTO='static' STARTMODE='onboot' ETHTOOL_OPTIONS='' USERCONTROL='no' MASTER=bond0 SLAVE=yes
ifcfg-eth-id-11:22:33:44:55:66
BOOTPROTO='static' STARTMODE='onboot' ETHTOOL_OPTIONS='' USERCONTROL='no' MASTER=bond0 SLAVE=yes
Bond interfaces to make an 802.1q trunk with a vlan2 interface
ifcfg-bond0
BOOTPROTO="static" STARTMODE="onboot" USERCTL=no BONDING_MASTER="yes" BONDING_MODULE_OPTS="mode=active-backup miimon=100" BONDING_SLAVE1=bus-pci-0000:04:00.0 BONDING_SLAVE2=bus-pci-0000:05:00.0 POST_UP_SCRIPT=vlans
ifcfg-bond0.2
BOOTPROTO="static" STARTMODE="onboot" USERCTL=no IPADDR=10.0.0.221 NETMASK=255.255.255.0 NETWORK=10.0.0.0 BROADCAST=10.0.0.255 MTU='' REMOTE_IPADDR='' USERCONTROL='no'
ifcfg-eth-id-00:11:22:33:44:55
You don't really need config files for the individual ethernets - the pci identifiers in the main bond0 script do everything.
BOOTPROTO='static' STARTMODE='onboot' ETHTOOL_OPTIONS='' USERCONTROL='no' MASTER=bond0 SLAVE=yes POST_UP_SCRIPT=vlans
ifcfg-eth-id-11:22:33:44:55:66
BOOTPROTO='static' STARTMODE='onboot' ETHTOOL_OPTIONS='' USERCONTROL='no' MASTER=bond0 SLAVE=yes
Startup script
create a script to automagically create the vlans when bond0 comes up called _/etc/sysconfig/network/scripts/vlans_:
#!/bin/bash
# this script published under the GPL
ls /etc/sysconfig/network/ifcfg-bond*.* | awk -F- '{print $2}' | \
(
while read IFACE
do
echo "Found config for vlan interface $IFACE"
PARENT=`echo $IFACE | awk -F. '{print $1}'`
VLAN=`echo $IFACE | awk -F. '{print $2}'`
echo "vconfig add $PARENT $VLAN"
vconfig add $PARENT $VLAN
done
)
Hope this proves useful, I spent a while finding out how to make it all happen automagically. I am now trying to find out why this doesn't work for 10.3. speculatrix (Paul)

