Linux, Embedded Systems, Networking, and DevOps Engineering

Linux MacVLAN interface

Table of contents

  1. Revision history
  2. Definition
  3. Operating modes of macvlan interfaces
    1. Macvlan private
    2. Macvlan VEPA
    3. Macvlan bridge
    4. Macvlan passthrough
  4. Disadvantages of macvlan
  5. How to create macvlan interface

Revision history

  Revision Date Remark
  0.1 Jan-12-2023 Initialize document

Definition

Girl in a jacket

- Macvlan is a virtual soft interface operating at layer 2, it's a sub-interface created from a physical interface.
- The Kernel's network stack creates an interface with a different MAC address from the physical interface's MAC address.
- The physical interface needs to support `promiscuity` mode to support transmitting and receiving packets with source and destination MAC addresses different from the physical interface's MAC address.
- The Kernel routes packets between the virtual interface and physical interface based on the MAC address in the ethernet frame.

Operating modes of macvlan interfaces

Macvlan private

Girl in a jacket

- In this mode, sub-interfaces cannot communicate with each other, meaning the Kernel doesn't route packets based on MAC to forward to the corresponding sub-interface.
- All data is forwarded to the physical interface for external transmission.

Macvlan VEPA

Girl in a jacket

- In this mode, ethernet frames are inserted with specialized data. A VEPA-supporting Switch at the endpoint is required to forward packets back to the physical interface.

Macvlan bridge

Girl in a jacket




- In this mode, packets between sub-interfaces are sent internally through a simple bridge.
- Broadcast traffic is sent both internally between sub-interfaces and externally through the physical interface.

Macvlan passthrough

Girl in a jacket

- In this mode, we only create one sub-interface and connect it directly to the physical interface. This way, we can change the MAC address and other interface parameters in the virtual machine without affecting the main interface.

Disadvantages of macvlan

How to create macvlan interface

See the article Linux Virtual Interfaces