What is MacVTap?
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).
Figure 1 - MacVTap Overview
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. 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).
Figure 2 - Passthru mode
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.