Macvlan是LInux网卡虚拟化的解决方案,该技术能将 一块物理网卡虚拟成多张MAC地址不同的虚拟网卡,主要用于虚拟化和容器的应用RouterOSv7.12开始支持macvlan,当前支持两种模式bridge和private 。

简单设置

设置父级网卡为ether1,取名macvlan1,mac-address设置为D2:49:1F:FE:59:C9

/interface macvlan
add mac-address=D2:49:1F:FE:59:C9 mode=private name=macvlan1 parent=ether1

单网卡多PPPoE拨号

由于macvlan能虚拟不同mac地址的网卡,那可以代替VRRP做相同接口下,进行多pppoe拨号,VRRP的MAC地址自动生成是无法被修改,但macvlan可以完全自定义mac地址。

测试中发现目前不能支持parent=vlan子接口,无法将macvlan绑定到interface vlan的vlan子接口下,也就意味着无法间接修改vlan子接口的MAC地址,不知道RouterOS后续是否能支持

感谢JELLY BEAN网友,发来邮件提醒v7.12rc1设置更新:

从RouterOS v7.12rc1开始,macvlan做了更新,将parent参数修改为interface,并且支持选择interface vlan接口,也就是完全支持不同vlan的MAC地址修改

创建三个macvlan接口分别是macvlan1,macvlan2,macvlan3,从属于ether1,并修改各自的mac地址使用macvlan配置pppoe拨号

/interface macvlan
add mac-address=D2:49:1F:FE:59:C1 mode=private name=macvlan1 interface=ether1
add mac-address=D2:49:1F:FE:59:C2 mode=private name=macvlan2 interface=ether1

如果你基于ether1创建了vrrp接口,需要先删除关联的vrrp,否则macvlna会创建失败

在ether2接口上创建三个interface vlan接口(ether2连接的交换机配置是trunk vlan3,4,5),

/interface vlan
add interface=ether2 name=vlan3 vlan-id=3
add interface=ether2 name=vlan4 vlan-id=4
add interface=ether2 name=vlan5 vlan-id=5

创建三个macvlan接口分别是macvlan2,macvlan3,macvlan4,

/interface macvlan
add mac-address=D2:49:1F:FE:59:C1 mode=private name=macvlan3 interface=vlan3
add mac-address=D2:49:1F:FE:59:C2 mode=private name=macvlan4 interface=vlan4
add mac-address=D2:49:1F:FE:59:C3 mode=private name=macvlan5 interface=vlan5

创建PPPoE拨号客户端配置,macvlan1接入的ether1接口设置pppoe-out1,基于vlan的macvlan2,macvlan3,macvlan4设置接口pppoe-out2,pppoe-out3,pppoe-out4

/interface pppoe-client
add disabled=no interface=macvlan1 name=pppoe-out1 user=yus password=yus
add disabled=no interface=macvlan2 name=pppoe-out2 user=yus password=yus
add disabled=no interface=macvlan3 name=pppoe-out3 user=yus password=yus
add disabled=no interface=macvlan4 name=pppoe-out3 user=yus password=yus

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

文章很值,打赏犒劳作者一下