Using KVM in the RHEL 5.4 Beta – fixing bridges

When you use KVM in Rhel 5.4 Beta you will notice that there is no bridge setup to allow your virtual guests to directly connect to the local network.

However, it is easily fixed:

As we are using libvirt, we just need to do two steps, as outlined here:

Step 1: Create the bridge script at /etc/sysconfig/network-scripts/ifcfg-br0

DEVICE=br0
BOOTPROTO=static
TYPE=Bridge
IPADDR=10.20.30.40
NETMASK=255.255.255.0
ONBOOT=yes
NM_CONTROLLED=no

As you can see, I use static IP config.

Step 2: hook up eth0 to the bridge and remove it’s IP config in /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no
TYPE=Ethernet

Now restart the network and done. When you now create a new virtual machine with virt-manager, you can select to have it directly hooked up to the physical network.