Create bridge device on my KVM host

I installed KVM on my debian host. Since I have 8 cores and 32GB RAM I have room to play around 🙂 And since I have some experience with KVM it was the obvious choice.

Installing KVM : easy … apt is your friend
Creating an VM : easy … Maybe I’ll once write it up

I could connect to the VM, using the console. However from within the VM I could only ping itself. I forgot to create a (virtual) bridge device which connect the VMs to the host machine.

So what to do:
Create br0.xml

root@radijs:~# cat br0.xml 
  <forward mode='nat'>
      <port start='1024' end='65535'/>
  <bridge name='br0' stp='on' delay='0'/>
  <ip address='' netmask=''>
      <range start='' end=''/>

Make KVM aware of the bridge:

root@radijs:~# virsh net-define br0.xml 
Network br0 defined from br0.xml


Start the just defined bridge:

root@radijs:~# virsh net-start br0
Network br0 started


Make sure it will autostart,

root@radijs:~# virsh net-autostart br0
Network br0 marked as autostarted


Do I now actually have a bridge:

root@radijs:~# virsh net-list
 Name   State    Autostart   Persistent
 br0    active   yes         yes


Yes I have.

The proof of the pudding is in the eating:…Can I now reach the world from my VM’s?
I can not show you….but yes ….I can.


Leave a Reply

Your email address will not be published. Required fields are marked *