Macvlan介绍

1. 简介

macvlan可以看做是物理接口eth(父接口)的子接口,每个macvlan都拥有独立的mac地址,可以被绑定IP作为正常的网卡接口使用。通过这个特性,可以实现在一个物理网络设备绑定多个IP,每个IP拥有独立的mac地址。该特性经常被应用在容器虚拟化中(容器可以配置macvlan的网络,将macvlan interface移动到容器的namespace中)。

示意图:

2. 四种工作模式

2.1. VEPA (Virtual Ethernet Port Aggregator)

VEPA为默认的工作模式,该模式下,所有macvlan发出的流量都会经过父接口,不管目的地是否与该macvlan共用一个父接口。

2.2. Bridge mode

该bridge模式类似于传统的网桥模式,拥有相同父接口的macvlan可以直接进行通信,不需要将数据发给父接口转发。该模式下不需要交换机支持hairpin模式,性能比VEPA模式好。另外相对于传统的网桥模式,该模式不需要学习mac地址,不需要STP,使得其性能比传统的网桥性能好得多。但是如果父接口down掉,则所有子接口也会down,同时无法通信。

2.3. Private mode

该模式是VEPA模式的增强版,

2.4. Passthru mode

.

待完善

参考:

  • https://backreference.org/2014/03/20/some-notes-on-macvlanmacvtap/

  • https://github.com/containernetworking/plugins/tree/master/plugins/main/macvlan

  • https://github.com/containernetworking/plugins/blob/master/plugins/main/macvlan/macvlan.go

  • http://wikibon.org/wiki/v/Edge_Virtual_Bridging

  • http://hicu.be/bridge-vs-macvlan

  • http://hicu.be/docker-networking-macvlan-bridge-mode-configuration

最后更新于

www.huweihuang.com