HOWTO: Enabling Bridging for Libvirtd QEMU

I need to implement an SNMP setup for Inigo, and I need a number of virtual machines for understanding SNMP and for testing and exploring possible solutions. Before this, I used Xen through virt-manager for my virtualization needs, but recently it feels like its more pain in the ass when I need to install various distro and OSes on the VM to test. Plus, Xen caused some weird problems which I don't really understand (one of it are the Xen bridging, on random, refused to work after reboot). So, I switched to use the normal kernel with Qemu instead to avoid the headache.

Thanks to Jonathan (daMaestro), I got the Qemu bridge working. The howto I followed from watzmann.net does not work for me because of what I believe some missing details for me understand the setup and set it properly.

Creating a Bridge

Lets assume we want to create a bridge called br0, which will be bridged to eth0. The host will be using a static IP 192.168.0.20 on a /24 network, with a gateway 192.168.0.1.

Edit /etc/sysconfig/network-scripts/ifcfg-br0. Change it to be similar to this.


DEVICE=br0
BOOTPROTO=static
IPADDR=192.168.0.20
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
ONBOOT=yes
TYPE=Bridge


Then, edit /etc/sysconfig/network-scripts/ifcfg-eth0 to this.


DEVICE=eth0
HWADDR=$MACADDRESS
ONBOOT=yes
BRIDGE=br0


(Replace $MACADDRESS with the MAC address of your network card.)

Afterward, restart the network `/sbin/service network restart`

From this point, you should be able to select the bridge when you are creating a new VM through virt-manager.

Firewall

You will need to set br0 as a trusted interface through system-config-firewall before you'll be able to use the network.

Yay, now I feel much more comfortable on Qemu.

Comments

Anonymous said…
do you think it would be possible to convert these instructions to work with wlan0 instead of eth0?

Best regards,
John.
Y0nd13 said…
This comment has been removed by the author.

Popular posts from this blog

Tee'ing Python subprocess.Popen output

Consolidated community site infrastructure on Plone

HOWTO: Linux Container (LXC) on Fedora 12