[libvirt-users] How to insert a dummy NIC

wferi at niif.hu wferi at niif.hu
Mon Mar 11 09:05:16 UTC 2019


Hi,

I have to host (with KVM) an appliance which does not use its second and
third NIC.  They have to be present in the guest, but they'd better stay
totally disconnected from anything in the host.  "Second" and "third"
apparently means bus order.  Let's consider virtio devices only.  I think
the best technical solution is adding -device virtio-net-pci,addr=0x3 and
similar options to the KVM command line, without any corresponding
-netdev options (better ideas welcome).  QEMU emits "Warning: nic
virtio-net-pci.2 has no peer" messages, but that's expected.  I can even
do this much using the <qemu:commandline> element, but libvirt assigns
the 0x3 address to other virtio devices, leading to collision.  Is there
a way to "reserve" a bus address for such manually added devices without
assigning explicit addresses to all other devices in the configuration?

Things I also tried (and found inadequate):

* Using "generic ethernet connection" for the dummy NICs.  Close, but
  requires extra permissions for accessing /dev/net/tun, and technically
  feels a little inferior to using a peerless network device like above.

* TCP tunnel server.  Even more inferior, does not require extra
  permissions but leaves even looser ends (listening sockets).  Also, the
  RelaxNG grammal does not let me specify a model for this interface
  type, so maintaining bus order with respect to the virtio interfaces is
  impossible.  A grammar bug?

* Using a dummy VLAN in the bridge.  This is what I temporarily settled
  for, but this requires global agreement and still technically inferior,
  so I'd like to move away.

* A <network> without forwarding.  Still inferior, and also requires
  configuration sharing across the host cluster.
-- 
Thanks,
Feri




More information about the libvirt-users mailing list