Maybe my experience would help someone, since topic is not really active. Summary of testing VLANs with HW offloading with the following config:
- VLAN 10: access ports eth3, eth4; trunk eth5; DHCP 192.168.10.0/27
- VLAN 20: access ports eth7, eth8; trunk eth6; DHCP 192.168.20.0/27
Here’s a picture (clickable)
Here’s the config after reset: bridge, ports, switch and DHCP. The rest is not used.
#为我们的vlan /接口创建桥桥dd name=Home-1G-br:vid10 protocol-mode=none fast-forward=no arp=proxy-arp pvid=10 vlan-filtering=no add name=Home-100M-br:vid20 protocol-mode=none fast-forward=no arp=proxy-arp pvid=20 vlan-filtering=no # create Vlans with Bridges as parent interfaces. This would mark bridge traffic with a vlan tag /interface vlan add name=vid10 interface=Home-1G-br:vid10 vlan-id=10 add name=vid20 interface=Home-100M-br:vid20 vlan-id=20 # rename interfaces just for clarity /interface ethernet set [find default-name=ether3 ] name=eth3:vid10.1G.access set [find default-name=ether4 ] name=eth4:vid10.1G.access set [find default-name=ether5 ] name=eth5:vid10.1G.trunk set [find default-name=ether6 ] name=eth6:vid20.100M.trunk set [find default-name=ether7 ] name=eth7:vid20.100M.access set [find default-name=ether8 ] name=eth8:vid20.100M.access # assign default vlan ids to ports and allow only VLAN frames with offload /interface bridge port add bridge=Home-1G-br:vid10 interface=eth3:vid10.1G.access frame-types=admit-only-vlan-tagged pvid=10 hw=yes ingress-filtering=yes add bridge=Home-1G-br:vid10 interface=eth4:vid10.1G.access frame-types=admit-only-vlan-tagged pvid=10 hw=yes ingress-filtering=yes add bridge=Home-1G-br:vid10 interface=eth5:vid10.1G.trunk frame-types=admit-only-vlan-tagged pvid=10 hw=yes ingress-filtering=yes add bridge=Home-100M-br:vid20 interface=eth6:vid20.100M.trunk frame-types=admit-only-vlan-tagged pvid=20 hw=yes ingress-filtering=yes add bridge=Home-100M-br:vid20 interface=eth7:vid20.100M.access frame-types=admit-only-vlan-tagged pvid=20 hw=yes ingress-filtering=yes add bridge=Home-100M-br:vid20 interface=eth8:vid20.100M.access frame-types=admit-only-vlan-tagged pvid=20 hw=yes ingress-filtering=yes # add interfaces in bridge Vlan. Remember to add bridge itself as a tagged member /interface bridge vlan add bridge=Home-1G-br:vid10 vlan-ids=10 tagged=Home-1G-br:vid10,eth5:vid10.1G.trunk untagged=eth3:vid10.1G.access,eth4:vid10.1G.access add bridge=Home-100M-br:vid20 vlan-ids=20 tagged=Home-100M-br:vid20,eth6:vid20.100M.trunk untagged=eth7:vid20.100M.access,eth8:vid20.100M.access # assign IP configuration to Vlans 10 and 20 /ip address add address=192.168.10.1/27 netmask=255.255.255.224 network=192.168.10.0 interface=vid10 add address=192.168.20.1/27 netmask=255.255.255.224 network=192.168.20.0 interface=vid20 # addresses pools for Vlans /ip pool add name=vid10-pool ranges=192.168.10.10-192.168.10.30 add name=vid20-pool ranges=192.168.20.10-192.168.20.30 # setup DHCP networks /ip dhcp-server network add address=192.168.10.0/27 netmask=255.255.255.224 dns-server=192.168.10.1 gateway=192.168.10.1 add address=192.168.20.0/27 netmask=255.255.255.224 dns-server=192.168.20.1 gateway=192.168.20.1 # setup DHCP servers on both Vlans /ip dhcp-server add address-pool=vid10-pool lease-time=01:00:00 interface=vid10 name=vid10-dhcp disabled=no add address-pool=vid20-pool lease-time=01:00:00 interface=vid20 name=vid20-dhcp disabled=no # strip or keep Vlan headers on egress switch ports. # make switch cpu chips vlans-aware /interface ethernet switch port set [find name=eth3:vid10.1G.access] vlan-mode=secure vlan-header=always-strip default-vlan-id=10 set [find name=eth4:vid10.1G.access] vlan-mode=secure vlan-header=always-strip default-vlan-id=10 set [find name=eth5:vid10.1G.trunk] vlan-mode=secure vlan-header=add-if-missing default-vlan-id=10 set [find name=eth6:vid20.100M.trunk] vlan-mode=secure vlan-header=add-if-missing default-vlan-id=20 set [find name=eth7:vid20.100M.access] vlan-mode=secure vlan-header=always-strip default-vlan-id=20 set [find name=eth8:vid20.100M.access] vlan-mode=secure vlan-header=always-strip default-vlan-id=20 set [find name=switch1-cpu] vlan-mode=secure vlan-header=leave-as-is set [find name=switch2-cpu] vlan-mode=secure vlan-header=leave-as-is # add vlans members on the Switch chips # remember to include SwitchX-cpu to be able to use: Nat, routing, torch etc. /interface switch ethernet vlan add switch=switch1 ports=switch1-cpu,eth3:vid10.1G.access,eth4:vid10.1G.access,eth5:vid10.1G.trunk vlan-id=10 add switch=switch2 ports=switch2-cpu,eth6:vid20.100M.trunk,eth7:vid20.100M.access,eth8:vid20.100M.access vlan-id=20
With that setup my computers can talk to the different VLANs over CPU by default, connections inside same switch are offloaded. Tests:
- Laptop Win10 1803
- Laptop Win10 1709
- ethernet is set as a “private” network
- Vlan=10 network=192.168.10.1/27
- Vlan=20 network=192.168.20.1/27
I was pinging IP addresses from the PC in the row to a PC or VLAN IP in a column. Here are the results from ping attempts (clickable).
Torch shows proper VLAN ids. To see vlan marks:
- torch an interface that is connected to Vlan (ex. bridge, or ethernet), I wasn’t able to see marks on vlan itself
- select “VLAN id” checkbox
- start torch again
Here I’ve connected PC1 to ether5, PC2 to ether6 and checking VLANs on both ports and bridges. Ping is launched to all 4 IP addresses: 2 vlans, 2 PCs. (clickable)
Summary
- Adding more ports to the VLANs is easy, just take corresponding ports as an example and check switch port assignments carefully to enable/disable HW offload
- Only 1 VLAN inside each switch group can be offloaded according to documentation, thus choose wisely to be efficient in performance
Improvement. How to isolate VLANs
We can create IP addresses list and use them in Firewall - Raw.
/ip firewall address-list add list=vid10 address=192.168.10.1-192.168.10.30 add list=vid20 address=192.168.20.1-192.168.20.30 /ip firewall raw add action=drop chain=prerouting src-address-list=vid20 dst-address-list=!vid20 add action=drop chain=prerouting src-address-list=vid20 dst-address-list=!vid20
Improvement. Switching more ports from Switch1 and Switch2
We can offload more ports by:
- Moving more ports into single vlan
- Connecting ports from different Switch groups by a patch cord (in this case we lose 2 ports: 1G and 100M port), but increase amount of hw switched ports. It’s worth to mention that connection between switches is limited to 100M
- We can remove CPU link from the second switch group. Not sure whether it saves CPU cycles
I’m considering using this, because:
- ISP provides me 100M channel
- CPU load when WAN and LAN are connected in the 1G switch group is lower for about 5%, while allowing a bit more bandwidth (approx. +5Mbps). The test is synthetic and not the best planned, but I’d consider that when planning my network
Let's adjust config
# delete vlan20 related configs /ip dhcp-server remove [find name=vid20-dhcp] /ip dhcp-server network remove [find gateway=192.168.20.1] /ip address remove [find network=192.168.20.0] /ip pool remove [find name=vid20-pool] /interface vlan remove [find name=vid20] /interface ethernet switch vlan remove [find vlan-id=20] /ip firewall address-list remove [find list="vid20"] /ip firewall raw remove [find chain=prerouting] # update ports, bridge and switch configs /interface ethernet switch port set [find default-vlan-id=20] default-vlan-id=10 /interface bridge set [find name="Home-100M-br:vid20"] name="Home100M-br:vid10" pvid=10 /interface ethernet set [find name="eth6:vid20.100M.trunk"] name="eth6:vid10.100M.trunk" set [find name="eth7:vid20.100M.access"] name="eth7:vid10.100M.access" set [find name="eth8:vid20.100M.access"] name="eth8:vid10.100M.access" /interface bridge port set [find pvid=20] pvid=10 /interface ethernet switch vlan add vlan-id=10 ports=eth6:vid10.100M.trunk,eth7:vid10.100M.access,eth8:vid10.100M.access switch=switch2
This is it. Keep in mind that traffic doesn’t reach the CPU and 100M switch chip doesn’t support “copy to CPU” feature. Thus if you want to see something, use ports from switch1 group or the “uplink” port to the switch2.
6-switched端口设置。
- Same vlan on both switch chips
- 4 access ports: eth3, 4, 7, 8
- 2 trunk ports: eth5 and 6 are connected with a patch cord
- single DHCP server
- you still have some more ports to use in both 1G and 100M switch for WAN balancing, management, guest networks etc. But those will work through CPU
Complete config just in case someone is interested:
# l雷竞技RouterOS 6.42.1 # = 2011 uias-2hnd /数据模型ce bridge add arp=proxy-arp fast-forward=no name=Home-1G-br:vid10 protocol-mode=none add arp=proxy-arp fast-forward=no name=Home100M-br:vid10 protocol-mode=none /interface ethernet set [ find default-name=ether3 ] name=eth3:vid10.1G.access set [ find default-name=ether4 ] name=eth4:vid10.1G.access set [ find default-name=ether5 ] name=eth5:vid10.1G.trunk set [ find default-name=ether6 ] name=eth6:vid10.100M.trunk set [ find default-name=ether7 ] name=eth7:vid10.100M.access set [ find default-name=ether8 ] name=eth8:vid10.100M.access /interface vlan add interface=Home-1G-br:vid10 name=vid10 vlan-id=10 /interface ethernet switch port set 3 default-vlan-id=10 vlan-header=always-strip vlan-mode=secure set 4 default-vlan-id=10 vlan-header=always-strip vlan-mode=secure set 5 default-vlan-id=10 vlan-header=add-if-missing vlan-mode=secure set 6 default-vlan-id=10 vlan-header=add-if-missing vlan-mode=secure set 7 default-vlan-id=10 vlan-header=always-strip vlan-mode=secure set 8 default-vlan-id=10 vlan-header=always-strip vlan-mode=secure set 11 vlan-mode=secure set 12 vlan-mode=secure /ip pool add name=vid10-pool ranges=192.168.10.10-192.168.10.30 /ip dhcp-server add address-pool=vid10-pool disabled=no interface=vid10 lease-time=1h name=vid10-dhcp /interface bridge port add bridge=Home-1G-br:vid10 frame-types=admit-only-vlan-tagged ingress-filtering=yes interface=eth3:vid10.1G.access pvid=10 add bridge=Home-1G-br:vid10 frame-types=admit-only-vlan-tagged ingress-filtering=yes interface=eth4:vid10.1G.access pvid=10 add bridge=Home-1G-br:vid10 frame-types=admit-only-vlan-tagged ingress-filtering=yes interface=eth5:vid10.1G.trunk pvid=10 add bridge=Home100M-br:vid10 frame-types=admit-only-vlan-tagged ingress-filtering=yes interface=eth6:vid10.100M.trunk pvid=10 add bridge=Home100M-br:vid10 frame-types=admit-only-vlan-tagged ingress-filtering=yes interface=eth7:vid10.100M.access pvid=10 add bridge=Home100M-br:vid10 frame-types=admit-only-vlan-tagged ingress-filtering=yes interface=eth8:vid10.100M.access pvid=10 /interface bridge vlan add bridge=Home-1G-br:vid10 tagged=Home-1G-br:vid10,eth5:vid10.1G.trunk \ untagged=eth3:vid10.1G.access,eth4:vid10.1G.access vlan-ids=10 add bridge=Home100M-br:vid10 tagged=Home100M-br:vid10,eth6:vid10.100M.trunk \ untagged=eth7:vid10.100M.access,eth8:vid10.100M.access vlan-ids=20 /interface ethernet switch rule add copy-to-cpu=yes ports=eth5:vid10.1G.trunk switch=switch1 /interface ethernet switch vlan add independent-learning=yes ports=\ switch1-cpu,eth3:vid10.1G.access,eth4:vid10.1G.access,eth5:vid10.1G.trunk switch=switch1 vlan-id=10 add ports=eth6:vid10.100M.trunk,eth7:vid10.100M.access,eth8:vid10.100M.access switch=switch2 vlan-id=10 /ip address add address=192.168.10.1/27 interface=vid10 network=192.168.10.0 /ip dhcp-server network add address=192.168.10.0/27 dns-server=192.168.10.1 gateway=192.168.10.1 netmask=27
Thank you for reading.