I've got VLAN10 (192.168.10.0/24) on eth2 and eth3, and VLAN20 (192.168.20.0/24) on eth4 and eth5.
How can I "connect" these two VLANS with the WAN port eth1 that has the IP 192.168.1.20 (in my test setup)?
/interface vlan add name=vlan-10 vlan-id=10 interface=eth1 disabled=no
/ip firewall filter
add chain=forward in-interface=vlan10 out-interface=!ether1-gateway action=reject
add chain=forward in-interface=vlan20 out-interface=!ether1-gateway action=reject
/ip firewall filter
add chain=forward in-interface=vlan10 out-interface=!ether1-gateway action=reject
/interface vlan add name=vlan-10 vlan-id=10 interface=ether1 disabled=no
/interface vlan add name=vlan-20 vlan-id=20 interface=ether1 disabled=no
/interface bridge add name=br-vlan10 disabled=no
/interface bridge port add interface="vlan-10" bridge="br-vlan10" disabled=no
/interface bridge port add interface="ether3" bridge="br-vlan10" disabled=no
No, you would replace vlan10 with the name of the bridge interface that is bridging the individual ports together into a vlan... Remember that IP firewall only refers to IP interfaces. When you make a bridge, it's the bridge interface itself that is the Mikrotik's "connection" into the VLAN you created. So that's why you put IP services on the bridge interface itself (such as DHCP server) and firewall rules. If you make a firewall rule that matches in-interface=ether3, then the rule won't ever match any packets because the IP layer of the router receives these packets via the bridge interface. (if you enable use-ip-firewall=yes on the bridge, then the bridge will check the firewall rules while forwarding ethernet frames across the bridge as well, but this is a 'special' case, and has performance penalties, etc)This is clear: it means any traffic coming from a "vlan10" port, not heading for the gateway-port, is rejected.Code: Select all/ip firewall filter add chain=forward in-interface=vlan10 out-interface=!ether1-gateway action=reject
Ok nice. But as you said, my understanding of VLAN and routing is not clear yet - couldn't I do the same thing, and replace "vlan10" with (say) "ether3"? Ok, the consequence would be that ether3 could only communicate with ether1, and NOT with ether4, which might be designated as part of vlan10. So the VLAN is just a group of ports - which is exactly what you said.
It is a goal, and it does what it says it does - it isolates hosts in vlan10 from hosts in vlan20 . . . at layer 2 (ethernet layer). This means that broadcasts from hosts in vlan10 will not reach hosts in vlan20 (e.g. no DHCP requests, no ARP requests, no auto-discovery protocols like UPnP, etc).And I get that. But does that mean that VLAN's dont inherently make sure that traffic within a VLAN stays VLAN-exclusive? I thought that was one of the major reasons and goals of VLAN's to make sure their traffic stays private?
I mentioned the trunk port because I was assuming that you were using the HW switch. If you're just creating some bridges and connecting ports A, B, C to bridge1 and D, E, F to bridge2, then it's a touch misleading to use the term 'vlan' to refer to this, because the bridges aren't really doing any kind of vlan tagging. Each vlan is a virtual switch, and all connected ports may communicate with each other. It's not incorrect to use the term vlan, but it's misleading because you can make lots of bridges and never use a single vlan identifier anywhere.I know you gave your firewall rule as an answer to my question, "how do I set up VLAN access ports ONLY - without a trunk port". So I guess under an "ordinary" VLAN setup, the firewall rule would not be necessary. It's just another means how to achieve my goal.
My goal being: I have one router with many ports on them, and some of them I want to group to a VLAN, while giving them access to the internet (and of course making sure that VLAN traffic stays private within their respective VLAN)
The part that confuses me is: why do I need to use a "trunk port"? It's usually only required to connect several routers/switches, that are supposed to handle the same VLANs.
/ip firewall filter
add chain=forward in-interface=vlan10 out-interface=!ether1-gateway action=reject
/ip firewall filter
add chain=forward in-interface=br-lan10 out-interface=br-lan-local action=reject
Oh, that is interesting! I might need that in the futureJust like IP address-list functionality, you can define a list of interfaces and make firewall rules match the groups.