You are on page 1of 36

MikroTik RouterOS Workshop QoS Best Practice

Prague MUM Czech Republic 2009

MikroTik 2008

Questions an( $ns ers


Q: Is it possible to prioritize traffic by type for every single client hile having strict per!user li"itations on the sa"e router# $: %es&

Q: 'hat

ill I nee( to achieve that#

$: %ou ill nee(: )*Pac+et ,lo -iagra" 2*./0 12ueue tree*3 4*Mangle3 5*PCQ3 6*$((ress 7ist
MikroTik 2008 2

Mangle
/he "angle facility allo s you to "ar+ IP pac+ets ith special "ar+s8 /hese "ar+s are use( by other router facilities li+e routing an( ban( i(th "anage"ent to i(entify the pac+ets8 $((itionally3 the "angle facility is use( to "o(ify so"e fiel(s in the IP hea(er3 li+e /9: 1-:CP* an( //7 fiel(s8

MikroTik 2008

.ierarchical /o+en 0uc+et


$ll ban( i(th "anage"ent i"ple"entation in Router9: is base( on .ierarchical /o+en 0uc+et 1./0* ./0 allo s you to create hierarchical 2ueue structure an( (eter"ine relations bet een 2ueues Router9: supports 4 virtual ./0s 1global!in3 global!total3 global!out* an( one "ore ;ust before every output interface

MikroTik 2008

Qo: Pac+et ,lo

/his (iagra" is create( fro" Router9: Pac+et ,lo (iagra"8


http:<< i+i8"i+roti+8co"< i+i<Pac+et=,lo
MikroTik 2008 5

-ouble Qo:
It is possible to "ar+ an( shape traffic t ice in the sa"e router:
Mangle chain Prerouting > for first "ar+ing Global-in HTB > for first shaping Mangle chain Forward or Postrouting for secon( "ar+ing Global-out or Out-interface HTB for secon( "ar+ing

-ouble Qo: is only possible ith Queue /ree

MikroTik 2008

'hy not :i"ple Queues#


:i"ple 2ueues are or(ere( ! si"ilar to fire all rules
In or(er to get to 999th 2ueue pac+et ill have to be chec+e( for "atch to all 99? previous 2ueues

@ach si"ple 2ueue might stan( for 4 separate 2ueues:


9ne in Alobal!in 1B(irectC part* 9ne in Alobal!out 1BreverseC part* 9ne in Alobal!total 1BtotalC part*
MikroTik 2008

:i"ple Queues an( Mangle

MikroTik 2008

Queue /ree
/ree 2ueue is one (irectional only an( can be place( in any of the available ./0s Queue /ree 2ueues (onDt have any or(er > all traffic is processe( si"ultaneously $ll chil( 2ueues "ust have pac+et "ar+s fro" B<ip fire all "angleC facility assigne( to the" If place( in the sa"e ./03 :i"ple 2ueue ill ta+e all the traffic a ay fro" the Queue /ree 2ueue
MikroTik 2008 9

Alobal!9ut or Interface ./0#


/here are t o fun(a"ental (ifferences In case of :RC!E$/ 1"as2uera(e* Alobal!9ut ill be a are of private client a((resses3 but Interface ./0 ill not > Interface ./0 is after :RC!E$/ @ach Interface ./0 only receives traffic that ill be leaving through a particular interface > there is no nee( for to separate uploa( an( (o nloa( in "angle
MikroTik 2008 10

Conclusions
'e ill use "angle an( 2ueue tree:
Mar+ traffic by traffic type in "angle chain Prerouting Prioritize an( li"it traffic by type in Alobal!in ./0 Re!Mar+ traffic by clients in "angle chain ,or ar( 7i"it traffic per client in Interface ./0

It is necessary to +eep the a"ount of "angle rules an( 2ueues to a "ini"u" to increase the perfor"ance of this configuration8
MikroTik 2008 11

Client 7i"itation
T3/E3 line ~40 Mbps

You have more than 400 clients and 3 different connection types: Business 4Mbps/!Mbps" connection #tandard $%0&bps/'%0&bps" connection Basic 3$%&bps/!'%&bps" connection

MikroTik 2008

12

PCQ
Per Connection Queue is a 2ueue type capable of (ivi(ing traffic into sub!strea"s base( on selecte( classifiers @ach sub!strea" ill then go through ,I,9 2ueue ith 2ueue size specifie( by Bpc2!li"itC option an( "aFi"al rate specifie( by Bpc2!rateC option

MikroTik 2008

13

MikroTik 2008

14

PCQ Part 2
In or(er to ensure that each PCQ sub!strea" represents one particular client e nee( to create 2 (ifferent PCQ types:
PCQ=uploa( > source a((ress as classifier PCQ=(o nloa( ! (estination a((ress as classifier

PCQ ill (istribute available traffic e2ually bet een sub!2ueues until the pc2!rate is reache( 1if it is specifie(*

MikroTik 2008

15

MikroTik 2008

16

MikroTik 2008

17

PCQ /ypes > 'inboF Gie

MikroTik 2008

18

$((ress 7ists
$((ress lists as intro(uce( to assign "ultiple IP a((resses<ranges to the sa"e fire all rule3 in this ay re(ucing the total nu"ber of fire all rules an( increasing router perfor"ance $((ress lists can be create(:
Manually $uto"atically fro" PPP profile > ;ust specify a((ress!list option an( as soon as the client connects it ill be a((e( to the proper a((ress list $uto"atically fro" R$-IU: > attribute BMi+roti+:)9C
MikroTik 2008 19

$((ress 7ists

MikroTik 2008

20

'here#

MikroTik 2008

21

Pac+et Mar+ing
Use Bconnection!"ar+C action to classify all connections base( on client a((ress list Use Bpac+et!"ar+C action to classify all traffic base( on connection "ar+s Questions to thin+ about:
'hat spee( shoul( be available for 0usiness client if (o nloa(ing fro" basic client# -o you still have un"ar+e( traffic#

MikroTik 2008

22

Connection!"ar+ rule

MikroTik 2008

23

Pac+et!"ar+ rule

MikroTik 2008

24

'or+ing Mangle! 'inboF vie

MikroTik 2008

25

'or+ing Mangle! @Fport vie

MikroTik 2008

26

Queue /ree > 'inboF Gie

MikroTik 2008

27

Queue /ree > @Fport Gie

MikroTik 2008

28

PCQ Queue :ize


It can ta+e only 50 users to fill the 2ueue
1because total=li"it<li"it H 2000<60 H 50*

/otal=li"it H I can ta+e up to IJ12000 bytes K 200 bytes* of R$M 2000 bytes > buffer for ) pac+et 200 bytes > service (ata for ) pac+et total=li"it H 2000 HL 532M0 R$M total=li"it H 6000 HL )036M0 R$M

It is necessary to increase Btotal=li"itC an(<or (ecrease the Bli"itC value /here shoul( be at least )0!20 pac+et places in 2ueue available per user
29

MikroTik 2008

Queue :ize

MikroTik 2008

30

PCQ $(;ust"ents
/here are M450 0asic class clients so:
pc2=li"it H 50 pc2=total=li"it H N000 1 M20J450* 1M)6M0*

/here are M50 :tan(ar( class clients so:


pc2=li"it H 40 pc2=total=li"it H )000 1 M20J50* 1M2M0*

/here are M20 0usiness class clients so:


pc2=li"it H 20 1&&&* pc2=total=li"it H 600 1 M20J20* 1M)M0*

MikroTik 2008

31

/raffic Prioritization
T3/E3 line ~40 Mbps ~%Mbps abroad

Business (lass (lients

You have problems )ith on*line communications video+ audio+ ,-./+ 0ames"

Task:
/rioriti1e the traffic

Basic (lass (lients

#tandard (lass (lients

MikroTik 2008

32

Prioritization Plan

MikroTik 2008

33

'here#

MikroTik 2008

34

.o #

MikroTik 2008

35

Priorities
Create pac+et "ar+s in the "angle chain BPreroutingC for traffic prioritization in the global! in 2ueue
@nsign=services 1PriorityH)* User=re2uests 1PriorityH4* Co""unication=services 1PriorityH6* -o nloa(=services 1PriorityHN* P2P=services 1PriorityH?*

MikroTik 2008

36

You might also like