[libvirt-users] Basic Network Connections

Laine Stump laine at laine.org
Mon Apr 29 15:10:34 UTC 2013


On 04/26/2013 02:41 PM, Slater, Joseph wrote:
>
> Hi,
>
>  
>
> If I have these fragments in a domain definition, the guest will start
> with "eth0"
>
> assigned by dhcp to an address on my lan.  Things seem to work
> according to the documentation
>
> I can find.
>
>  
>
>   <network>
>
>     <name>direct-macvtap</name>
>
>     <forward mode='bridge'>
>
>       <interface dev='eth0' />
>
>     </forward>
>
>   </network>
>
>   <devices>
>
>     <interface type='direct'>
>
>       <mac address='00:15:17:A6:BC:C9' />
>
>       <source dev='eth0' mode='bridge' />
>
>       <model type='virtio' />
>
>     </interface>
>
>  </devices>
>
>  
>
> I don't understand the <network> part here.  It doesn't seem to be
> documented.  I inherited these pieces
>
> so I do not know why they are as they are.
>

The <network> part shouldn't be in the domain's XML. It should be used
to separately define a libvirt network. Put that part in "direct.xml"
(for example) and run:

   virsh net-define direct.xml
   virsh net-autostart direct-macvtap
   virsh start direct-macvtap


However, your <interface> definition isn't even using that network; it's
specifying the macvtap connection directly (with <source dev='eth0'
mode='bridge'/>) so the network definition isn't even needed.

(btw, the <network> xml is documented here:
http://www.libvirt.org/formatnetwork.html )

>  
>
> If, instead, I have the following, the guest comes up with no network
> interface at all
>
> (except lo).  On the host, interfaces vnet0 and virbr0 exist and
> virbr0 is 192.168.122.1.
>
>  
>
>   <devices>
>
>    <interface type='network'>
>
>       <source network='default'/>
>
>     </interface>
>
>   </devices>
>
>  
>
> Adding in
>
>  
>
>       <model type='virtio' />
>
>  
>
> makes it start with "eth0", but no address has been assigned.  I can
> manually do that and then
>
> I can communicate with the host but it's kind of a pain to add the
> address and routing manually.
>

That could be caused by one of the problems described here:

  http://wiki.libvirt.org/page/PXE_boot_%28or_dhcp%29_on_guest_failed

In general, take a look at

  http://wiki.libvirt.org/page/Troubleshooting


> Oddly enough, though, ping from host to guest works normally, but ping
> guest to host seems to succeed once
>
> then hang (with no timeout).
>
>  
>
> It is not at all obvious to me how virtio magically creates eth0.
>
>  
>
> Am I doing something wrong, here?  And, if anyone could advise how to
> use openvswitch
>
> I'd appreciate it.  I've seen adding
>
>  
>
> <virtualport type='openvswitch/>
>
>  
>
> might be enough, presumably with an appropriate name for the source
> network.
>

(you're really jumping all over the place here :-)

You need a new enough version of libvirt to support openvswitch (at
least 0.9.11, or 0.10.0 if you're using vlans), as well as a new enough
kernel, and you need to have the openvswitch package(s) installed.

There are several guides for doing this. Here's one that came up on Google:

   http://blog.scottlowe.org/2012/11/07/using-vlans-with-ovs-and-libvirt/


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20130429/7cb5610e/attachment.htm>


More information about the libvirt-users mailing list