First Mikrotik router

Hi guys!

we are starting to use Mikrotik routers in one of ours racks but I’m a cisco guy and I’m strugling to do something like the image bellow.

Long story, short. I need to use two vlans, 10 and 20, to separe two different companies workloads. That’s easy, and I can do (I hope so! :smiley:). But I need to create a vlan interface (ports ether1 and ether2), tag the vlan 3207 and use IP represented on image as x.x.x.x/28 as default route (Internet) for both vlans (10, 20).

Can you help me?

Thanks in advance!
odata-detailed.drawio.png

Have a look at this thread: http://forum.mikrotik.com/t/using-routeros-to-vlan-your-network/126489/1

If things won’t be working for you after that, come back and post your configuration that doesn’t work.

Hi Mkx,

first of all, thanks for your help.

I’ve decided to simplify things, removing the second vlan. So, the new diagram is on the image. The ether1 is the uplink to our co-location network and ports ether2 through ether10 are our server’s vlan. To our uplink works we need to tag vlan 3207 on ether1 (and have a vlan interface on vlan 3207)

My full configuration, till now, is bellow. My problem now is that I cant get an IP address (But I still need to check the uplink configuration in real world on my co-location datacenter)

#######################################
# Naming
#######################################

# name the device being configured
/system identity set name="servers"

#######################################
# VLAN Overview
#######################################

# 3207 = uplink
# 200 = servers

#######################################
# Bridge
#######################################

# 
/interface bridge
add name=bridge1 protocol-mode=none vlan-filtering=no

#######################################
#
# -- Ports Config 
#
#######################################

/interface bridge port
add bridge=bridge1 interface=ether1 pvid=200
add bridge=bridge1 interface=ether2 pvid=200
add bridge=bridge1 interface=ether3 pvid=200
add bridge=bridge1 interface=ether4 pvid=200
add bridge=bridge1 interface=ether5 pvid=200
add bridge=bridge1 interface=ether6 pvid=200
add bridge=bridge1 interface=ether7 pvid=200
add bridge=bridge1 interface=ether8 pvid=200
add bridge=bridge1 interface=ether9 pvid=200
add bridge=bridge1 interface=ether10 pvid=200

/interface bridge vlan
add bridge=bridge1 tagged=ether1 vlan-ids=3207
add bridge=bridge1 untagged=bridge1 vlan-ids=200

#######################################
# IP Services
#######################################

# Moray VLAN (vlan 20)
/interface vlan add interface=bridge1 name=vlan200 vlan-id=20
/ip address add interface=bridge1 address=10.0.200.1/24
/ip pool add name=vlan200_pool ranges=10.0.200.2-10.0.200.254
/ip dhcp-server add address-pool=vlan200_pool interface=bridge1 name=vlan200_dhcp disabled=no
/ip dhcp-server network add address=10.0.200.0/24 dns-server=8.8.8.8 gateway=10.0.200.1

# WAN (vlan 3207)
/interface vlan add interface=bridge1 name=vlan3207 vlan-id=3207
/ip address add interface=vlan3207 address=x.x.x.x/28

# router's gateway provided by ISP
/ip route add distance=1 gateway=y.y.y.y

# DNS server
/ip dns set allow-remote-requests=yes servers="8.8.8.8"

#######################################
# Firewalling & NAT
#######################################

/interface list add name=WAN
/interface list add name=VLAN

/interface list member
add interface=vlan3207 list=WAN
add interface=ether1 list=VLAN
add interface=ether2 list=VLAN
add interface=ether3 list=VLAN
add interface=ether4 list=VLAN
add interface=ether5 list=VLAN
add interface=ether6 list=VLAN
add interface=ether7 list=VLAN
add interface=ether8 list=VLAN
add interface=ether9 list=VLAN
add interface=ether10 list=VLAN
add interface=bridge1 list=VLAN

# VLAN aware firewall. Order is important.
/ip firewall filter

##################
# INPUT CHAIN
##################
add chain=input action=accept connection-state=established,related comment="Allow Estab & Related"

# Allow VLANs
add chain=input action=accept in-interface-list=VLAN comment="Allow VLAN"

add chain=input action=drop comment="Drop"

##################
# FORWARD CHAIN
##################
add chain=forward action=accept connection-state=established,related comment="Allow Estab & Related"

# Allow all VLANs to access the Internet only, NOT each other
add chain=forward action=accept connection-state=new in-interface-list=VLAN out-interface-list=WAN comment="VLAN Internet Access only"

add chain=forward action=drop comment="Drop"

##################
# NAT
##################
/ip firewall nat add chain=srcnat action=masquerade out-interface-list=WAN comment="Default masquerade"

#######################################
# Turn on VLAN mode
#######################################
/interface bridge set bridge1 vlan-filtering=yes

Thanks again for your help!

  1. If you have VLAN interface in “/interface vlan” on bridge, then this VLAN in “/interface bridge vlan” must be tagged on bridge:
/interface bridge vlan
add bridge=bridge1 tagged=bridge1,ether1 vlan-ids=3207
add bridge=bridge1 tagged=bridge1 vlan-ids=200
  1. If ether1 should have only tagged VLAN 3207, then it shouldn’t have pvid=200, keep default 1. You can also set ingress-filtering=yes frame-types=admit-only-vlan-tagged.

  2. 10.0.200.1/24 should be on vlan200 and not on bridge1. Same goes for DHCP server.

  3. When you add interface as bridge port, router no longer sees it as individual interface. You don’t need all those ports in “VLAN” interface list.

Tip: Until you’re sure what you’re doing, don’t configure all ports at once. Keep one aside and use it for configuring. You can add it to bridge later. If you mess up the bridge, you won’t be locked out.

Presenting info in such a stilted manner is not conducive to feedback.
Sob likes torture and thus manages well.
In future please post full config.
/export file=anynamyouwish (minus router serial number and any public WANIP info)

Thanks Sob and Anav!

Here’s the full config. (Already with Sob’s suggested adjustments)

Computers connected still doesn’t receive IPs :frowning:

# jan/02/1970 02:34:12 by RouterOS 6.48.6
# software id = 6611-E5LN
#
# model = RB3011UiAS
# serial number = ***********
/interface bridge
add frame-types=admit-only-vlan-tagged ingress-filtering=yes name=bridge1 \
    protocol-mode=none vlan-filtering=yes
/interface vlan
add interface=bridge1 name=vlan200 vlan-id=200
add interface=bridge1 name=vlan3207 vlan-id=3207
/interface list
add name=WAN
add name=VLAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=vlan200_pool ranges=10.0.200.2-10.0.200.254
/ip dhcp-server
add address-pool=vlan200_pool disabled=no interface=vlan200 name=dhcp_server
/interface bridge port
add bridge=bridge1 interface=ether1
add bridge=bridge1 interface=ether2 pvid=200
add bridge=bridge1 interface=ether3 pvid=200
add bridge=bridge1 interface=ether4 pvid=200
add bridge=bridge1 interface=ether5 pvid=200
add bridge=bridge1 interface=ether6 pvid=200
add bridge=bridge1 interface=ether7 pvid=200
add bridge=bridge1 interface=ether8 pvid=200
add bridge=bridge1 interface=ether9 pvid=200
add bridge=bridge1 interface=ether10 pvid=200
/ip neighbor discovery-settings
set discover-interface-list=!dynamic
/interface bridge vlan
add bridge=bridge1 tagged=bridge1,ether1 vlan-ids=3207
add bridge=bridge1 untagged=bridge1 vlan-ids=200
/interface list member
add interface=vlan3207 list=WAN
add interface=bridge1 list=VLAN
/ip address
add address=10.0.200.1/24 interface=vlan200 network=10.0.200.0
add address=*.*.*.117/28 interface=vlan3207 network=*.*.*.112
/ip dhcp-server network
add address=10.0.200.0/24 dns-server=8.8.8.8 gateway=10.0.200.1
/ip dns
set allow-remote-requests=yes servers=8.8.8.8
/ip firewall filter
add action=accept chain=input comment="Allow Estab & Related" \
    connection-state=established,related
add action=accept chain=input comment="Allow VLAN" in-interface-list=VLAN
add action=drop chain=input comment=Drop
add action=accept chain=forward comment="Allow Estab & Related" \
    connection-state=established,related
add action=accept chain=forward comment="VLAN Internet Access only" \
    connection-state=new in-interface-list=VLAN out-interface-list=WAN
add action=drop chain=forward comment=Drop
/ip firewall nat
add action=masquerade chain=srcnat comment="Default masquerade" \
    out-interface-list=WAN
/ip route
add distance=1 gateway=*.*.*.113
/system identity
set name=moray

An additional data, even putting the IP manually, I can’t access to the router.

Bridge has to be tagged member of vlan 200:

/interface bridge vlan
add bridge=bridge1 tagged=bridge1 vlan-ids=200

(that’s because you’ve set bridge interface to be tagged only in bridge setup frame-types=admit-only-vlan-tagged - the first actual configuration command in config export posted).

Also henceforth use vlan200 interface in any of config, e.g.

/interface list member
add interface=vlan200 list=VLAN

Mkx,

but if bridge1 has to be tagged member of vlan 200, it’ll be tagged and unttaged? Something like this:

add bridge=bridge1 tagged=bridge1 untagged=bridge1 vlan-ids=200

And with this configuration every port on bridge1 (all ports) will be a trunk interface, right? My trunk interface is just ether1 (should be ether2 too in a port-channel, but I’m letting this problem to another moment :laughing:)

Your configuration

/interface bridge
add > frame-types=admit-only-vlan-tagged > ingress-filtering=yes name=bridge1
protocol-mode=none vlan-filtering=yes

says bridge interface is tagged. Period. And that’s true for any VLAN, untagged frames are blocked on ingress on this interface. Bolded property setting annihilates any PVID setting on bridge interface (default setting is PVID=1, explicit setting wouldn’t matter either in this case). For egress it’s possible to set bridge interface to be untagged nember of multiple VLANs, but net effect will still be no bi-directional traffic of untagged frames through bridge interface.

See this article to find out about different bridge personalities.

The quoted config stanza is not about bridge - the switch like entity -, it’s about bridge interface. And doesn’t affect the rest of bridge ports in any way.

(1) FROM:
/interface bridge
add frame-types=admit-only-vlan-tagged ingress-filtering=yes name=bridge1
protocol-mode=none vlan-filtering=yes

TO:
/interface bridge
add name=bridge1 protocol-mode=none vlan-filtering=yes

(2) REMOVE VLAN3207 from the bridge. Remove ether1 from the interface bridge ports, remove vlan3207 from interface bridge vlans Assuming this vlan is required due to your ISP providing its service on this vlan ???
If anything it should be applied to the ether1 interface NOT the bridge when defining it.

(3) to be on the safe side.
/interface list member
add interface=vlan3207 list=WAN
add interface=ether1 list=WAN
add interface=bridge1 list=VLAN

(4) Recommend the following
/interface bridge port
add bridge=bridge1 interface=ether2 pvid=200 ingress-filtering=yes frame-types=admit-priority-and-untagged
add bridge=bridge1 interface=ether3 pvid=200 ingress-filtering=yes frame-types=admit-priority-and-untagged
add bridge=bridge1 interface=ether4 pvid=200 ingress-filtering=yes frame-types=admit-priority-and-untagged
add bridge=bridge1 interface=ether5 pvid=200 ingress-filtering=yes frame-types=admit-priority-and-untagged
add bridge=bridge1 interface=ether6 pvid=200 ingress-filtering=yes frame-types=admit-priority-and-untagged
add bridge=bridge1 interface=ether7 pvid=200 ingress-filtering=yes frame-types=admit-priority-and-untagged
add bridge=bridge1 interface=ether8 pvid=200 ingress-filtering=yes frame-types=admit-priority-and-untagged
add bridge=bridge1 interface=ether9 pvid=200 ingress-filtering=yes frame-types=admit-priority-and-untagged
add bridge=bridge1 interface=ether10 pvid=200 ingress-filtering=yes frame-types=admit-priority-and-untagged
/ip neighbor discovery-settings
set discover-interface-list=!dynamic
/interface bridge vlan
add bridge=bridge1 tagged=bridge1 untagged=ether2,ether3,ether4,ether5,ether6,ether7,ether8,ether9,ether10 vlan-ids=200

Sorry Mkx, I misunderstood Sob’s comment about this command: set ingress-filtering=yes frame-types=admit-only-vlan-tagged and put it in a wrong place. Now I understood your point. Thanks!!!

Anav, you’re right. My ISP delivery my connection through vlan 3207, so I need a trunk connection and a vlan interface on 3207.

If was a Cisco could be something like this:

vlan 3207
name INTERNET

interface GigabitEthernet1/0/1
switchport
switchport mode trunk
switchport trunk allowed vlan 3207
channel-group 1 mode active
no shut

interface GigabitEthernet1/0/2
switchport
switchport mode trunk
switchport trunk allowed vlan 3207
channel-group 1 mode active
no shut

interface port-channel 1
switchport
switchport mode trunk
switchport trunk allowed vlan 3207

interface Vlan3207
ip address x.x.x.117 255.255.255.240

ip route 0.0.0.0 0.0.0.0 x.x.x.113

Tomorrow I’m going to do the adjustments that you sent and let you know the result.

THANKS A LOT!!!

(2) is not wrong, assuming that VLAN 3207 will be needed only on ether1. But previous config wasn’t wrong either.

Anav,

here the command line should be: add bridge=bridge1 interface=ether2 pvid=200 ingress-filtering=yes frame-types=admit-only-untagged-and-priority-tagged, right?


Hi all!

This is the last configurarion with your adjusments. Again, thanks for your help! If you come to Brazil, drinks it’s on me! :smiley:

Probably, tomorrow I’ll try this settings on our co-location datacenter. I’ll let you know the results.

# nov/02/2022 10:36:13 by RouterOS 6.48.6
# software id = 6611-E5LN
#
# model = RB3011UiAS
# serial number = ***********
/interface bridge
add name=bridge1 protocol-mode=none vlan-filtering=yes
/interface vlan
add interface=bridge1 name=vlan200 vlan-id=200
add interface=bridge1 name=vlan3207 vlan-id=3207
/interface list
add name=WAN
add name=VLAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=vlan200_pool ranges=10.0.200.2-10.0.200.254
/ip dhcp-server
add address-pool=vlan200_pool disabled=no interface=vlan200 name=dhcp_server
/interface bridge port
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
    ingress-filtering=yes interface=ether2 pvid=200
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
    ingress-filtering=yes interface=ether3 pvid=200
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
    ingress-filtering=yes interface=ether4 pvid=200
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
    ingress-filtering=yes interface=ether5 pvid=200
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
    ingress-filtering=yes interface=ether6 pvid=200
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
    ingress-filtering=yes interface=ether7 pvid=200
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
    ingress-filtering=yes interface=ether8 pvid=200
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
    ingress-filtering=yes interface=ether9 pvid=200
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
    ingress-filtering=yes interface=ether10 pvid=200
/ip neighbor discovery-settings
set discover-interface-list=!dynamic
/interface bridge vlan
add bridge=bridge1 tagged=ether1 vlan-ids=3207
add bridge=bridge1 tagged=bridge1 untagged=\
    ether2,ether3,ether4,ether5,ether6,ether7,ether8,ether9,ether10 vlan-ids=\
    200
/interface list member
add interface=vlan3207 list=WAN
add interface=ether1 list=WAN
add interface=bridge1 list=VLAN
/ip address
add address=10.0.200.1/24 interface=vlan200 network=10.0.200.0
add address=*.*.*.117/28 interface=vlan3207 network=*.*.*.112
/ip dhcp-server network
add address=10.0.200.0/24 dns-server=8.8.8.8 gateway=10.0.200.1
/ip dns
set allow-remote-requests=yes servers=8.8.8.8
/ip firewall filter
add action=accept chain=input comment="Allow Estab & Related" \
    connection-state=established,related
add action=accept chain=input comment="Allow VLAN" in-interface-list=VLAN
add action=drop chain=input comment=Drop
add action=accept chain=forward comment="Allow Estab & Related" \
    connection-state=established,related
add action=accept chain=forward comment="VLAN Internet Access only" \
    connection-state=new in-interface-list=VLAN out-interface-list=WAN
add action=drop chain=forward comment=Drop
/ip firewall nat
add action=masquerade chain=srcnat comment="Default masquerade" \
    out-interface-list=WAN
/ip route
add distance=1 gateway=*.*.*.113
/system clock
set time-zone-name=America/Sao_Paulo
/system identity
set name=moray

Well I dont understand your use of vlan3207 but if sob says its okay, then I will assume it is.
I use vlan for my ISP and do not do what you have done,
If it was me recommend

a. remove vlan3207 from bridge1
add interface=bridge1 name=vlan3207 vlan-id=3207

b. All you need to do is define the vlan like so.
add interface=ether1 name=vlan3207 vlan-id=3207 DONE!!

c. THere should be no need to manually create the IP address for the ISP connection… and should be removed.
add address=...117/28 interface=vlan3207 network=...112

UNLESS, for some reason, your ISP tells you to apply IP address yourself but I doubt it.
Normally this is dynamically created!

Anav,

We’re deploying our first rack on this datacenter, so I don’t know/undestand their structure yet.

But, in my understament, the datacenter’s router (default gateway) where my rack is connect is in somewhere behind some layer 2 switches and my connection with this router is through vlan 3207. So I need a vlan interface in this same vlan and a trunk connection with the layer 2 switch next my rack (I’m using ether1 for this). Make any sense?

What @anav tries to say is: if you only intend to use VLAN 3207 on single port (ether1) and you only intend to use ether1 to carry said VLAN, then there’s no need to involve bridge for that VLAN. Because performance wise nothing can be done by switch chip alone (even if bridge was offloaded to switch chip which is not on RB3011), everything will pass CPU anyway. It’s actually the opposite: with your current config WAN traffic has to be dealt with by bridge code, if ether1 was treated separately bridge would not have to pass WAN traffic.
From configuration readability treating ether1 completely separate would be bettter because it would clearly show ether1 and vlan3207 as being special (i.e. WAN interface).

Since the vlan is coming from on high, you have two options.
Set IP DHCP Client to the vlan for the connection or manually set it as you have in IP addresses.

Make sense @mkx!

So I change from:

/interface vlan add interface=bridge1 name=vlan3207 vlan-id=3207

To:

/interface vlan add interface=ether1 name=vlan3207 vlan-id=3207

@anav,

they don’t give address dynamically.