<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 05/15/2012 11:12 PM, Laine Stump wrote:
    <blockquote cite="mid:4FB27259.4010204@laine.org" type="cite">
      <pre wrap="">On 05/15/2012 05:33 AM, Michal Privoznik wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">On 15.05.2012 10:57, Lei Li wrote:
</pre>
        <blockquote type="cite">
          <pre wrap="">Hi guys,

I know the macvtap network is supported by libvirt as forward mode
'passthrough', I wonder is there anyway to configure the IP address
for its interface?

For example, If I create a network as below:

<network>
  <name>vdsm-testnet</name>
  <uuid>31f6b3b3-e959-0dd1-ad3a-bf95db660415</uuid>
  <forward dev='eth0.8' mode='passthrough'>
    <interface dev='eth0.8'/>
  </forward>
</network>

For now, I have to set the IP address by 'ifconfig eth0.8 XXX.XXX.XXX.XXX'
after defining the network.
</pre>
        </blockquote>
      </blockquote>
      <pre wrap="">

If only the guest will use the interface, that isn't necessary. As a
matter of fact, once an interface has been assigned to a guest using
macvtap passthrough mode, the host *can't* use the interface (it can
continue to use it in the other macvtap modes, however), so it's
completely pointless to configure an IP address for that interface on
the host.


</pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <pre wrap="">
How can I set IP address for this VLAN device 'eth0.8' by libvirt, I mean
does libvirt support to assign IP address in this mode now? If does,
what is the
xml format for it?
</pre>
        </blockquote>
      </blockquote>
      <pre wrap="">
A network device being used for a guest macvtap connection only needs an
IP address set on the host if the host will also be using that interface
- the guest does not magically acquire/use the IP address that has been
set on the host, it needs its own IP address, configured on the guest in
the same fashion you would configure any other guest interface (keep in
mind that even in macvtap 'bridge' mode, the host and guest cannot
communicate with each other via a macvtap interface). Otherwise, it's
enough for the interface to be defined on the host (it may also be
necessary for it to be "up" if it's a vlan device - I haven't tried
macvtap with vlans). If you are using RHEL or Fedora, you can do any/all
of that configuration with the virsh iface-define command. For example,
here is the xml file that would define an "eth0.8" interface on a host
(This is *not* the <interface> element of a domain configuration):


<interface type="vlan" name="eth0.8">
  <start mode="none"/>
  <protocol family="ipv4">
    <ip address="192.168.43.1"/>
  </protocol>
  <vlan tag="8">
    <interface name="eth0"/>
  </vlan>
</interface>

To get this defined in the system, you would use:

   virsh iface-define eth0.8.xml

But again, it seems doubtful this is what you really want.

</pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <pre wrap="">
It'd appreciate a lot if anybody could read my post and give me some
suggestions!


</pre>
        </blockquote>
        <pre wrap="">I suppose adding:

 <ip address='192.168.123.1' netmask='255.255.255.0'/>

into <network/> should work, doesn't it?
</pre>
      </blockquote>
      <pre wrap="">
No.

The IP address used by the host for that interface (if any) should be
configured in the normal manner of the host system. The IP address used
by any guests using this interface / network based on this interface
should be configured in the guest just as you would any other interface
(if the guest is configured to get its IP address from DHCP, then you
would need to have a DHCP server running *on a different host* connected
to the .8 vlan.

(BTW, note that in passthrough mode, only a single guest can connect to
each physical device, so having a <network> defined for passthrough mode
is mostly only useful if you have a pool of devices available. The way
you have it defined above, only a single guest would be able to use that
network.)
</pre>
    </blockquote>
    <pre>Hi Laine,
<span class="st"><em>
</em></span>Thank you for your detailed reply!
The vdsm support bridgless network by libvirt through passthrough mode, it just
define a network by the xml format:

<network>
  <name>vdsm-XXX</name>
  <uuid>...</uuid>
  <forward dev=... mode='passthrough>
    <interface dev=.../>
  </forward>
</network>

I want to let IP address config for the host network enabled. It doesn't have to 
be connected by a VLAN device, <span id="result_box" class="short_text" lang="en"><span class=""></span><span class="hps">a simpler example</span></span>, If I create a bridgeless 
network by passthrough mode, its interface is eth0. What is the xml format for 
the host to let the IP address configuration enabled?

Thanks! 
</pre>
    <blockquote cite="mid:4FB27259.4010204@laine.org" type="cite">
      <pre wrap="">
--
libvir-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:libvir-list@redhat.com">libvir-list@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/libvir-list">https://www.redhat.com/mailman/listinfo/libvir-list</a>

</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Lei</pre>
  </body>
</html>