Blog|How To|Linux|Linux-KVM

Linux KVM: Bridging a Bond on CentOS 6.5

Linux KVM: Bridging a Bond on CentOS 6.5

Today we are going to hop back into the KVM fray, and take a  look at using CentOS as a hypervisor., and configuring very resilient network connections to support our guests.  Of course these instructions should be valid on Red Hat Linux and Oracle Linux as well, though there is a little more to be done around getting access to the repos on those distributions…

Enable Bonding

I am assuming this is a first build for you, so this step might not be applicable, but it won’t hurt anything.

# modprobe –first-time bonding

Configure the Physical Interfaces

In our example we will be using two physical interfaces, eth0 and eth1.  Here are the interface configuration files.

# cat /etc/sysconfig/network-scripts/ifcfg-eth0<br />

DEVICE=eth0<br />

HWADDR=XX:XX:XX:XX:XX:XX<br />

ONBOOT=yes<br />

NM_CONTROLLED=no<br />

BOOTPROTO=none<br />

MASTER=bond0<br />

SLAVE=yes<br />

USERCTL=no

# cat /etc/sysconfig/network-scripts/ifcfg-eth1<br />

DEVICE=eth1<br />

HWADDR=XX:XX:XX:XX:XX:XX<br />

ONBOOT=yes<br />

NM_CONTROLLED=no<br />

BOOTPROTO=none<br />

MASTER=bond0<br />

SLAVE=yes<br />

USERCTL=no

Configure the Bonded Interface

Here we are going to bond the interfaces together, which will increase the resiliency of the interface.

# cat /etc/sysconfig/network-scripts/ifcfg-bond0<br />

DEVICE=bond0<br />

ONBOOT=yes<br />

NM_CONTROLLED=no<br />

BOOTPROTO=none<br />

USERCTL=no<br />

BONDING_OPTS=&quot;mode=1 miimon=100&quot;<br />

BRIDGE=br0

Configure the Bridge

The final step is to configure the bridge itself, which is what KVM creates the vNIC on to allow for guest network communication.

# cat /etc/sysconfig/network-scripts/ifcfg-br0<br />

DEVICE=br0<br />

TYPE=Bridge<br />

ONBOOT=yes<br />

NM_CONTROLLED=no<br />

BOOTPROTO=none<br />

USERCTL=no<br />

IPADDR=192.168.1.10<br />

NETMASK=255.255.255.0<br />

GATEWAY=192.168.1.1<br />

DELAY=0

Service Restart

Finally the easy part.  Now one snag I ran into.  If you created IP addresses on bond0, then you will have a tough time getting rid of that with a service restart alone.  I found it was easier to reboot the box itself.

# service network restart

News & Insights