[libvirt] what determines the type of virtual NIC in libvirt (veth or tap)?

Laine Stump laine at laine.org
Thu Sep 20 15:52:22 UTC 2018


On 09/20/2018 04:52 AM, Frank Wang wrote:
> Hi All,
>
> I'd like to know what determines the type of virtual NIC in libvirt ?
> There was a problem I encountered, the vm can't get the mirror traffic
> while the virtual port in openvswitch is veth, If the virtual port is
> tun, the everything is fine.
>
> [root at allinone-247 ~]# ethtool -i vn62f717800
> driver: veth
> version: 1.0
> firmware-version:
> expansion-rom-version:
> bus-info:
> supports-statistics: yes
> supports-test: no
> supports-eeprom-access: no
> supports-register-dump: no
> supports-priv-flags: no
>
> I uninstall the veth kernel module, then restart vm, then the vm can
> receive the mirror traffic
>
> [root at allinone-247 ~]# ethtool -i vn62f717800
> driver: tun
> version: 1.6
> firmware-version:
> expansion-rom-version:
> bus-info: tap
> supports-statistics: no
> supports-test: no
> supports-eeprom-access: no
> supports-register-dump: no
> supports-priv-flags: no
>
> so, I'm wondering if there are configuration options which can be
> configured to use which type of virtual NIC(tap or veth).
>
> Any comments would be appreciate.

>From IRC, here is the <interface> you posted:

     <interface type="bridge">
       <mac address="00:16:3e:73:30:07"/>
       <source bridge="managevSwitch"/>
       <vlan>
         <tag id="0"/>
       </vlan>
       <virtualport type="openvswitch">
         <parameters interfaceid="8a344c7762a32b2d0162db9d09f42efa"/>
       </virtualport>
       <target dev="vnfa3b798b1"/>
       <model type="virtio"/>
       <address type="pci" domain="0x0000" bus="0x0" function="0x0"
slot="0x11"/>
     </interface>


If you are creating a qemu/kvm virtual machine, the above interface
config will *always* get you a tap device, and if you are creating an
LXC virtual machine it will always get you a veth device. This is a
necessity of the way the two technologies expose the network device in
the guest; if you are getting a veth device for use with qemu/kvm, or a
tap device for use with LXC, then there is something going on that I
don't understand.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180920/9e689948/attachment-0001.htm>


More information about the libvir-list mailing list