Connecting user-session VMs

VMs spawned in a libvirtd user-session are not connected by default because they use SLIRP connectivity (don’t ask me about the SLIRP details). However, this means the network is just within the process and NATed to the outside world. If oyu now have several VMs in the user-session, they can not speak to each other, because they are separate processes, and because each of them is getting NATed, one doesn’t see the other.

To workaround this issue you can use the following snippet to attach an additional network device to a VM, which is using a UDP multicast group to distribute it’s network traffic. If you use this snippet (with different MACs) for all VMs in the user session, they all get attahced to the same multicast group and can thus see each other - if the network interface within the guest is configured correctly.

The magic:

<qemu:commandline
 xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">
  <qemu:arg value='-netdev'/>
  <qemu:arg value='socket,id=busnet0,mcast=230.0.0.1:1234'/>
  <qemu:arg value='-device'/>
  <qemu:arg value='virtio-net-pci,netdev=busnet0,mac={mac}'/>
</qemu:commandline>

This bug is tracking an RFE to add this functionality to libvirtd.

::: {#footer} [ November 5th, 2015 11:06am ]{#timestamp} [qemu]{.tag} [libvirt]{.tag} [fedora]{.tag} [vm]{.tag} :::