Issue with VLANs and Trunks

Hello,

I recently purchased my first Microtik router (CRS125-24G-1S-2HnD-IN) to replace my old Fortigate firewall. As I know my way around in hardware firewalls like Fortigate and CheckPoint and swiches from Dell and HP, I thought this would be an easy one to configure :wink:

But after a couple of days, I am a completely lost in configuring my Microtik….

The picture is the setup I want to achieve. But can’t figure out on how I need configure the vlan and trunks onto the ports, so that I can sent more than one vlan trough one port and also to other ports. With the switches it was as easy as tagging and untagging the ports, but not with the Microtik.

So the part on right with HP Procurve Switch is correctly configured and checked. The port (eth24) on the left from the Microtik is configured and connected to the IPS, Internet access is also configured with PPPoE connection over VLAN 6, and the Desktop is also working on eth1. (forget VOIP vlan 7 as I am not using it)

But I can’t get port 2, 3 and 23 correctly configured.

Any help would be appreciated!

Regards,
Omega.

I just recently wrestled with all of this, with a procurve switch and everything. My post is actually still up on the board here. The fix isn’t posted yet as it is still awaiting moderation, but it might be helpful.

In essence, what I had to do was create a separate bridge for each vlan, and then a vlan for each trunked interface. So in your case for port 23 I think you’d need something like:

/int bridge
add name=br-vlan4
add name=br-vlan10
add name=br-vlan11
/int vlan 
add interface=eth23 name=VLAN_IPTV_ETH23 vlan-id=4
add interface=eth24 name=VLAN_IPTV_ETH24 vlan-id=4
add interface=eth23 name=VLAN_LAN_ETH23 vlan-id=10
add interface=eth2 name=VLAN_LAB_ETH2 vlan-id=11
add interface=eth23 name=VLAN_LAB_ETH23 vlan-id=11
/int bridge port
add bridge=br-vlan4 interface=VLAN_IPTV_ETH23
add bridge=br-vlan4 interface=VLAN_IPTV_ETH24
add bridge=br-vlan4 interface=eth3
add bridge=br-vlan10 interface=VLAN_LAN_ETH23
add bridge=br-vlan10 interface=eth2
add bridge=br-vlan11 interface=VLAN_LAB_ETH2
add bridge=br-vlan11 interface=VLAN_LAB_ETH23
/ip address
add address=a.a.a.a/xx interface=br-vlan4 network=a.?.?.?
add address=b.b.b.b/xx interface=br-vlan10 network=b.?.?.?
add address=c.c.c.c/xx interface=br-vlan11 network=c.?.?.?

This should enable all of the ports on the appropriate vlans to be able to talk to each other, and should enable the individual vlans to speak to each other as well, assuming you don’t have any filtering set up. For more information, I found this blog post to be very helpful for understanding how this works.

HTH

Bridge is in software and really slow.

Nooooo! No bridging!!! Do not bridge those interfaces, it does not need to be done and just causes the CPU to have to deal with everything rather than the switch hardware! The CRS platform uses a dedicated hardware switch with many features. In the case of the CRS125-24G this is a Qualcomm Atheros 8513L switch.

I struggled with this same problem for many hours until I sorted out the syntax (as I am used to Cisco switches). What you want to do is force the switch hardware to do all the work UNLESS you are routing between VLANs.

You need to tackle this in steps:

  1. Only configure one master port. In your case, make it ether24
  2. Make all other ports slaves of the master. This ensures that all ports are in the same isolation group. From here we use VLANs to perform any segmentation at layer 2.
  3. Add ports to the VLANs they will be members of
  4. Define VLAN tagging
  5. Define what the untagged VLAN is for any ports. Microtik does this by translating any untagged packets (i.e. VLAN 0) to whatever you define.
#### Configure all switch ports to be in the same isolation group

/interface ethernet
set [ find default-name=ether1 ] master-port=ether24-master-local name=ether1-slave-local
set [ find default-name=ether2 ] master-port=ether24-master-local name=ether2-slave-local
set [ find default-name=ether3 ] master-port=ether24-master-local name=ether3-slave-local
set [ find default-name=ether4 ] master-port=ether24-master-local name=ether4-slave-local
set [ find default-name=ether5 ] master-port=ether24-master-local name=ether5-slave-local
set [ find default-name=ether6 ] master-port=ether24-master-local name=ether6-slave-local
set [ find default-name=ether7 ] master-port=ether24-master-local name=ether7-slave-local
set [ find default-name=ether8 ] master-port=ether24-master-local name=ether8-slave-local
set [ find default-name=ether9 ] master-port=ether24-master-local name=ether9-slave-local
set [ find default-name=ether10 ] master-port=ether24-master-local name=ether10-slave-local
set [ find default-name=ether11 ] master-port=ether24-master-local name=ether11-slave-local
set [ find default-name=ether12 ] master-port=ether24-master-local name=ether12-slave-local
set [ find default-name=ether13 ] master-port=ether24-master-local name=ether13-slave-local
set [ find default-name=ether14 ] master-port=ether24-master-local name=ether14-slave-local
set [ find default-name=ether15 ] master-port=ether24-master-local name=ether15-slave-local
set [ find default-name=ether16 ] master-port=ether24-master-local name=ether16-slave-local
set [ find default-name=ether17 ] master-port=ether24-master-local name=ether17-slave-local
set [ find default-name=ether18 ] master-port=ether24-master-local name=ether18-slave-local
set [ find default-name=ether19 ] master-port=ether24-master-local name=ether19-slave-local
set [ find default-name=ether20 ] master-port=ether24-master-local name=ether20-slave-local
set [ find default-name=ether21 ] master-port=ether24-master-local name=ether21-slave-local
set [ find default-name=ether22 ] master-port=ether24-master-local name=ether22-slave-local
set [ find default-name=ether23 ] master-port=ether24-master-local name=ether23-slave-local
set [ find default-name=ether24 ] name=ether24-master-local
set [ find default-name=sfp1 ] master-port=ether24-master-local name=sfp1-slave-local


### Allocate the list of valid VLANs to ports.  **MUST** add switch1-cpu to any VLANs which are routed by the Microtik.

/interface ethernet switch vlan
add ports="ether24-master-local,ether3-slave-local,ether23-slave-local" vlan-id=4
add ports="ether24-master-local" vlan-id=7
add ports="ether24-master-local,switch1-cpu" vlan-id=6
add ports="ether1-slave-local,ether2-slave-local,ether23-slave-local" vlan-id=10
add ports="ether2-slave-local,ether23-slave-local" vlan-id=11



#### Define VLAN tagging.  Switch1-cpu is always tagged for routed VLANs.  

/interface ethernet switch egress-vlan-tag
add tagged-ports=ether23-slave-local vlan-id=10
add tagged-ports=ether24-slave-local,switch1-cpu vlan-id=6
add tagged-ports=ether24-slave-local,ether23-slave-local vlan-id=4


#### Assign a VID to packets entering interfaces when they are not tagged.

/interface ethernet switch ingress-vlan-translation
add new-customer-vid=10 ports="ether1-slave-local,ether2-slave-local" sa-learning=yes
add new-customer-vid=4 ports="ether3-slave-local,ether2-slave-local" sa-learning=yes

Thanks for the replies guys!

I was already aware that the bridging option was not the best due to unnecessary pressure on the CPU, especially as I am not needing any routing or other fancy stuff.

I was trying to build something with the use of this post:
http://www.breekeenbeen.nl/2014/12/11/mikrotik-vlan-switching-without-bridging/

Until now haven’t got everything working, but I will try tonight again with your posts.

I let you know.

Omega.

Ah - good point, I’ve been staring at my own problem so long I misread his post as being another CCR, not a CRS. Thanks for pointing that out and explaining how to do that when there is a switch cpu.

Thanks for the replies!

@ Kaldek,

Your solution seems to work as needed :slight_smile:

But now I am facing a new issue.
What do I need to do to configure the router with an ip address which is accessible trough VLAN10 and the pc connected to eth1?

Thanks,
Omega

This should work. Binding the VLAN interface to ether1-slave-local should be fine as I’m pretty sure this just does some automatic VLAN allocation to the interface (which we have already done anyway). The fact that RouterOS forces you to bind a VLAN interface to a physical port is annoying, but it’s just a throwback to the way their code has worked for a while I guess.

Note I have called the interface below “Fooblah” purely to show you that you can call it whatever the heck you want.

/interface vlan
add name=Fooblah vlan-id=10 interface=ether1-slave-local

/ip address
add address=<address>/<netmask> interface=Fooblah network=<network address>

/interface ethernet switch vlan
add ports=switch1-cpu vlan-id=10

/interface ethernet switch egress-vlan-tag
add tagged-ports=switch1-cpu vlan-id=10

If it won’t let you add switch1-cpu to the VLAN or add the tagging, just go into the GUI under Switch–>VLAN–>VLAN tab and then add switch1-cpu to VLAN-10 in the GUI, then go into Switch–>VLAN–>VLAN Tagging tab and add switch1-cpu as a tagged port for VLAN 10. Basically it’s easier to edit settings in the GUI than it is to edit them at the command line (as opposed to adding new settings).

The result of the above commands is that a virtual router interface called “Fooblah” is created and assigned an address. We then expose this interface on the VLAN 10 layer 2 network. From there, any device within VLAN 10 can reach that virtual router interface and route packets through it, assuming you don’t have any IP firewall filter rules that would block it.

Hello Kaldek,

Sorry for my late reply, but I was away for a couple of days.

Thank you for your help, I have got my setup finally working now :smiley:

Cheers,
Omega.