Re: can this vm-xml-interface works,thanks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/14/2013 05:49 AM, yue wrote:
> hi,all,please look at interface .
> actually ,virbr0 is NAT,      my program product a vm-xml  which is
> not standard. it use the way to product bridge interface   to product
> a NAT interface.
> but i want to know if this can work rightly.
>
> <interface type='bridge'> #"type='network'"
>       <mac address='00:1a:4a:a8:7a:09'/>
>       <source bridge='virbr0'/># network='virbr0'
>       <target dev='vnet0'/>
>       <model type='virtio'/>
>       <boot order='3'/>
>       <alias name='net0'/>
>       <address type='pci' domain='0x0000' bus='0x00'! slot='0x03'
> function='0x0'/>
>     </interface>

I'm not sure I understand your question. Are you wondering if (A) below
is functionally the same as (B)?

A
-
  <interface type='bridge'>
    <mac address='00:1a:4a:a8:7a:09'/>
    <source bridge='virbr0'/>
    <target dev='vnet0'/>
    <model type='virtio'/>
    <boot order='3'/>
    <alias name='net0'/>
    <address type='pci' domain='0x0000' bus='0x00'! slot='0x03'
function='0x0'/>
  </interface>

B
-

  <interface type='network'>
    <mac address='00:1a:4a:a8:7a:09'/>
    <source network='default'/>   <!-- you had incorrectly said "virbr0" -->
    <target dev='vnet0'/>
    <model type='virtio'/>
    <boot order='3'/>
    <alias name='net0'/>
    <address type='pci' domain='0x0000' bus='0x00'! slot='0x03'
function='0x0'/>
  </interface>

The answer to that question is "Yes, but...".

If we assume that libvirt's "default" network has been setup, and that
it is using the name "virbr0" for its bridge device (which is almost
always true, but only be coincidence), then those two interface
definitions will provide the same result.

However, if there is no network named "default", or if the default
network happened to be defined after some other network was already
defined, and so picked a name different from "virbr0" for its bridge
device, then (A) either wouldn't work at all, or would result in the
guest being connected to the wrong place.

Is there some reason you want to use type='bridge' rather than
type='network'?

(BTW, you may want to subscribe to libvirt-users@xxxxxxxxxx and use it
for questions like this. The amount of traffic is much lower, so your
question would be less likely to be buried underneath bunches of patch
emails)

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]