[libvirt-users] libvirt problems. Create bridged network via cmdline?

Chris Lalancette clalance at redhat.com
Mon Nov 1 12:56:50 UTC 2010

On 10/29/10 - 12:55:49AM, Денис Барышев wrote:
> Hello!
> I've faced a weird problem. And I totally can't understand how libvirt
> handles networks. The thing that i need to do is simple. I create a bridge
> in my ubuntu host, the following config:
> *iface eth0 inet manual*
> *
> *
> *auto br0*
> *iface br0 inet dhcp*
> *  bridge_ports eth0*
> *  bridge_stp on*
> *  bridge_maxwait 0*
> That's OK, and my bridge turns up automatically. But I don't understand why
> libvirt can't use it, it always want to create bridge on its own. So that
> when I try to create bridged network with the command:
>   virsh virsh net-create net.xml
> net.xml contents:
> * <network>*
> *  <name>virbreth0</name>*
> *  <bridge name='br0' stp='on' delay='0' />*
> * </network>*
> I always get error ===>
> error: Failed to create network from net.xml
> error: cannot create bridge 'br0': File exists
> That's pretty obvious that libvirt wants to create bridge on its own. But
> what should I do in my specific situation. May be there is a workaround.
> I appreciate any help and ideas...

It is not exactly clear to me, but what I think you are trying to do is to
create the bridge by hand, and then have libvirt guests use it.  If that is
the case, then you do not need to use the virsh net-create command at all;
like you see, net-create tries to "create" the bridge.  If all you want to
do is use the bridge that you have already setup, then you just need to add
a section to your *guest* XML like:

<domain type='kvm'>
    <interface type='bridge'>
      <source bridge='br0'/>

And then your guest will start up connected to the br0 bridge.

Chris Lalancette

More information about the libvirt-users mailing list