Macvlan是LInux网卡虚拟化的解决方案,该技术能将 一块物理网卡虚拟成多张MAC地址不同的虚拟网卡,主要用于虚拟化和容器的应用RouterOSv7.12开始支持macvlan,当前支持两种模式bridge和private 。
设置父级网卡为ether1,取名macvlan1,mac-address设置为D2:49:1F:FE:59:C9
/interface macvlanadd mac-address=D2:49:1F:FE:59:C9 mode=private name=macvlan1 parent=ether1
由于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 macvlanadd mac-address=D2:49:1F:FE:59:C1 mode=private name=macvlan1 interface=ether1add 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 vlanadd interface=ether2 name=vlan3 vlan-id=3add interface=ether2 name=vlan4 vlan-id=4add interface=ether2 name=vlan5 vlan-id=5
创建三个macvlan接口分别是macvlan2,macvlan3,macvlan4,
/interface macvlanadd mac-address=D2:49:1F:FE:59:C1 mode=private name=macvlan3 interface=vlan3add mac-address=D2:49:1F:FE:59:C2 mode=private name=macvlan4 interface=vlan4add 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-clientadd disabled=no interface=macvlan1 name=pppoe-out1 user=yus password=yusadd disabled=no interface=macvlan2 name=pppoe-out2 user=yus password=yusadd disabled=no interface=macvlan3 name=pppoe-out3 user=yus password=yusadd disabled=no interface=macvlan4 name=pppoe-out3 user=yus password=yus
2023-12-13T11:46:19
2023-12-13T11:48:22
2024-01-25T10:38:48
2024-01-25T10:38:26
2024-01-23T08:29:07
2024-01-23T08:28:29
2024-01-23T08:27:53
2024-01-23T08:27:28
2024-01-23T08:26:58
2024-01-23T08:26:34