What is the difference between MacVTap and Bridge?

Google ADs

MacVTap creates virtual interfaces for VMs with direct kernel-level packet forwarding, offering high performance and ease of setup. Whereas, a Bridge connects VMs to the physical network like a switch, offering more flexibility for complex networking setups.

In the computing world physical systems are getting replaced in virtual devices be it systems, CPU, memory, storage and networking. There are several virtual components available in operating systems one such device driver is MacVTap device which is a Linux kernel (device driver) which makes both host and guest appear on the same physical network switch with bridged networking. The virtual network interface needs to be tied to the physical interface for actual communication to take place between virtual systems and the host (virtual). 

MacVTap is Ethernet connection virtualization technique which provides virtual network interfaces (NICs) for virtual Machines guest OS. Bridged networking is a predecessor of MacVTap which works in a different manner to enable connectivity between virtual and physical networks. 

Google ADs

In today’s article we will understand the purpose of using MacVTap and how  it is different from bridged networking. 

What is a MacVTap device? 

MacVTap is a Linux kernel device driver which creates virtual network interfaces (NICs) for guest operating systems (OS) machines having Tap device and MacVlan driver components. MacVTap depends on the MacVlan device driver which lets creation of ‘virtual interfaces’ tagged to a ‘physical interface’. Each virtual interface is assigned a unique MAC address different from its physical interface (MAC ID). Frames transmitted from virtual interface mapped to physical interface are known as lower interface. 

Frames are red and written by user space program by tap interface which is software-only, no actual frames are passed to / from to physical Ethernet card. The tap interface is made available by kernel via [/dev/tapN], where N represents network interface index. 

Command to create a MacVTap interface

Below command creates a MacVTap interface 

$ sudo ip link add link eth0 name macvtap1 type macvtap mode vepa | bridge | private | passthru
$ sudo ip netns exec ns12 ip link show macvtap10

What is Bridge networking? 

Bridge networking is another technique to connect virtual machines to physical networks but using a slightly different approach and technique. It is the predecessor of MacVTap technique which is a newer method and helps in improving performance and reduces latency. In Bridge networking, a bridge interface is produced to link virtual machine interface (Tap) to physical network interface.

The host also participates in this kind of networking as a bridge is created on the host machine to which the VM virtual interface is connected hence the bridge acts as a link between physical interface and virtual machine interface. Since a virtual machine is directly connected to the host machine’s physical network it appears as another physical device on the network and the virtual machine obtains an IP address from the host network for direct interaction with several, distinctive devices on the same network. 

Comparison: MacVTap vs Bridge 

FeaturesMacVTap deviceBridge
ConnectionMacVTap connects directly to host interfaceMakes use of bridge on host interface to create link
Host communicationDirect communication between host and VMHost communication setup may require a bridge to be configured
Performance* Lower CPU usage and faster communications
* Improved throughput with reduction in latency to external systems
High CPU usage and experience latency / delays due to involvement of extra layers of processing
Complexity of deploymentEasier compared to full bridge setupSimplified configuration
LimitationsMACVTap is not capable of address learning and MacVlan interface can’t be bridged to a second physical deviceVirtual machines are exposed to host network risks
ScalabilityMacVTap provides ease of scalability and better equipped to handing increasing loads and high-volume traffic requirementsMeant for single host environments as deployment scale to multiple hosts it becomes complex to manage complex configurations and manage optimal performance

Download the comparison table: MacVTap vs Bridge

ABOUT THE AUTHOR


Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart