<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 11/21/2013 11:24 PM, Nehal J Wani
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAG6NSrkUbvjDOO7XzSUaSTzSqEQjcUtKM7CEuKXJPdpieaQgfQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">Currently, I have two networks configured via xml:<br>
        <br>
        virsh # net-dumpxml TestNetwork1<br>
        <network connections='2'><br>
          <name>TestNetwork1</name><br>
          <uuid>a76f665a-0196-4edb-81b4-340944a6869c</uuid><br>
          <forward dev='p1p1' mode='nat'><br>
            <nat><br>
              <port start='1024' end='65535'/><br>
            </nat><br>
            <interface dev='p1p1'/><br>
          </forward><br>
          <bridge name='virbr0' stp='on' delay='0'/><br>
          <mac address='52:54:00:0b:e9:35'/><br>
          <ip address='192.168.100.1' netmask='255.255.255.0'><br>
            <dhcp><br>
              <range start='192.168.100.128'
        end='192.168.100.254'/><br>
            </dhcp><br>
          </ip><br>
        </network><br>
        <br>
        virsh # net-dumpxml default6<br>
        <network connections='1'><br>
          <name>default6</name><br>
          <uuid>6e57d831-f09e-4b33-950d-6d51c89f9786</uuid><br>
          <forward mode='nat'/><br>
          <bridge name='virbr3' stp='on' delay='0'/><br>
          <mac address='52:54:00:cb:c5:50'/><br>
          <ip family='ipv6' address='2001:db8:ca2:2::1'
        prefix='64'><br>
            <dhcp><br>
              <range start='2001:db8:ca2:2:1::10'
        end='2001:db8:ca2:2:1::ff'/><br>
            </dhcp><br>
          </ip><br>
        </network><br>
        <br>
        # brctl show<br>
        <div>bridge name<span class="" style="white-space:pre"> </span>bridge
          id<span class="" style="white-space:pre"> </span>STP enabled<span
            class="" style="white-space:pre"> </span>interfaces</div>
        <div>virbr0<span class="" style="white-space:pre"> </span>8000.5254000be935<span
            class="" style="white-space:pre"> </span>yes<span class=""
            style="white-space:pre"> </span>virbr0-nic</div>
        <div><span class="" style="white-space:pre"> </span>vnet0</div>
        <div><span class="" style="white-space:pre"> </span>vnet1</div>
        <div>virbr3<span class="" style="white-space:pre"> </span>8000.525400cbc550<span
            class="" style="white-space:pre"> </span>yes<span class=""
            style="white-space:pre"> </span>virbr3-nic</div>
        <div><span class="" style="white-space:pre"> </span>vnet2</div>
        <div><br>
        </div>
        <div>My queries are:</div>
        <div>(i) For each interface that I attach to my guests, will a
          new vnetX (X=0,1,2,3,...) be created?</div>
      </div>
    </blockquote>
    <br>
    Yes. Each guest interface (except those of type='hostdev', which are
    just host hardware devices passed through to the guest) has a
    corresponding unique vnetX tap device or macvtapX device. The socket
    end of this tap/macvtap device is connected to the qemu process, and
    the netdev end is connected to a Linux host bridge, OpenvSwitch
    bridge (in the case of tap), or directly to a host network device
    (in the case of macvtap).<br>
    <br>
    <br>
    <blockquote
cite="mid:CAG6NSrkUbvjDOO7XzSUaSTzSqEQjcUtKM7CEuKXJPdpieaQgfQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          (ii) Can two different active networks share the same bridge?
          Example, can the xml of two active networks have the same
          line <bridge name='virbr0' stp='on' delay='0'/> ?</div>
      </div>
    </blockquote>
    <br>
    No, not for libvirt-managed virtual networks. It *is* possible for
    two libvirt "unmanaged" networks (which merely shadow
    already-existing host system bridge devices without adding any extra
    services such as dhcp, dns, or iptables rules) to specify the same
    bridge device, but I don't think that's what you're talking about
    (and I also see no practical value in doing that).<br>
    <br>
    <blockquote
cite="mid:CAG6NSrkUbvjDOO7XzSUaSTzSqEQjcUtKM7CEuKXJPdpieaQgfQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>(iii) If the answer for (ii) is false, how can I obtain the
          interface name for a given bridge name in libvirt?</div>
      </div>
    </blockquote>
    <br>
    What do you mean by "the interface name for a given bridge name"? A
    bridge *is* a type of network device, i.e. an interface from the
    host's point of view.<br>
    <br>
    If you're wondering how to get a list of all vnetX interfaces that
    are attached to a particular bridge via libvirt, the answer is
    either 1) you don't, or 2) you would need to cycle through all
    active guests looking for guest interfaces that use the network
    you're interested in, and grab the interface name from that guest's
    <interface> xml. libvirt's networks don't maintain a
    ready-made list of the devices that are attached to that network,
    because it would need to be reconstructed whenever libvirt was
    restarted, and up until now nobody has needed it.<br>
  </body>
</html>