Manual CRS Examples MikroTik Wiki
Manual CRS Examples MikroTik Wiki
Manual CRS Examples MikroTik Wiki
Applies
Contents to
RouterOS: v6.12 +
1 Summary
2 Management IP Configuration
3 VLAN
3.1 Port Based VLAN
3.2 Protocol Based VLAN
3.3 MAC Based VLAN
3.4 InterVLAN Routing
3.5 Unknown/Invalid VLAN filtering
3.6 VLAN Tunneling (Q-in-Q)
4 Mirroring
4.1 Port Based Mirroring
4.2 VLAN Based Mirroring
4.3 MAC Based Mirroring
5 Trunking
6 Limited MAC Access per Port
7 Isolation
7.1 Port Level Isolation
7.2 Protocol Level Isolation
8 Quality of Service (QoS)
8.1 MAC based traffic scheduling using internal Priority
8.2 MAC based traffic shaping using internal Priority
8.3 VLAN based traffic scheduling + shaping using internal Priorities
9 Bandwidth Limiting
10 Traffic Storm Control
11 Spanning Tree Protocol
Summary
Basic use cases and configuration examples for Cloud Router Switch features.
Warning: This article applies to CRS1xx and CRS2xx series switches and not to CRS3xx series switches.
Management IP Configuration
/interface ethernet
set ether3 master-port=ether2
set ether4 master-port=ether2
set ether5 master-port=ether2
/ip address
add address=192.168.88.1/24 interface=ether2 network=192.168.88.0
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether3 hw=yes
add bridge=bridge1 interface=ether4 hw=yes
add bridge=bridge1 interface=ether5 hw=yes
/ip address
add address=192.168.88.1/24 interface=bridge1 network=192.168.88.0
For tagged VLAN Management IP address add VLAN 99 interface and assign IP address to it. Since the master-port receives all
the traffic coming from switch-cpu port, VLAN interface has to be configured on the master-port, in this case "ether2" port. Now
from switch-chip point there also has to be VLAN 99 tagging on switch1-cpu port.
/interface vlan
add name=vlan99 vlan-id=99 interface=ether2
/ip address
add address=192.168.88.1/24 interface=vlan99 network=192.168.88.0
/interface vlan
add name=vlan99 vlan-id=99 interface=bridge1
/ip address
add address=192.168.88.1/24 interface=vlan99 network=192.168.88.0
After valid VLAN99 configuration unknown/invalid VLAN forwarding can be disabled in global switch settings.
VLAN
Note: It is recommended to get Serial Console cable and test it before configuring VLANs because you may lose access to the CPU and/or
the port you are connected to.
Note: Some changes may take some time to take effect due to already learned MAC addreses. In such cases flushing Unicast Forwarding
Database can help: /interface ethernet switch unicast-fdb flush
Note: Multiple master-port configuration is designed as fast and simple port isolation solution, but it limits part of VLAN functionality
supported by CRS switch-chip. For advanced configurations use one master-port within CRS switch chip for all ports, configure VLANs and
isolate port groups with port isolation profile configuration.
Choose a master port and enslave the ports you need to be in the same switch group.
/interface ethernet
set ether6 master-port=ether2
set ether7 master-port=ether2
set ether8 master-port=ether2
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether6 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
add bridge=bridge1 interface=ether8 hw=yes
Add VLAN 200, VLAN 300 and VLAN 400 tagging on ether2 port to create it as VLAN trunk port. Egress-VLAN-Tag entry is
mandatory for every VLAN to make VLAN access ports work. If VLAN trunk port has not been chosen yet, Egress-VLAN-Tag
entry has to be added with tagged-ports="".
VLAN membership definitions in the VLAN table are required for proper isolation. Adding entries with VLAN id and ports makes
that VLAN traffic valid on those ports.
After valid VLAN configuration unknown/invalid VLAN forwarding can be disabled in global switch settings.
/interface ethernet
set ether6 master-port=ether2
set ether7 master-port=ether2
set ether8 master-port=ether2
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether6 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
add bridge=bridge1 interface=ether8 hw=yes
Add initial VLAN assignments (PVID) for untagged traffic on ether6, ether7, ether8 ports.
Add VLAN 200, VLAN 300 and VLAN 400 tagging on ports according to diagram. The tagged-ports option allow multiple
values to support tagging on many ports.
VLAN membership definitions in the VLAN table are required for proper isolation. Adding entries with VLAN id and ports makes
that VLAN traffic valid on those ports.
/interface ethernet
set ether6 master-port=ether2
set ether7 master-port=ether2
set ether8 master-port=ether2
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether6 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
add bridge=bridge1 interface=ether8 hw=yes
/interface ethernet
set ether7 master-port=ether2
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
Add VLAN 200, VLAN 300 and VLAN 400 tagging on ether2 port to create it as VLAN trunk port.
InterVLAN Routing
InterVLAN Routing
InterVLAN routing configuration consists of two main parts – VLAN tagging in switch-chip and routing in RouterOS. This configuration
can be used in many applications by combining it with DHCP server, Hotspot, PPP and other features for each VLAN. Additionally this
example covers blocking of unwanted other VLAN traffic on ports.
/interface ethernet
set ether6 master-port=ether2
set ether7 master-port=ether2
set ether8 master-port=ether2
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether6 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
add bridge=bridge1 interface=ether8 hw=yes
Set VLAN tagging on CPU port for all VLANs to make packets tagged before they are routed and add ingress VLAN translation
rules to ensure correct VLAN id assignment is done on access ports.
For routing add VLAN interfaces on master-port because it connects with CPU port and add IP addresses to created VLAN
interfaces. In this example three 192.168.x.1 addresses are added to vlan200, vlan300 and vlan400 interfaces.
/interface vlan
add name=vlan200 interface=ether2 vlan-id=200
add name=vlan300 interface=ether2 vlan-id=300
add name=vlan400 interface=ether2 vlan-id=400
/ip address
add address=192.168.20.1/24 interface=vlan200 network=192.168.20.0
add address=192.168.30.1/24 interface=vlan300 network=192.168.30.0
add address=192.168.40.1/24 interface=vlan400 network=192.168.40.0
This example covers typical VLAN tunneling use case where service provider devices add another VLAN tag for independent
forwarding in the mean time allowing customers to use their own VLANs.
Q-in-Q VLAN
CRS-1:The first switch on the edge of service provider network has to properly indentify traffic from customer VLAN id on port and
assign new service VLAN id with ingress VLAN translation rules.
VLAN trunk port configuration for service provider VLAN tags is in the same egress-vlan-tag table.
The main difference from basic Port Based VLAN configuration is that CRS switch-chip has to be set to do forwarding according to
service (outer) VLAN id instead of customer (inner) VLAN id.
/interface ethernet
set ether2 master-port=ether1
set ether9 master-port=ether1
CRS-2: The second switch in the service provider network require only switched ports using master-port and bridge-type configured
to do forwarding according to service (outer) VLAN id instead of customer (inner) VLAN id.
/interface ethernet
set ether10 master-port=ether9
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether9 hw=yes
add bridge=bridge1 interface=ether10 hw=yes
/interface ethernet
set ether4 master-port=ether3
set ether10 master-port=ether3
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether3 hw=yes
add bridge=bridge1 interface=ether4 hw=yes
add bridge=bridge1 interface=ether10 hw=yes
Mirroring
Mirroring
The Cloud Router Switches support three types of mirroring. Port based mirroring can be applied to any of switch-chip ports, VLAN
based mirroring works for all specified VLANs regardless switch-chip ports and MAC based mirroring copies traffic sent or received
from specific device reachable from the port configured in Unicast Forwarding Database.
The first configuration sets ether5 port as a mirror0 analyzer port for both ingress and egress mirroring, mirrored traffic will be sent to this
port. Port based ingress and egress mirroring is enabled from ether6 port.
The second example requires ports to be switched in a group. Mirroring configuration sets ether5 port as a mirror0 analyzer port and sets
mirror0 port to be used when mirroring from VLAN occurs. VLAN table entry enables mirroring only for VLAN 300 traffic between
ether2 and ether7 ports.
/interface ethernet
set ether7 master-port=ether2
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
The third configuration also requires ports to be switched in a group. Mirroring configuration sets ether5 port as a mirror0 analyzer port
and sets mirror0 port to be used when mirroring from Unicast Forwarding database occurs. The entry from Unicast Forwarding database
enables mirroring for packets with source or destination MAC address E7:16:34:A1:CD:18 from ether8 port.
# pre-v6.41 master-port configuration
/interface ethernet
set ether8 master-port=ether2
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether8 hw=yes
Trunking
Trunking
The Trunking in the Cloud Router Switches provides static link aggregation groups with hardware automatic failover and load balancing.
IEEE802.3ad and IEEE802.1ax compatible Link Aggregation Control Protocol is not supported yet. Up to 8 Trunk groups are supported
with up to 8 Trunk member ports per Trunk group.
Configuration requires a group of switched ports and an entry in the Trunk table.
/interface ethernet
set ether6 master-port=ether2
set ether7 master-port=ether2
set ether8 master-port=ether2
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether6 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
add bridge=bridge1 interface=ether8 hw=yes
This example also shows proper bonding configuration in RouterOS on the other end.
/interface bonding
add name=bonding1 slaves=ether2,ether3,ether4 mode=balance-xor transmit-hash-policy=layer-2-and-3 \
link-monitoring=mii mii-interval=100ms
Note: You can find a working example for trunking and port based VLANs at CRS VLANs with Trunks page.
/interface ethernet
set ether6 master-port=ether2
set ether7 master-port=ether2
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether6 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
CRS1xx/2xx switches also allow to learn one dynamic MAC per port to ensure only one end user device is connected no matter of its
MAC address.
/interface ethernet
set ether6 master-port=ether2
set ether7 master-port=ether2
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether6 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
Isolation
The Cloud Router Switches use port-level isolation profiles for Private VLAN implementation:
This example requires a group of switched ports. Assume that all ports used in this example are in one switch group configured
with master-port setting.
/interface ethernet
set ether6 master-port=ether2
set ether7 master-port=ether2
set ether8 master-port=ether2
set ether9 master-port=ether2
set ether10 master-port=ether2
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether6 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
add bridge=bridge1 interface=ether8 hw=yes
add bridge=bridge1 interface=ether9 hw=yes
add bridge=bridge1 interface=ether10 hw=yes
The first part of port isolation configuration is setting the Uplink port – set port profile to 0 for ether2.
Then continue with setting isolation profile 1 to all isolated ports and adding the communication port for port isolation profile 1.
Protocol level isolation on CRS switches can be used to enchance network security. For example, restricting DHCP traffic between the
users and allowing it only to trusted DHCP server port can prevent security risks like DHCP spoofing attack. The following example
shows how to configure it on CRS.
Choose a master port and enslave the ports you need to be within the same switch group.
/interface ethernet
set ether2 master-port=ether1
set ether3 master-port=ether1
set ether4 master-port=ether1
set ether5 master-port=ether1
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether1 hw=yes
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether3 hw=yes
add bridge=bridge1 interface=ether4 hw=yes
add bridge=bridge1 interface=ether5 hw=yes
Set the same Community port profile for all DHCP client ports. Community port profile numbers are from 2 to 30.
And configure port isolation/leakage profile for selected Community (2) to allow DHCP traffic destined only to port where the
trusted DHCP server is located. registration-status and traffic-type properties have to be set empty in order to apply
restriction only for DHCP protocol.
MAC based traffic scheduling and shaping: [MAC address in UFDB] -> [QoS Group] -> [Priority] -> [Queue] -> [Shaper]
VLAN based traffic scheduling and shaping: [VLAN id in VLAN table] -> [QoS Group] -> [Priority] -> [Queue] -> [Shaper]
Protocol based traffic scheduling and shaping: [Protocol in Protocol VLAN table] -> [QoS Group] -> [Priority] -> [Queue] -> [Shaper]
PCP/DEI based traffic scheduling and shaping: [Switch port PCP/DEI mapping] -> [Priority] -> [Queue] -> [Shaper]
DSCP based traffic scheduling and shaping: [QoS DSCP mapping] -> [Priority] -> [Queue] -> [Shaper]
In Strict Priority scheduling mode, the highest priority queue is served first. The queue number represents the priority and the queue with
highest queue number has the highest priority. Traffic is transmitted from highest priority queue until the queue is empty, and then moves
to the next highest priority queue, and so on. If no congestion is present on the egress port, packet is transmitted as soon as it is received.
If congestion occurs on the port where high priority traffics keep coming, the lower priority queues starve.
On all CRS switches the scheme where MAC based egress traffic scheduling is done according to internal Priority would be following:
[MAC address] -> [QoS Group] -> [Priority] -> [Queue];
In this example host1 (E7:16:34:00:00:01) and host2 (E7:16:34:00:00:02) will have higher priority 1 and the rest of the hosts will have
lower priority 0 for transmited traffic on port ether7. Note that CRS has maximum 8 queues per port.
/interface ethernet
set ether7 master-port=ether6
set ether8 master-port=ether6
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether6 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
add bridge=bridge1 interface=ether8 hw=yes
Add UFDB entries to match specific MACs on ether7 and apply QoS group1
Configure ether7 port queues to work according Strict Priority and QoS scheme only for destination address.
The scheme where MAC based traffic shaping is done according to internal Priority would be following: [MAC address] -> [QoS Group]
-> [Priority] -> [Queue] -> [Shaper];
In this example unlimited traffic will have priority 0 and limited traffic will have priority 1 with the bandwidth limit 10Mbit. Note that
CRS has maximum 8 queues per port.
/interface ethernet
set ether7 master-port=ether6
set ether8 master-port=ether6
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether6 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
add bridge=bridge1 interface=ether8 hw=yes
Add UFDB entry to match specific MAC on ether8 and apply QoS group1
Configure ether8 port queues to work according Strict Priority and QoS scheme only for destination address.
If CRS switch supports Access Control List, this configuration would be simplier.
Best practice is to assign lower internal QoS Priority for traffic limited by shaper to make it also less important in Strict Priority
scheduler. (higher priority should be more important and unlimited)
In this example:
VLAN10 -> QoS group0 = traffic limited by shaper
VLAN20 -> QoS group1 = normal traffic
VLAN30 -> QoS group2 = prioritized traffic
/interface ethernet
set ether7 master-port=ether6
set ether8 master-port=ether6
/interface bridge
add name=bridge1 igmp-snooping=no protocol-mode=none
/interface bridge port
add bridge=bridge1 interface=ether6 hw=yes
add bridge=bridge1 interface=ether7 hw=yes
add bridge=bridge1 interface=ether8 hw=yes
Configure ether7, ether8 port queues to work according Strict Priority and QoS scheme only for VLAN based QoS.
Bandwidth Limiting
Both Ingress Port policer and Shaper provide bandwidth limiting features for CRS switches.
Broadcast storm control example on ether5 port with 500 packet limit per second:
Example with multiple packet types which includes ARP and ND protocols and unregistered multicast traffic. Unregistered
multicast is traffic which is not defined in Multicast Forwarding database.
/interface ethernet
set ether2 master-port=ether1
set ether3 master-port=ether1
set ether4 master-port=ether1
Slave ports are dynamically added to the bridge only to show STP status. Forwarding through switched ports still are handled by
hardware switch chip.