What is MacVTap?

Definition

MacVTap is a Linux device driver, based upon the combination of – Macvlan and TAP (descriptions below), that allows for the creation of virtual (tap-like) interfaces. Each virtual network interface is assigned its own MAC and IP address, then attached to the physical interface (also know as the lower interface),

  • Macvlan – Linux kernel driver that makes it possible to create virtual network interfaces that can be attached to the physical network adapter (aka the lower interface).
  • TAP – A software only interface that allows user space programs to read and write via TAP device files (/dev/tapN).

MacVTap Standard 1

Figure 1 – MacVTap Overview

Modes

There are 4 modes of operation that control how the endpoints communicate with each other – VEPA, Bridge, Private and Passthrough.

  • Virtual Ethernet Port Aggregator (VEPA) – The default mode. Data from one endpoint to another endpoint on the same lower device gets sent down the lower device to the external switch[10]. However the switch must support VEPA (i.e hairpin mode) in order for the frame to be sent back into the lower interface, to the destination endpoint.
  • Bridge – Endpoints can communicate between each other WITHOUT the need of going out the physical NIC.
  • Private – Endpoints upon on the same host can only communicate via an external router or gateway ONLY.
  • Passthru – Most commonly used, attaches a physical interface device or SR-IOV VF directly to the MacVTap (Figure 2).

MacVTap Passthru 1 Figure 2 – Passthru mode

OpenStack Neutron

And finally, lets discuss OpenStack.

OpenStack Neutron provides support for the macvtap port type. This port type is implemented via the MacVTap passthru mode. Due to the kernels visibility into the MacVTap interfaces — unlike SR-IOV where there is a complete kernel bypass when moving the packets from the NICs Virtual Function to VM — the macvtap port type allows for the support and ability to perform live migrations.

Rick Donato

Want to become a Linux expert?

Here is our hand-picked selection of the best courses you can find online:
Linux Mastery course
Linux Administration Bootcamp
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial