Skip to main content

Configuring bridging, bonding, vlans on CentOS/RedHat 6.x

/etc/sysconfig/network-scripts/ifcfg-em1 and em2

DEVICE=<device-name>
ONBOOT=yes
HWADDR=XX:XX:XX:XX:XX:XX

/etc/sysconfig/network-scripts/ifcfg-em1.vlanid (example ifcfg-em1.20)

DEVICE=<device>.<vlanid>
ONBOOT=yes
VLAN=yes
BOOTPROTO=none
SLAVE=yes
MASTER=bond

/etc/sysconfig/network-scripts/ifcfg-bond (example ifcfg-bond20)

DEVICE=bond<vlanid>
ONBOOT=yes
BONDING_OPTS="mode=active-backup primary=em1 miimon=100"
BOOTPROTO=none
BRIDGE=br<vlanid>
MACADDR=<RANDOM_MAC>

/etc/sysconfig/network-scripts/ifcfg-br (example ifcfg.br20)

DEVICE=br<vlanid>
ONBOOT=yes
TYPE=Bridge
DELAY=0
BOOTPROTO=static
IPADDR=X.X.X.X
NETMASK=X.X.X.X

So, creating 3 vlans (20, 200, 250) on a 2 interface bond (em1, em2) creates the following set of configfiles:

ifcfg-em1:

Base configuration for em1

ifcfg-em2:

Base configuration for em2

ifcfg-em1.20:

Vlan 20 interface on em1 interface

ifcfg-em1.200:

Vlan 200 interface on em1 interface

ifcfg-em1.250:

Vlan 250 interface on em1 interface

ifcfg-em2.20:

Vlan 20 interface on em2 interface

ifcfg-em2.200:

Vlan 200 interface on em2 interface

ifcfg-em2.250:

Vlan 250 interface on em2 interface

ifcfg-bond20:

Bonding em1.20 with em2.20

ifcfg-bond200:

Bonding em1.200 with em2.200

ifcfg-bond250:

Bonding em1.250 with em2.250

ifcfg-br20:

Create a bridge on bond20

ifcfg-br200:

Create a bridge on bond200

ifcfg-br250:

Create a bridge on bond250