Mar 11, 2013

Ubuntu12.04 libvirt virbr0 network bridge setup

Offical Ubuntu website provides a very good and thorough guide for installing Xen in Ubuntu.

But, I personally prefer libvirt for managing network bridges, not changing network configuration as stated in the official website. So, I install libvirt:
sudo apt-get install libvirt0
Then type
virsh net-list --all
It shows nothing!!? That is because on Ubuntu. You need to add user to libvirtd
adduser `id -un` libvirtd
Don't use "adduser $user libvirtd". I tried this one first but it did not work.


Then, load default bridge setting by
sudo virsh net-define /var/lib/libvirt/network/default.xml
Note: the path is not the same as /usr/share/libvirt/networks/default.xml, which is demonstrated on libvirt wiki.


Next, start bridging and make it auto start:

virsh net-autostart default
virsh net-start default

This Ubuntu is running Xen inside Virtual Box. So, sub-network  is a problem. You may see
error: internal error Network is already in use by interface eth0
Then, if you type "virsh net-list --all" to show again, it indicates the device is inactive.

That is because 192.168.122.xxx is the default. But, the host machine is already using 192.168.122.xxx. So, the bridge can not be setup.
Solution:
I change the subnet to 192.168.1.xxx. in /var/lib/libvirt/network/default.xml
Now, type "ifconfig" and you should see virbr0 is there.

References
http://ubuntuforums.org/showthread.php?t=1789126
http://wiki.libvirt.org/page/Networking

Ending picture today:
Capital hill and its Christmas tree [courtesy of my dear wife - Claire Huang]



No comments:

Post a Comment