QoS configuration EcoRouter Documentation / QoS configuration
- QoS Architecture
- Traffic classification
- RED
- Scheduler
- Counters
- Limiter
- Traffic marking
- Traffic re-marking
- Service policy
- Traffic profile
- Class map
- Incoming traffic limitation by class
QoS (quality of service) - this term refers to the probability that the communication network corresponds to a specified traffic agreement. QoS also means the ability to guarantee the delivery of packets, bandwidth control, prioritization for different classes of network traffic.
QoS Architecture
In EcoRouter, the QoS implementation scheme is divided logically into several interacting blocks:
- Classifier
- RED
- Scheduler
Traffic arriving at the interface arrives at the Classifier, where it is assigned labels, according to the established classes. Then, using the RED mechanism, the traffic is aligned with the pre-set parameters and data coming from the Scheduler, and some of the packets are discarded. After that, the packets are placed in the Scheduler queue and skipped to the output according to the specified rules. The Scheduler rules begin to be executed only if the amount of traffic exceeds the specified value of the policer.
This scheme is implemented for each service instance.
Each of the blocks is described in more detail below.
Traffic classification
To configure traffic classification in EcoRouterOS the special class cards must be used, the appropriate traffic profile shouild be created and binded to the service instance. Thus the packets incoming to service instance can be classified i.e. processed and inspected by another QoS functional.
Use the class-map <NAME> command in configuration mode to create class card where <NAME> is arbitrary string. The recommended name format is string of all capital letters.
Example:
ecorouter(config)# class-map VIDEO
ecorouter(config)# class-map IPVOICE
ecorouter(config)# class-map MYCLASS
After the class card is created its configuration mode enabled.
Example:
ecorouter(config)# class-map VOICE
ecorouter(config-cmap)#?
Traffic classifier configuration commands:
exit Exit from the current mode to the previous mode
help Description of the interactive help system
match Classification criteria
no Negate a command or set its defaults
set Set marking values
show Show running system information
Use the command match in configuration mode to highlight specific packets from the traffic stream by specifying field value or its name in Ethernet, MPLS or IP headers. Depending of this filed value the traffic is classified. Using multiple match rules is equivalent of logical OR.
Example:
ecorouter(config-cmap)#match ?
cos IEEE 802.1Q class of service priority values
dscp Match DSCP in IP packets
exp Match MPLS experimental
ecorouter(config-cmap)#match cos ?
<0-7> Enter class-of-service values
ecorouter(config-cmap)#match dscp ?
<0-63> Enter DSCP values
ecorouter(config-cmap)#match exp ?
<0-7> Enter MPLS exp values
As can be seen from the example, the classification in EcoRouterOS can be carried out over the cos, dscp and exp fields. Values can be specified only in decimal form. A set of values can be specified by using a comma "," or a range using the hyphen "-" as a delimiter.
Use the traffic-profile <NAME> command to create the traffic profile where <NAME> is arbitrary string. The recommended name format is digits or string of all capital letters.
After the traffic profile is created its configuration mode enabled.
Example:
ecorouter(config)# traffic-profile 1
ecorouter(config-traffic-profile)# ?
Traffic profile configuration commands:
class Select a class to configure
exit Exit from the current mode to the previous mode
help Description of the interactive help system
no Negate a command or set its defaults
show Show running system information
Use the class command to bind the traffic class to the profile. The previously configured class card must be specified.
Example:
ecorouter(config)#traffic-profile 1
ecorouter(config-profile)#class VIDEO
ecorouter(config-profile)#class IPVOICE
Apply the traffic profile to the appropriate service instance to enable classification, the ability to process packets separately from each other and apply different policies depending on the type of incoming traffic. Use the commend in the service instance context configuration mode.
The example of enabling classification for the voice and video traffic is shown below:
ecorouter(config)#class-map VIDEO
ecorouter(config-cmap)#match dscp 1
ecorouter(config-cmap)#exit
ecorouter(config)# class-map IPVOICE
ecorouter(config-cmap)#match dscp 2
ecorouter(config-cmap)#exit
ecorouter(config)#traffic-profile TEST
ecorouter(config-traffic-profile)#class VIDEO
ecorouter(config-traffic-profile)#class IPVOICE
ecorouter(config-cmap)#exit
ecorouter(config)#port ge1
ecorouter(config-port)#service-instance test
ecorouter(config-service-instance)#traffic-profile TEST
Use the show class-map command and the show traffic-profile command to check the configured parameters.
ecorouter#sh class-map
Class map default
Class map IP0
Match dscp: 2
Class map IP1
Match dscp: 4
Class map IP2
Match dscp: 8
Class map IP3
Match dscp: 12
show traffic-profile
Traffic profile prof-dscp
Class IP0
Class IP1
Class IP2
Class IP3
RED
The RED mechanism acts as part of the scheduler, anticipating its operation and based on incoming data from it on the load of queues.
In general, the scheduler is a mechanism that allocates bandwidth at a time when there is more traffic than the dedicated bandwidth. This situation is called Congestion. It is fraught with the fact that at this time, massively and simultaneously there is a loss in all traffic flows, with the exception of small flows, whose speed does not exceed guaranteed. Mass simultaneous loss of packets leads to the fact that TCP-entities simultaneously start the mechanism of TCP window re-initialization, and the speed of all threads simultaneously decreases, after which it simultaneously grows. As a result, the load graph for the interface looks like a sawtooth, and the real load of the interface never takes an established value, i.e. The interface is not used completely at one time, and experiences overloading in others. The RED mechanism is used in order to avoid this behavior.
The operation of the RED mechanism is to randomly drop packets earlier than they arrive in the queue. This allows one to ensure that TCP sessions change the size of the window alternately. The probability of dropping packets in this case is an adaptive value. The user sets the value of the interface load, at which the probability becomes different from 0 and starts to grow. In addition, the maximum packet reject probability and the load value of the interface are set, at which the probability becomes equal to this value. If the interface load varies within these two speeds, the probability of dropping increases from 0 to the specified maximum value, according to the accepted mathematical function that takes into account the average bandwidth utilization, the number of packets missed without discarding.
RED configuration
To enable the RED mechanism, you must enter the random-detect command in the scheduler configuration mode.
The parameters of the RED mechanism are set when configuring the queues in the scheduler.For each queue, two boundaries are defined: the minimum and maximum range limits from which random packets will be dropped (min/max threshold).
The boundaries are set according to the parameters red-min <NUM> and red-max <NUM>. Since the queue length in EcoRouterOS is determined dynamically, the values can be set in the range from 0% to 100% of the maximum speed for the queue (PIR). The red-min value must not be greater than the red-max value.
If the values of both red-min and red-max are 0, the RED mechanism will be disabled.
Until the minimum boundary is reached, the probability that the packet will be discarded is zero. After that, the probability begins to grow to the highest possible level, which is regulated by the parameter red-inv-prob. This parameter sets the denominator value in the fraction that determines the probability of dropping a packet (Probability = 1 / X).
The parameter values can be set in the range [1 - 255]. The default value is 10.
With this value, the probability that the packet will be discarded is 0.1 (Probability = 1/10 = 0.1), in other words, every 10th packet will be discarded.
WRED configuration
The RED mechanism prevents the overflow of the queue related to the service instance at large.
The WRED mechanism allows to prevent overflow of any queue configured in the scheduler. Thus, allowing you to configure WRED parameters for each queue separately.
To enable the WRED mechanism, you must enter the weighted-random-detect command in the scheduler configuration mode.
For each queue, two boundaries are defined: the minimum and maximum range limits from which random packets will be dropped (min/max threshold).
The boundaries are set according to the parameters wred-min <NUM> and wred-max <NUM>. Since the queue length in EcoRouterOS is determined dynamically, the values can be set in the range from 0% to 100% of the maximum speed for the queue (PIR). The wred-min value must not be greater than the wred-max value.
If the values of both wred-min and wred-max are 0, the WRED mechanism will be disabled.
Until the minimum boundary is reached, the probability that the packet will be discarded is zero. After that, the probability begins to grow to the highest possible level, which is regulated by the parameter wred-inv-prob. This parameter sets the denominator value in the fraction that determines the probability of dropping a packet (Probability = 1 / X).
The parameter values can be set in the range [1 - 255]. The default value is 10.
With this value, the probability that the packet will be discarded is 0.1 (Probability = 1/10 = 0.1), in other words, every 10th packet will be discarded.
Scheduler
The scheduler manages the queuing mechanism. The queue in the EcoRouter concept is a software-implemented queue of packages. Packets in this queue are held by the scheduler until the space in the hardware queue is available (the port becomes available) for further packet sending.
There are 8 queues in EcoRouter: queue 0 - queue 7. The queue priority denoted by its number, determines the order in which queues are processed (see the figure below). That is, after transferring the Committed Information Rate (CIR), the queue 0 with the highest priority will be processed first. Next, the queue 1, 2 and so on will be processed.
The size of each queue varies dynamically. This is necessary to maintain acceptable bandwidth, delay and jitter for non-priority queues. This gives flexibility in the various options for building a network and the types of traffic being transmitted. The network administrator does not have to worry about maintaining acceptable parameters for delay and phase jitter, only the bandwidth for a particular type of traffic must be specified.
Queues are correlated with traffic classes. The settings allows to control which part of the traffic of a particular class has more guarantees to be delivered. This division based on the amount of traffic of a particular class that has been transferred from the beginning of the iteration to a certain time. For this purpose, the concepts CIR and PIR are introduced.
CIR (Committed Information Rate) is the amount of traffic sent during delta time, which will be transmitted assuredly. PIR (Peak Information Rate) is the maximum bandwidth for the queue. Traffic exceeding PIR will unconditionally be discarded. If there is traffic in the other queues, it can displace the traffic that exceeds the CIR value in accordance with the priority.
For each queue, the CIR and PIR parameters in percent or in the absolute value (Kbps) can be specified. Also the remainder parameter can be specified. It is responsible for allocating the remaining unoccupied part of the bandwidth.
The default traffic class of the 7st queue is default. This is a service class, which receives any traffic that is not specified in the other classes. This class can not be configured, but can be assigned to any queue.
The algorythm of scheduler queue processing is shown on the diagram below.
As shown in the figure, if there is a packet in the priority queue, the scheduler first will try to provide the specified CIR for all queues, and only then distribute the packets according to the priorities. After checking for CIR and PIR for the queue, the packet is transferred to the network card and sent, if there is free space in the hardware queue. If the priority queue no longer contains the packets for transmission, the scheduler starts to process the packets from the other queue. Then the process is repeated again, through the priority queue.
Queques and scheduler configuration
To create a scheduler in the configuration mode, use the command: traffic-scheduler pqwrr. <NUM>.
The name of the scheduler must start with the prefix "pqwrr.".
Then the queue is set in the created scheduler.
Command Syntax: queue <0-31> class <NAME> cir <CIR> pir <PIR> (wred-min <0-100> wred-max <0-100>) (wred-inv-prob <1-255>) (cos <0-7>) (dscp <0-64>), the parameters of the command are described in the table below.
Parameter | Description |
---|---|
0-31 | Queue number |
NAME | The name of the generated traffic class or default (this is the service class that receives any traffic that is not specified by the other classes) |
CIR | The amount of traffic sent for delta time, which will be guaranteed. It can be set in one of the following ways:
The total CIR value in the queues of one scheduler can not exceed 100% |
PIR | Traffic exceeding PIR (Peak Information Rate) will certainly be discarded. It can be set in one of the following ways:
|
wred-min | The minimum border of the range from which random packets will be dropped (min / max threshold). It is set in the range from 0 to 100%. The wred-min value must not be greater than the wred-max value. The default value is 0 |
wred-max | The maximum range boundary from which random packets will be dropped (min / max threshold). It is set in the range from 0 to 100%. The default value is 0 |
wred-inv-prob | The maximum probability that the packet will be discarded. The value of the denominator of the fraction is specified: Probability = 1 / X. Values are set in the range (0 - 255). The default value is 10 |
cos | Re-mark the CoS packet field when processing queues. Valid values are from 0 to 7 |
dscp | Re-mark the DSCP packet field when processing queues. Valid values from 0 to 64 |
The wred-min, wred-max and wred-inv-prob parameters set the WRED mechanism settings.
Within a single scheduler, each traffic-class can be assigned only one queue.
Traffic, which did not fall under the rules of the classifier, falls into the default queue with the lowest priority. That is, it is only serviced if the other queues fully realized all traffic within their limitations.
An example of configuring scheduling queues:
ecorouter(config)#traffic-scheduler pqwrr.0
ecorouter(config-traffic-scheduler)# queue 2 class IPVOICE cir 60 pir 100 wred-min 45 wred-max 80 wred-inv-prob 100 cos 7 dscp 32
ecorouter(config-traffic-scheduler)# queue 5 class VIDEO cir 80 pir 100 wred-min 40 wred-max 83 wred-inv-prob 250 dscp 40
% Available CIR is 40 percent
ecorouter(config-traffic-scheduler)# queue 5 class VIDEO cir 40 pir 100 wred-min 40 wred-max 83 wred-inv-prob 250 dscp 40
ecorouter(config-traffic-scheduler)# exit
ecorouter(config)#traffic-scheduler pqwrr.1
ecorouter(config-traffic-scheduler)# queue 4 class IPVOICE cir 20000 kbps pir 50000 kbps wred-min 50 wred-max 100
ecorouter(config-traffic-scheduler)# queue 10 class VIDEO cir 100000 kbps pir 500000 kbps wred-min 5 wred-max 20 wred-inv-prob 200
ecorouter(config-traffic-scheduler)# exit
Counters
To view the QoS counters, use the command show counters port <NAME> qos.
Attention: in EcoRouterOS the following Ethernet frame fields are not considered in data amount in the show group commands: Preamble, Frame delimiter, FCS, Interpacket gap (24 bytes).
Counter readings are grouped by ports and output in tabular form, which indicates the traffic class, the number of dropped packets/bytes and the number of dropped packets/bytes.
To view the QoS counters, use the administrative mode command show counters port <NAME> queues.
Counter readings are grouped by ports and output in tabular form. The traffic class, the number of dropped packets/bytes and the number of dropped packets/bytes becase of queque overload in the case of using RED algorithm are shown in the table.
Example:
Console | Description |
---|---|
ecorouter#show counters port te1 queues | Show the QoS counters values for te1 port |
Command output |
To view the QoS counters when using the WRED algorithm, use the administrative mode command show counters port <NAME> wred.
The traffic class, configured parameters, the queque depth in % of PIR and the number of dropped packets/bytes in the case of using WRED algorithm are shown.
Example:
Console | Description |
---|---|
ecorouter#show counters port te0 wred | Show the QoS counters values (with WRED) for te0 port |
Command output |
To view the QoS counters by the amount of limited traffic, use the administrative mode command show counters port <NAME> policer {in | out}.
Counter readings are grouped by ports. Data on the passed and discarded packets/bytes are outputted.
Example:
Console | Description |
---|---|
ecorouter#show counters port te1 policer in | Output the values of the limited traffic counters for port te1, incoming traffic |
Port te1 Service instance te1.te1/eth2_2 traffic limiter policer.0 MATCHED DROPPED packets/bytes packets/bytes 30129/45596138 3184/4818608 Service instance te1.te1/eth3_3 traffic limiter policer.0 MATCHED DROPPED packets/bytes packets/bytes 30722/46494788 3142/4756164 | Command output |
To reset the counters use the clear commands.
ecorouter#clear counters port te1 ?
policer policer statistics
queues QoS queues statistics
red-algorithms QoS RED/WRED algorithms statistics
Limiter
To limit the speed/bandwidth of interfaces in EcoRouter, policers are used. By using policers, service instances can be given bandwidth limits in order to balance load among several service instances.
In order to create a policer create a service policy and specify the allowed bandwith in it. Use the service-policy <NAME> command to create policy where <NAME> is arbitrary string, the recommended name format is capital letters or digits. Use the bandwidth {gbps | mbps | kbps | percent} <VALUE> command to specify bandwidth where <VALUE> is the maximum speed limit in bit per second or in percentage of the total capacity of the port. Here the upper limit of the allocated bandwidth must be specified. The minimum value in kbps which can be set is 64. The valid value range in kbps is between 64 and 256000000. The created policy can be applied to the service-instance for direction needed (see the relevant section of the manual).
The example of outgoing traffic restriction is shown below:
ecorouter(config)#service-policy ECO
ecorouter(config-policy)#bandwidth mbps 10
ecorouter(config)#port ge1
ecorouter(config-port)#service-instance test
ecorouter(config-service-instance)#service-policy ECO out
If you need to change the specified limit, then the context command bandwidth max {kbps | percent} <value> is re-entered with a new value that is written to the configuration file instead of the previous one. In EcoRouterOS, the specified speed does not take into account some Ethernet frame fields: Preamble, Frame delimiter, FCS, Interpacket gap (24 bytes). Accordingly, this concerns the output of statistics on packets on the delimiter and data on queues that can be obtained with the commands of the show group.
To delete the policer, type the command no traffic-limiter <NAME>. This will also remove all the assignments of this polycer from the configuration of the service instances.
The created policers are assigned to the service instances using the qos-limiter policer.NUM {out | in} context command. Where is the name of the policer assigned policer.NUM, and the direction of traffic for which the restriction applies.
In order to remove the policer from the service instance, one need to enter a context command no qos-limiter {out | in}.
Below is an example of the polisher setting.
Creating a policer:
ecorouter(config)#traffic-limiter policer.0
ecorouter(config-traffic-limiter)# bandwidth max percent 60
ecorouter(config-traffic-limiter)#exit
Creating a policer, indicating the absolute value of the bandwidth:
ecorouter(config)#traffic-limiter policer.0
ecorouter(config-traffic-limiter)# bandwidth max kbps 6000
ecorouter(config-traffic-limiter)#exit
Policer appointment to the service interface:
ecorouter(config)#port te1
ecorouter(config-port)#service-instance 100
ecorouter(config-service-instance)#qos-limiter policer.0 out
The result of traffic limiter function in EcoRouterOS in case of limit-exceeding data recieving is shown in the picture below.
Such traffic processing is performed to prevent global TCP synchronization when the limiter and algorithms for early detection of queue filling in the scheduler work together. Thus, users may think that the amount of traffic exceeds the established limits in the limiter. To accumulate a sufficient amount of data and evaluate the average value it takes a rather long time (for constant speed of traffic approx. 300 s). To display the actual amount of traffic passed it is more convenient to use the show counters port queues-speed command.
Traffic marking
The traffic marking is configured in EcoRouterOS using the filter-map entity (see section "Access Lists"). Thus, various actions are applied to the traffic of a certain type, including marking. By marking here is meant that traffic that falls under the rule's rule is assigned a certain class (class-map).
Below is an example of traffic marking with the creation of two class maps with the names L2 and L3 corresponding to filtering levels that set the dscp field values to 30 and 40.
ecorouter(config)#class-map L2
ecorouter(config-cmap)#set dscp 30
ecorouter(config)#class-map L3
ecorouter(config-cmap)#set dscp 40
Create a filter map for L3.
ecorouter(filter-map-ipv4)#filter-map ipv4 L3 10
Adding rules.
ecorouter(filter-map-ipv4)#match icmp host 10.10.10.10 host 192.168.1.10
ecorouter(filter-map-ipv4)#set class-map L3
Create another filter block for L3.
ecorouter(filter-map-ipv4)#filter-map ipv4 L3 20
ecorouter(filter-map-ipv4)#match icmp host 10.10.10.10 host 192.168.1.11
ecorouter(filter-map-ipv4)#set accept
Create a filter map for L2. Where aaa.bbb.ccc is the MAC address of the host 192.168.1.10.
ecorouter(filter-map-ethernet)#filter-map ethernet L2 10
ecorouter(filter-map-ethernet)#match any host aaa.bbb.ccc
Assign an action for L2.
ecorouter(filter-map-ethernet)#set class-map L2
ecorouter(filter-map-ethernet)#filter-map ethernet L2 20
ecorouter(filter-map-ethernet)#match any any
ecorouter(filter-map-ethernet)#set accept
Assign filter-map L3 to the interface input.
ecorouter(config)#int test
ecorouter(config-if)#set filter-map in L3
Assign filter-map L2 to the port service-instance input.
ecorouter(config)#port te1
ecorouter(config-port)#srevice-instance test
ecorouter(config-service-instance)#set filter-map in L2
When traffic arrives at the service instance, it is possible to change the value of its DSCP field or reset it to 0. To do this, use the context-setting mode command for configuring the service instance qos reset dscp (<0-63> |). You can cancel the reset of the DSCP field value using the context menu command for configuring the service instance no qos reset dscp (<0-63> |). If the new value of the field is not specified, then by default it is reset to 0.
ecorouter(config)#port te1
ecorouter(config-port)#service-instance 100
ecorouter(config-service-instance)#qos reset dscp 63
Traffic re-marking
The EcoRouterOS allows to re-mark DSCP, CoS, MPLS EXP fields. Use the set command in the context class card configuration mode to remark fields in the packets previously selected from the traffic (the match rule) by specifying the new values for DSCP, CoS, MPLS EXP fields in the IP, 802.1Q, MPLS headers.
Example:
class-map test
match dscp 8
set dscp 18
The EcoRouterOS allows to classify traffic by one field, and mark by other.
Example:
class-map test
match dscp 8
set cos 1
The EcoRouterOS allows to re-mark multiple fileds simultaneously.
Example:
class-map test
match dscp 8
set cos 1
set exp 2
In order to apply the re-labeling functionality, create a traffic profile, link the created traffic classes to it, create a policy and bind it to a service-instance for the outgoing direction. More detailed information about these steps can be found in the corresponding sections devoted to traffic classification and creation of service policies. The only example of configuring the re-marking outgoing traffic functionality in EcoRouterOS is shown below. Re-marking in the incoming direction is not possible.
The example of the outgoing from the ge1 port traffic re-marking is shown below:
ecorouter(config)#class-map VIDEO
ecorouter(config-cmap)#match dscp 1
ecorouter(config-cmap)#set dscp 11
ecorouter(config-cmap)#exit
ecorouter(config)#class-map IPVOICE
ecorouter(config-cmap)#match dscp 2
ecorouter(config-cmap)#set dscp 12
ecorouter(config-cmap)#exit
ecorouter(config)#traffic-profile TEST
ecorouter(config-traffic-profile)#class VIDEO
ecorouter(config-traffic-profile)#class IPVOICE
ecorouter(config-cmap)#exit
ecorouter(config)#service-policy ECO
ecorouter(config-policy)#traffic-profile TEST
ecorouter(config)#port ge1
ecorouter(config-port)#service-instance test
ecorouter(config-service-instance)#service-policy ECO out
Service policy
In EcoRouterOS for the following functionality:
- classification of data (classifier);
- traffic restrictions (limiter);
- queue management and algorithms for early detection of their filling (scheduler)
service policies must be configured and applied on service instances in the right direction.
Use the service-policy <NAME> command to create policy, where <NAME> is arbitrary, he recommended name format is capital letters or numbers.
After entering the command, the context mode of the policy configuration is enabled, and the following commands are available:
ecorouter(config)#service-policy ECO
ecorouter(config-policy)#?
Service policy configuration commands:
bandwidth Bandwidth
exit Exit from the current mode to the previous mode
help Description of the interactive help system
no Negate a command or set its defaults
scheduler Select a traffic-scheduler to configure
show Show running system information
traffic-profile Select a traffic-profile to use
Configure the bandwidth parameter for the traffic restriction setting. The administrator can choose how to set the maximum bandwidth. Values can be specified in Kbps, Mbps, Gbps or as a percentage of the maximum port speed.
ecorouter(config-policy)#bandwidth ?
gbps Bandwidth value in gbps
kbps Bandwidth value in kbps
mbps Bandwidth value in mbps
percent Bandwidth value as a percentage
Specify the policy and select the appropriate direction to apply a policy to service instance. The command looks like this: ecorouter (config-service-instance) # service-policy <NAME> {in | out}, where <NAME> is the name of the preconfigured policy, and the in and out keywords indicate which traffic direction the policy will be applied to.
The total performance of the QoS functional and the traffic limiter depends on the given direction. So in the incoming direction the data classification, the general traffic restriction and traffic restriction by classes are available. As for the outgoing direction, a policy allows to enable the overall traffic restriction, traffic re-marking, queue scheduler, and algorithms for early detection of queue filling.
To configure the classification, the previously created traffic profile must be binded with the service-policy and applied to the incoming direction. In order to work with the scheduler, bind the previously created scheduler profile to the service-policy and apply it to the outgoing direction in the required service-instance.
Example:
Incoming traffic restriction configuring:
ecorouter(config)#service-policy ECO
ecorouter(config-policy)#bandwidth mbps 10
ecorouter(config)#port ge1
ecorouter(config-port)#service-instance test
ecorouter(config-service-instance)#service-policy ECO in
Outgoing traffic restriction configuring:
ecorouter(config)#service-policy ECO
ecorouter(config-policy)#bandwidth mbps 10
ecorouter(config)#port ge1
ecorouter(config-port)#service-instance test
ecorouter(config-service-instance)#service-policy ECO out
Incoming traffic classification configuring:
ecorouter(config)#service-policy ECO
ecorouter(config-policy)#traffic-profile TEST
ecorouter(config)#port ge1
ecorouter(config-port)#service-instance test
ecorouter(config-service-instance)#service-policy ECO in
Incoming traffic restriction by class configuring:
ecorouter(config)#service-policy ECO
ecorouter(config-policy)#traffic-profile TEST
ecorouter(config-policy)#bandwidth mbps 10
ecorouter(config)#port ge1
ecorouter(config-port)#service-instance test
ecorouter(config-service-instance)#service-policy ECO in
Queue scheduler functions configuring:
ecorouter(config)#service-policy ECO_rx
ecorouter(config-policy)#traffic-profile TEST
ecorouter(config)#service-policy ECO_tx
ecorouter(config-policy)#traffic-profile TEST
ecorouter(config-policy)#bandwidth gbps 1
ecorouter(config-policy)#scheduler FAST
ecorouter(config)#port ge1
ecorouter(config-port)#service-instance test1
ecorouter(config-service-instance)#service-policy ECO_rx in
ecorouter(config)#port ge2
ecorouter(config-port)#service-instance test2
ecorouter(config-service-instance)#service-policy ECO_tx out
Read more about this functionality configuration in the rekevant section of the manual.
Use the show service-policy command to check the configured policy.
Traffic profile
In EcoRouterOS, the user can create profiles of the router's incoming traffic. Through the creation of profiles and preconfigured class-maps, users can apply various QoS policies and traffic restriction functionality to these profiles. Use the traffic-profile <NAME> command to create profile, where <NAME> can be any, the recommended name format is capital letters or numbers.
When creating a traffic profile, the user is in the configuration mode.
Example:
ecorouter(config)# traffic-profile 1
ecorouter(config-traffic-profile)# ?
Traffic profile configuration commands:
class Select a class to configure
exit Exit from the current mode to the previous mode
help Description of the interactive help system
no Negate a command or set its defaults
show Show running system information
Use the class command to bind traffic classes to the profile, the previously configured class map must be specified.
ecorouter(config)#traffic-profile 1
ecorouter(config-profile)#class VIDEO
ecorouter(config-profile)#class IPVOICE
In the traffic profile, classes with overlapping DSCP, CoS, or MPLS EXP fields can not be added. There is one more rule in the traffic profile. The easiest way to explain it is to use an example. Suppose a packet with a tagged field MPLS EXP = 1 and DSCP = 3 comes to the router.
The traffic profile and class maps are configured as follows:
ecorouter(config)#class-map A
ecorouter(config-cmap)#match dscp 3
ecorouter(config-cmap)#exit
ecorouter(config)#class-map B
ecorouter(config-cmap)#match cos 1
ecorouter(config-cmap)#exit
ecorouter(config)#traffic-profile C
ecorouter(config-profile)#class A
ecorouter(config-profile)#class B
In this case, when a packet arrives with MPLS EXP = 1 and DSCP = 3, the packet will belong to class B, since the DOT1Q header goes before the IP header. Based on this, EcoRouterOS will first check the CoS field, then MPLS field and only at the end the DSCP field.
Traffic profiles are used absolutely for all QoS functionality and require to be applied on a specific service-policy. Read more about this functionality in the relevant section of the manual.
Class map
In EcoRouterOS the class-maps are used for traffic class creation and binding to them a specific values of the DSCP, CoS, MPLS EXP fields. Such maps are an integral part of all QoS functions in EcoRouter, because they allow to operate separately different types of traffic entering the router.
The class-maps are configured in configuration mode. Use the class-map <NAME> command to create class-map where <NAME> is arbitrary, the recommended format is all capitalized letters. After entering the command, the mode is changed to context configuriation class map mode.
ecorouter(config)# class-map VOICE
ecorouter(config-cmap)#?
Traffic classifier configuration commands:
exit Exit from the current mode to the previous mode
help Description of the interactive help system
match Classification criteria
no Negate a command or set its defaults
set Set marking values
show Show running system information
Use the match command to specify the correspondence of a certain value of the DSCP, CoS, MPLS EXP fields and the map.
ecorouter(config-cmap)#match ?
cos IEEE 802.1Q class of service priority values
dscp Match DSCP in IP packets
exp Match MPLS experimental
ecorouter(config-cmap)#match cos ?
<0-7> Enter class-of-service values
ecorouter(config-cmap)#match dscp ?
<0-63> Enter DSCP values
ecorouter(config-cmap)#match exp ?
<0-7> Enter MPLS exp values
The user can enter several match commands into the class and define the class using several fields of different types. Thus, the logical rule "OR" begins to work in the map. When the incoming traffic matches the value of any field configured in the class, the traffic will correspond to this class.
To set a new value in the DSCP and CoS fields, when the traffic exits from EcoRouter, use the set command.
ecorouter(config-cmap)#set ?
cos IEEE 802.1Q class of service priority values
dscp Match DSCP in IP packets
ecorouter(config-cmap)#set cos ?
<0-7> Enter class-of-service values
ecorouter(config-cmap)#set dscp ?
<0-63> Enter DSCP values
In the match and set commands, the values can be specified only in decimal form. A set of values can be specified by using a ",", or a range can be specified by using a "-" hyphen as a delimiter.
Class maps allow to classify traffic, restrict it by classes, distribute traffic to different queues, and apply different maintenance policies to them.
Incoming traffic limitation by class
In EcoRouterOS, in addition to the ability to restrict traffic on service-instances in various directions, it is possible to restrict incoming traffic by classes. The data arriving at the router needs to be classified, and then in the created traffic profile the maximum permissible speeds (PIR) for each class must be specified. The limits can be set in bps or as a percentage of the maximum bandwidth in the traffic limiter.
Use the following command to limit the speed in the traffic profile:
class <NAME> {kbps | mbps | gbps | percent} <VALUE>, where <NAME> is arbitrary, the recommended format is all capital letters or digits.
Example:
traffic-profile test
class test10 kbps 500
class test7 mbps 5
class test8 mbps 2
class test9 mbps 2
traffic-profile test2
class A percent 50
class B percent 20
class C percent 20
class D percent 10
Attention: in the traffic profile, the same style of setting the speed must be used, that is, if the speed was specified in percent for the first configured class, then the subsequent speed limits for the classes must be specified in percentage too.
The configured traffic profile must be binded to the service-policy and the maximum allowed bandwidth for all classes must be specified.
service-policy CLIENT_A
traffic-profile test
bandwidth max mbps 100
Specify the configured policy in the context service-instance configuration mode and set it in the incoming direction to enable the limitation for incoming traffic.
port te0
service-instance A
service-policy CLIENT_A in
Use the show counters port <NAME> policer in command to display information about limited traffic.
Use the clear counters port <NAME> policer in command to clear statistics.