[CentOS-virt] Bonds, VLANs, and Bridges on Centos 5.6

Tue Nov 22 17:39:02 UTC 2011
David Martin <dmartls1 at gmail.com>

We are doing this quite a bit in production and it works great.

bond as you normally would:
DEVICE=bond0
ONBOOT=yes
USERCTL=no
BONDING_OPTS="mode=4 miimon=100"

one of these for each vlan (in this case 50):
VLAN=yes
VLAN_NAME_TYPE=VLAN_PLUS_VID_NO_PAD
DEVICE=vlan50
PHYSDEV=bond0
TYPE=Ethernet
ONBOOT=yes
BRIDGE=br50

and finally the bridge device to expose to guests:
DEVICE=br50
TYPE=Bridge
ONBOOT=yes
DELAY=0
GATEWAYDEV=none




On Tue, Nov 22, 2011 at 10:07 AM, Tait Clarridge <tait at taiter.com> wrote:
> On Fri, 2011-11-18 at 17:56 -0500, Jason Nagashima wrote:
>> Running on Centos 5.6 with KVM...
>>
>> I was wondering if anyone had any luck configuring the NICs where eth0 and eth1 are bonded together with vlan support to a bridge?
>>
>> I noticed some threads show this as a possibility (http://lists.centos.org/pipermail/centos-virt/2009-November/001417.html), but haven't had any luck implementing it.  There also seems to be a bug with 5.6 (http://bugs.centos.org/view.php?id=4801), but that post died the day it was created it.
>>
>> Any advice/working examples would be greatly appreciated.
>
> Hi Jason,
>
> I have had luck doing this with Xen, where I create bond0 on a trunk
> interface and have xen bring it up as xenbr0 with pbond0 in the back
> end.
>
> You should be able to do roughly the same by creating a bridge interface
> in /etc/sysconfig/network-scripts referencing bond0 as a member.
>
> After that you should be able to run a script to create VLAN bridges
> like the following:
>
> #!/bin/bash
> /sbin/modprobe 8021q
>
> # Add your vlans here that you want with the numbers separated by a
> # space
> VLANS="5 10 15 20"
> # This should work with the bonding interface
> TRUNKINT="bond0"
> for VLAN in $VLANS
> do
>        vconfig add $TRUNKINT $VLAN
>        brctl add br$VLAN
>        brctl addif br$VLAN $TRUNKINT.$VLAN
>        ifconfig $TRUNKINT.$VLAN up
>        ifconfig br$VLAN up
> done
>
> I have done this with Xen on 5.5, 5.6 and 5.7... but it should work for
> KVM. If you create the standard bridge interface br0 using just bond0
> that will get you a trunk on whatever the native vlan is for that trunk.
>
> Tait
>
>
> _______________________________________________
> CentOS-virt mailing list
> CentOS-virt at centos.org
> http://lists.centos.org/mailman/listinfo/centos-virt
>