Unable to route via VLANs

Tried posting this in the BGP section of the forum, but got no answer. I’m looking to roll out a Mikrotik CCR2004-16G-2S+ as a new Core router on a business park, but I’m having issues getting it working, and was wondering if anyone could provide some assistance.

Customers on site are each assigned an external IP for their office routers, with the IPs being brought into site via a BGP route from our Tier-1 provider. These IPs are then assigned to various VLANs and carried out across site over various VLANs. When just the LAN connections are plugged in, each end-user on various VLANs can route to each other, ping the gateway, etc. But when I tried to install the router, it shows as connected to the upstream provider, the BGP route is visible via the BGP “sessions” entries, no customer routers are able to get to the internet, or ping the VLAN’s gateway. The ARP table shows very few entries, and those it shows always show as “failed”.

Attached below is the current config of the router.
1.1.74.9 is our Tier1 Partner’s Router
2.1.X.X is the IP range we are distributing to customers on site
2.2.X.X and 2.3.X.X are IPs we rent to other customers via a separate GRE tunnel (2.1.71.133)

# model = CCR2004-16G-2S+
/interface bridge
add name=LAN
/interface ethernet
set [ find default-name=ether1 ] comment="Primary WAN Link" name=ether1-WAN
set [ find default-name=ether9 ] comment="Backup WAN Link" name=ether9-WAN
set [ find default-name=ether15 ] comment="Management Port" name=ether15-MNG
set [ find default-name=ether16 ] comment="Backup LAN Link" name=ether16-LAN
set [ find default-name=sfp-sfpplus1 ] comment="Link to Sw34" name=sfp1-LAN
set [ find default-name=sfp-sfpplus2 ] comment="Link to Sw10" name=sfp2-LAN
/interface vlan
add interface=LAN name=VLAN1 vlan-id=1
add interface=LAN name=VLAN3 vlan-id=3
add interface=LAN name=VLAN4 vlan-id=4
add interface=LAN name=VLAN5 vlan-id=5
add interface=LAN name=VLAN8 vlan-id=8
add interface=LAN name=VLAN9 vlan-id=9
add interface=LAN name=VLAN11 vlan-id=11
add interface=LAN name=VLAN12 vlan-id=12
add interface=LAN name=VLAN13 vlan-id=13
add interface=LAN name=VLAN14 vlan-id=14
add interface=LAN name=VLAN18 vlan-id=18
add interface=LAN name=VLAN20 vlan-id=20
add interface=LAN name=VLAN21 vlan-id=21
add interface=LAN name=VLAN28 vlan-id=28
add interface=LAN name=VLAN31 vlan-id=31
add interface=LAN name=VLAN32 vlan-id=32
add interface=LAN name=VLAN400 vlan-id=400
add interface=LAN name=VLAN401 vlan-id=401
add interface=LAN name=VLAN402 vlan-id=402
add interface=LAN name=VLAN406 vlan-id=406
add interface=LAN name=VLAN500 vlan-id=500
add interface=LAN name=VLAN800 vlan-id=800
add interface=LAN name=VLAN997 vlan-id=997
add interface=LAN name=VLAN998 vlan-id=998
add interface=LAN name=VLAN999 vlan-id=999
/port
set 0 name=serial0
set 1 name=serial1
/routing bgp template
set default disabled=no output.network=bgp-networks
add as=65501 cisco-vpls-nlri-len-fmt=auto-bits disabled=no name=Tier1Partner \
    output.redistribute=connected,static router-id=1.1.74.10 \
    routing-table=main
/interface bridge port
add bridge=LAN interface=sfp1-LAN trusted=yes
add bridge=LAN interface=sfp2-LAN trusted=yes
add bridge=LAN hw=no interface=ether16-LAN trusted=yes
/ip firewall connection tracking
set enabled=yes
/ipv6 settings
set disable-ipv6=yes max-neighbor-entries=8192
/ip address
add address=192.168.88.1/24 comment=defconf interface=ether15-MNG network=\
    192.168.88.0
add address=172.16.1.254/24 interface=VLAN1 network=172.16.1.0
add address=2.1.71.230/29 interface=VLAN3 network=2.1.71.224
add address=2.2.31.246/29 interface=VLAN4 network=2.2.31.240
add address=2.2.31.238/29 interface=VLAN5 network=2.2.31.232
add address=2.1.71.62/27 interface=VLAN8 network=2.1.71.32
add address=2.1.71.150/29 interface=VLAN9 network=2.1.71.144
add address=2.1.69.126/27 interface=VLAN11 network=2.1.69.96
add address=2.1.71.142/28 interface=VLAN12 network=2.1.71.128
add address=2.1.69.142/28 interface=VLAN13 network=2.1.69.128
add address=2.1.71.222/28 interface=VLAN14 network=2.1.71.208
add address=2.1.71.30/27 interface=VLAN18 network=2.1.71.0
add address=2.1.71.190/27 interface=VLAN20 network=2.1.71.160
add address=2.1.71.94/27 interface=VLAN21 network=2.1.71.64
add address=2.1.69.94/27 interface=VLAN28 network=2.1.69.64
add address=2.1.69.158/28 interface=VLAN31 network=2.1.69.144
add address=2.1.71.126/27 interface=VLAN32 network=2.1.71.96
add address=2.1.69.174/28 interface=VLAN400 network=2.1.69.160
add address=2.1.70.78/28 interface=VLAN401 network=2.1.70.64
add address=2.1.69.206/28 interface=VLAN402 network=2.1.69.192
add address=2.1.69.190/28 interface=VLAN406 network=2.1.69.176
add address=2.3.44.1/23 interface=VLAN500 network=2.3.44.0
add address=2.1.69.30/27 interface=VLAN800 network=2.1.69.0
add address=2.1.71.158/29 interface=VLAN997 network=2.1.71.152
add address=2.1.70.126/27 interface=VLAN998 network=2.1.70.96
add address=1.1.74.10/29 interface=ether1-WAN network=1.1.74.8
add address=1.2.244.66/29 interface=ether9-WAN network=1.2.244.64
/ip dns
set servers=1.1.1.1,8.8.8.8
/ip firewall address-list
add address=2.3.44.0/24 comment="LE 1" list=bgp-networks
add address=2.3.45.0/24 comment="LE 2" list=bgp-networks
add address=2.1.68.0/22 comment="Site" list=bgp-networks
add address=2.2.24.0 list=bgp-networks
add address=2.2.25.0 list=bgp-networks
add address=2.2.26.0 list=bgp-networks
add address=2.2.27.0 list=bgp-networks
add address=2.2.28.0 list=bgp-networks
add address=2.2.29.0 list=bgp-networks
add address=2.2.30.0 list=bgp-networks
add address=2.2.31.0 list=bgp-networks
/ip route
add distance=5 gateway=1.2.244.65
add check-gateway=ping distance=1 gateway=1.1.74.9
add distance=1 dst-address=2.3.44.0/24 gateway=2.1.71.133
add distance=1 dst-address=2.3.45.0/24 gateway=2.1.71.133
add distance=1 dst-address=2.1.68.0/24 gateway=2.1.71.133
add distance=1 dst-address=2.2.24.0/21 gateway=2.1.71.133
add distance=1 dst-address=2.2.24.0/22 gateway=2.1.71.133
add distance=1 dst-address=2.2.28.0/23 gateway=2.1.71.133
add distance=1 dst-address=2.2.30.0/24 gateway=2.1.71.133
/routing bgp connection
add as=65501 cisco-vpls-nlri-len-fmt=auto-bits connect=yes disabled=no \
    listen=yes local.role=ebgp name=peer1 output.network=bgp-networks \
    .redistribute=connected,static remote.address=1.1.74.9/32 .as=65500 \
    .port=179 router-id=1.1.74.10 routing-table=main templates=Tier1Partner

There does not look to be enough config for your VLAN’s here. I am trying to find you the page to see the practical implementation for this but it’s eluding me…

Ideally you’d want to use the VLAN bridge filtering so you can purposefully trunk out down each port what you want (or make untagged for dedicated port access) rather than leaving the network wide open so any VLAN can go anywhere.

Generuc reading;
http://forum.mikrotik.com/t/using-routeros-to-vlan-your-network/126489/1
http://forum.mikrotik.com/t/avoiding-vlan1-on-bridge/127683/1

But as a more general, create yourself a “proper” management port first so you don’t lock yourself out and then recreate your bridge with VLAN filtering enabled and work from there, build the first VLAN and properly mark it on the ports you expect it both tagged and untagged (if any) and then move on to the next. It’s a PITA at first but then it makes sense.

1 Like

Another trick I always do when dealing with setups of vlans and single bridge is to take one port OFF the bridge and give it its own address

add address=192.168.56.1/30 interface=OffBridgePortXX network=192.168.56.0.

Add this port to the Trusted interface list
/interface list
add name=TRUSTED

/interface list members
add interface=vlan-management list=TRUSTED
add interface=OffBridgePortXX list=TRUSTED

Then simply plug in your laptop into port XX, modify the ipv4 settings to 192.168.56.2 and you should have full access.
This is a SAFER spot to play with vlan bridge setups…learned from experience!!

Apologies for the late reply! I think I’ve set the bridge filtering correctly? Do you think this could have been causing the traversal issues described in the first post?

# model = CCR2004-16G-2S+
/interface bridge
	add name=LAN-bridge
/interface ethernet
set [ find default-name=ether1 ] comment="Primary WAN Link" name=ether1-WAN
set [ find default-name=ether9 ] comment="Backup WAN Link" name=ether9-WAN
set [ find default-name=ether15 ] comment="Management Port" name=ether15-MNG
set [ find default-name=ether16 ] comment="Backup LAN Link" name=ether16-LAN
set [ find default-name=sfp-sfpplus1 ] comment="Link to Sw110" name=sfp1-LAN
set [ find default-name=sfp-sfpplus2 ] comment="Link to Sw10" name=sfp2-LAN
/interface vlan
add interface=LAN-bridge name=Management vlan-id=1
add interface=LAN-bridge name=VLAN3 vlan-id=3
add interface=LAN-bridge name=VLAN4 vlan-id=4
add interface=LAN-bridge name=VLAN5 vlan-id=5
add interface=LAN-bridge name=VLAN8 vlan-id=8
add interface=LAN-bridge name=VLAN9 vlan-id=9
add interface=LAN-bridge name=VLAN11 vlan-id=11
add interface=LAN-bridge name=VLAN12 vlan-id=12
add interface=LAN-bridge name=VLAN13 vlan-id=13
add interface=LAN-bridge name=VLAN14 vlan-id=14
add interface=LAN-bridge name=VLAN18 vlan-id=18
add interface=LAN-bridge name=VLAN20 vlan-id=20
add interface=LAN-bridge name=VLAN21 vlan-id=21
add interface=LAN-bridge name=VLAN28 vlan-id=28
add interface=LAN-bridge name=VLAN31 vlan-id=31
add interface=LAN-bridge name=VLAN32 vlan-id=32
add interface=LAN-bridge name=VLAN400 vlan-id=400
add interface=LAN-bridge name=VLAN401 vlan-id=401
add interface=LAN-bridge name=VLAN402 vlan-id=402
add interface=LAN-bridge name=VLAN406 vlan-id=406
add interface=LAN-bridge name=VLAN500 vlan-id=500
add interface=LAN-bridge name=VLAN800 vlan-id=800
add interface=LAN-bridge name=VLAN997 vlan-id=997
add interface=LAN-bridge name=VLAN998 vlan-id=998
add interface=LAN-bridge name=VLAN999 vlan-id=999
/interface list
add name=TRUSTED
add name=LAN
/routing bgp template
set default disabled=no output.network=bgp-networks
add as=65501 cisco-vpls-nlri-len-fmt=auto-bits disabled=no name=Tier1Partner \
    output.redistribute=connected,static router-id=1.1.74.10 \
    routing-table=main
/interface bridge port
add bridge=LAN-bridge interface=sfp1-LAN trusted=yes
add bridge=LAN-bridge interface=sfp2-LAN trusted=yes
add bridge=LAN-bridge hw=no interface=ether16-LAN trusted=yes
/interface bridge vlan
add bridge=LAN-bridge tagged=LAN-bridge,ether16-LAN,sfp1-LAN,sfp2-LAN \
    vlan-ids="1,3,4,5,8,9,11,12,13,14,18,20,21,28,31,32,400,401,402,406,500,80\
    0,997,998,999"
/interface list member
add interface=Management list=TRUSTED
add interface=ether15-MNG list=TRUSTED
add interface=sfp1-LAN list=LAN
add interface=sfp2-LAN list=LAN
add interface=ether16-LAN list=LAN
/ip address
add address=192.168.88.1/24 comment=defconf interface=ether15-MNG network=\
    192.168.88.0
add address=172.16.1.254/24 interface=Management network=172.16.1.0
add address=2.1.71.230/29 interface=VLAN3 network=2.1.71.224
add address=2.2.31.246/29 interface=VLAN4 network=2.2.31.240
add address=2.2.31.238/29 interface=VLAN5 network=2.2.31.232
add address=2.1.71.62/27 interface=VLAN8 network=2.1.71.32
add address=2.1.71.150/29 interface=VLAN9 network=2.1.71.144
add address=2.1.69.126/27 interface=VLAN11 network=2.1.69.96
add address=2.1.71.142/28 interface=VLAN12 network=2.1.71.128
add address=2.1.69.142/28 interface=VLAN13 network=2.1.69.128
add address=2.1.71.222/28 interface=VLAN14 network=2.1.71.208
add address=2.1.71.30/27 interface=VLAN18 network=2.1.71.0
add address=2.1.71.190/27 interface=VLAN20 network=2.1.71.160
add address=2.1.71.94/27 interface=VLAN21 network=2.1.71.64
add address=2.1.69.94/27 interface=VLAN28 network=2.1.69.64
add address=2.1.69.158/28 interface=VLAN31 network=2.1.69.144
add address=2.1.71.126/27 interface=VLAN32 network=2.1.71.96
add address=2.1.69.174/28 interface=VLAN400 network=2.1.69.160
add address=2.1.70.78/28 interface=VLAN401 network=2.1.70.64
add address=2.1.69.206/28 interface=VLAN402 network=2.1.69.192
add address=2.1.69.190/28 interface=VLAN406 network=2.1.69.176
add address=2.3.44.1/23 interface=VLAN500 network=2.3.44.0
add address=2.1.69.30/27 interface=VLAN800 network=2.1.69.0
add address=2.1.71.158/29 interface=VLAN997 network=2.1.71.152
add address=2.1.70.126/27 interface=VLAN998 network=2.1.70.96
add address=1.1.74.10/29 interface=ether1-WAN network=1.1.74.8
add address=1.2.244.66/29 interface=ether9-WAN network=1.2.244.64
/ip firewall address-list
add address=2.3.44.0/24 comment="LE 1" list=bgp-networks
add address=2.3.45.0/24 comment="LE 2" list=bgp-networks
add address=2.1.68.0/22 comment=Heath list=bgp-networks
add address=2.2.24.0 list=bgp-networks
add address=2.2.25.0 list=bgp-networks
add address=2.2.26.0 list=bgp-networks
add address=2.2.27.0 list=bgp-networks
add address=2.2.28.0 list=bgp-networks
add address=2.2.29.0 list=bgp-networks
add address=2.2.30.0 list=bgp-networks
add address=2.2.31.0 list=bgp-networks
/ip route
add distance=5 gateway=1.2.244.65
add check-gateway=ping distance=1 gateway=1.1.74.9
add distance=1 dst-address=2.3.44.0/24 gateway=2.1.71.133
add distance=1 dst-address=2.3.45.0/24 gateway=2.1.71.133
add distance=1 dst-address=2.1.68.0/24 gateway=2.1.71.133
add distance=1 dst-address=2.2.24.0/21 gateway=2.1.71.133
add distance=1 dst-address=2.2.24.0/22 gateway=2.1.71.133
add distance=1 dst-address=2.2.28.0/23 gateway=2.1.71.133
add distance=1 dst-address=2.2.30.0/24 gateway=2.1.71.133
/routing bgp connection
add as=65501 cisco-vpls-nlri-len-fmt=auto-bits connect=yes disabled=no \
    listen=yes local.role=ebgp name=peer1 output.network=bgp-networks \
    .redistribute=connected,static remote.address=1.1.74.9/32 .as=65500 \
    .port=179 router-id=1.1.74.10 routing-table=main templates=Tier1Partner

Don’t use VLAN ID 1.
If you want to do VLAN filtering oin the bridge, you should enable it.

The management VLAN across the network is VLAN 1. Any reason I shouldn't be using it on the Mikrotik?

Is it “native” or “trunk”?

In Mikrotik world, “native” translates to “access port” to that VLAN[*] … and MT default config uses VID=1 as well … but it’s untagged over “cpu-facing bridge port” (see te first link below) as well. By trying to use VLAN 1 as if it was tagged (on CPU-facing bridge port), you’re messing around.

Mikrotik’s implementation of VLANs on bridge is a bit … different than other vendors did. So perhaps you’d want to read these two de-facto bibles:

And I suggest you to read them in indicated order.

[*] native VLAN is actually always transmitted without 802.1Q headers (i.e. untagged) over the link (wire, fiber). Which means that in theory it’s possible to use different VID inside each piece of equipment to deal with it … in practice tough this makes things very confusing. It is perfectly fine to use VID=1 as native VLAN in mikrotik, but one has to be aware of how default config treats VID=1 and change it everywhere. Since it’s default config, it doesn’t get shown by simple /export command (this ocmmand shows only delta to default config), which does make handling of VID=1 quite a bit harder (but not impossible).

Thanks for the info, I’ll give it a read through. On the network its run as a native, untagged VLAN. I assume its not as simple as setting VLAN1 as an untagged port on the bridge, as in the config I linked above?

As I wrote, default config has pvid=1 set on all bridge ports, including cpu-facing bridge port … which means that you should use it as untagged on bridge interface (i.e. don’t create VLAN interface for it). The other possibility is to make cpu-facing bridge port tagged member of VLAN 1 (and then use VLAN interface with VID set to 1 … the way you do now). If you want to stick to VID=1 for management, then I’d go with the second option aboive (use VLAN 1 as tagged inside router), it makes configuration a bit more self-descriptive.

This will probably sound hugely idiotic, but where would I go around changing the cpu-facing bridge port to being a tagged member of VLAN1?
Still trying to get to grips with the eccentricities of Mikrotik VLANs (Much more familiar with Cisco’s implementation, so this is a bit of an adjustment for me)

Read the first article I linked above … it’ll tell you what’s the “cpu-facing bridge port”.

Spolier alert: properties, set on /inteface/bridge items, are mostly about “cpu-facing bridge port” (of the particular bridge), only a few are about “switch-like” entity. Which includes properties like “pvid”. For the rest of bridge port (the “normal ports”) the same properties are set under /interface/bridge/port. Controversally, you configure VLAN membership of “cpu-facing bridge port” in the same place as for the rest of bridge ports (the normal ones) … under /interface/bridge/vlan

Yeah, it’s because ROS VLAN bridging is based on Linux DSA (Distributed Switch Architecture) which can be pretty tricky to grasp because it involves layers of abstraction and specific hardware constraints that don’t fit with “traditional” networking models. Plus, it’s missing decent documentation on the architecture, which doesn’t make things any easier.

https://docs.kernel.org/networking/dsa/dsa.html
https://www.kernel.org/doc/Documentation/networking/dsa/dsa.txt

I’ve read through the link, and from the best of my understanding, I have VLAN 1 set as tagged on the CPU-facing bridge port? Or am I completely missing something?

/interface bridge vlan
add bridge=LAN-bridge tagged=LAN-bridge,ether16-LAN,sfp1-LAN,sfp2-LAN \
    vlan-ids="1,..."

I’m a bit sceptical seeing the VLAN ID list enclosed in double qoute marks ("), in ROS value lists usually aren’t.

I’ve missed this part of config, though, I was focusing on the one posted in opening post of this thread.

Yes, however
/interface bridge
add name=LAN-bridge
includes default settings of pvid=1 and frame-types=admit-all which presents VLAN 1 untagged on the CPU-facing bridge port.

Not that this matters as your bridge also has the default vlan-filtering=no which makes it behave like an unmanaged switch - all port pvid= and frame-types= settings are ignored, as is all of /interface bridge vlan.

From https://help.mikrotik.com/docs/spaces/ROS/pages/328068/Bridging+and+Switching#BridgingandSwitching-BridgeVLANFiltering “The main VLAN setting is vlan-filtering which globally controls VLAN-awareness and VLAN tag processing in the bridge. If vlan-filtering=no is configured, the bridge ignores VLAN tags, works in a shared-VLAN-learning (SVL) mode, and cannot modify VLAN tags of packets. Turning on vlan-filtering enables all bridge VLAN related functionality and independent-VLAN-learning (IVL) mode. Besides joining the ports for Layer2 forwarding, the bridge itself is also an interface therefore it has Port VLAN ID (pvid).”

If you do not wish to control which VLANs are permitted on individual bridge ports, and you wish the address 172.16.1.254/24 to be associated with untagged traffic on the member ports (sfp1, sfp2 & ether16) the following change should be sufficient:
/ip address
add address=172.16.1.254/24 interface=VLAN1LAN-bridge network=172.16.1.0

Pulled it from the .rsc file of the downloaded config (bearing in mind this was setup via WinBox, if that makes a difference to the config structure)

Assuming this is set up correctly, should this (theoretically) fix the issues in the OP wherin once connected to the BGP upstream router, all ARP entries fail, and inter-VLAN (As well as external) routing fails?

Since the post, I have updated to enable VLAN filtering. As I am simply planning to use the 3 member ports as “mirrors” of the same config, Allowing all VLANs to pass through to the Router, would it be wiser to disable this, and make the change to /ip address you pointed out above?

hi, Larsa, How did you learn that the routeros system uses the dsa framework of the linux system? Are there any relevant documents to introduce it?

1 Like