Sei sulla pagina 1di 32

MikroTik RouterOS Workshop QoS Best Practice

Chicago,IL MUM USA 2008

© MikroTik 2008

Plan

Discuss best QoS practice forPlan Large scale user speed limitations Prioritization of traffic based on traffic type Implement best practice

Large scale user speed limitationsPlan Discuss best QoS practice for Prioritization of traffic based on traffic type Implement best practice

Prioritization of traffic based on traffic typebest QoS practice for Large scale user speed limitations Implement best practice You will be able

Implement best practicelimitations Prioritization of traffic based on traffic type You will be able to follow the progress

You will be able to follow the progress – just connect to SSID “QoS” and open up the Winbox

to address 10.1.1.254 password)

(default user name and

User Limitation

User Limitation T3/E3 line ~40 Mbps ● You have more than 400 clients ● Task: ●
User Limitation T3/E3 line ~40 Mbps ● You have more than 400 clients ● Task: ●
User Limitation T3/E3 line ~40 Mbps ● You have more than 400 clients ● Task: ●

T3/E3 line

User Limitation T3/E3 line ~40 Mbps ● You have more than 400 clients ● Task: ●

~40 Mbps

User Limitation T3/E3 line ~40 Mbps ● You have more than 400 clients ● Task: ●

You have more than 400 clients

Task:

Divide clients into 3 groups

Business (4Mbps/1Mbps) connection

Standard (750kbps/250kbps) connection

Basic (375kbps/125kbps) connection

© MikroTik 2008

3

Simple Queue For Each Client

Each simple queue creates 3 separate queues:Simple Queue For Each Client One in global-in (“direct” part) One in Global-out (“reverse” part) One

One in global-in (“direct” part)For Each Client Each simple queue creates 3 separate queues: One in Global-out (“reverse” part) One

One in Global-out (“reverse” part)3 separate queues: One in global-in (“direct” part) One in Global-total (“total” part) Simple queues are

One in Global-total (“total” part)(“direct” part) One in Global-out (“reverse” part) Simple queues are ordered - similar to firewall rules

Simple queues are ordered - similar to firewall rules(“reverse” part) One in Global-total (“total” part) further down = longer packet processing further down =

further down = longer packet processingpart) Simple queues are ordered - similar to firewall rules further down = smaller chance to

further down = smaller chance to get trafficto firewall rules further down = longer packet processing (necessary to reduce number of queues) ©

(necessary to reduce number of queues)

Possible Solutions

RouterOS have 4 queue types:Possible Solutions FIFO – First In First Out (for Bytes or for Packets) RED – Random

FIFO – First In First Out (for Bytes or for Packets)Possible Solutions RouterOS have 4 queue types: RED – Random Early Detect (or Drop) SFQ –

RED – Random Early Detect (or Drop)FIFO – First In First Out (for Bytes or for Packets) SFQ – Stochastic Fairness Queuing

SFQ – Stochastic Fairness QueuingBytes or for Packets) RED – Random Early Detect (or Drop) PCQ – Per Connection Queuing

PCQ – Per Connection Queuing (MikroTik Proprietary)Early Detect (or Drop) SFQ – Stochastic Fairness Queuing Firewall Mangle and Address-lists Queue Tree ©

Firewall Mangle and Address-listsSFQ – Stochastic Fairness Queuing PCQ – Per Connection Queuing (MikroTik Proprietary) Queue Tree © MikroTik

Queue TreeQueuing PCQ – Per Connection Queuing (MikroTik Proprietary) Firewall Mangle and Address-lists © MikroTik 2008 5

Default Queue Types

Default Queue Types © MikroTik 2008 6
© MikroTik 2008 7
© MikroTik 2008 8

Behaviour:

SFQ

Based

on

hash

value

from

source

and

destination

address

SFQ

divides

traffic

into

1024 sub-streams

Then Round Robin algorithm will distribute equal amount of traffic to each sub-stream

sub-streams Then Round Robin algorithm will distribute equal amount of traffic to each sub-stream © MikroTik
© MikroTik 2008 10

PCQ

Behaviour:

Based on classifier PCQ divides traffic into sub- streams. Each sub-stream can be considered as FIFO queue with queue size specified by “limit” option After this PCQ can be considered as FIFO queue where queue size is specified by “total-limit” option.

this PCQ can be considered as FIFO queue where queue size is specified by “total-limit” option.
© MikroTik 2008 12
© MikroTik 2008 13
© MikroTik 2008 14

Plan

Create an address list for client classesPlan Use “connection-mark” (mangle) feature to classify all connections based on client class Use “packet-mark”

Use “connection-mark” (mangle) feature to classify all connections based on client classPlan Create an address list for client classes Use “packet-mark” (mangle) feature to classify all traffic

Use “packet-mark” (mangle) feature to classify all traffic based on client classfeature to classify all connections based on client class Create a PCQ queue for each client

Create a PCQ queue for each client class with rate option specifiedfeature to classify all traffic based on client class about user-user communications??? what about unmarked

about user-user communications???a PCQ queue for each client class with rate option specified what about unmarked traffic ?

what

about unmarked traffic ?queue for each client class with rate option specified about user-user communications??? what what © MikroTik

what

Address Lists

Address Lists © MikroTik 2008 16

© MikroTik 2008

16

Where?

There are 5 places to mangleWhere? There are 4 places to limit © MikroTik 2008 17

There are 4 places to limitWhere? There are 5 places to mangle © MikroTik 2008 17

Where? There are 5 places to mangle There are 4 places to limit © MikroTik 2008

Connection-mark rule

Connection-mark rule © MikroTik 2008 18

Packet-mark rule

Packet-mark rule © MikroTik 2008 19

Working Mangle- Winbox view

Working Mangle- Winbox view © MikroTik 2008 20

Working Mangle- Export view

Working Mangle- Export view © MikroTik 2008 21

Queuing Placement

Limitation for in mangle chain “forward” marked traffic can be placed in the “global-out” or interface queueQueuing Placement If queues will be placed in the interface queues queues on the public interface

If queues will be placed in the interface queuescan be placed in the “global-out” or interface queue queues on the public interface will capture

queues on the public interface will capture only client uploadqueue If queues will be placed in the interface queues queues on the local interface will

queues on the local interface will capture only client's downloadon the public interface will capture only client upload If queues will be placed in global-out

If queues will be placed in global-out download and upload will be limited together (separate marks (separate marks

needed)

PCQ Types – Winbox View

PCQ Types – Winbox View © MikroTik 2008 23

Queue Tree – Winbox View

Queue Tree – Winbox View © MikroTik 2008 24

Queue Tree – Export View

Queue Tree – Export View © MikroTik 2008 25

PCQ Queue Size

PCQ Queue Size Total_limit = X can take up to X*(2000 bytes + 200 bytes) of

Total_limit = X can take up to X*(2000 bytes + 200 bytes) of RAM

2000 bytes – buffer for 1 packet 200 bytes – service data for 1 packet

total_limit = 2000 =< 4,2MB RAM total_limit = 5000 =< 10,5MB RAM

It can take only 40 users to fill the queue= 2000 =< 4,2MB RAM total_limit = 5000 =< 10,5MB RAM (because total_limit/limit = 2000/50 =

(because total_limit/limit = 2000/50 = 40)

It is necessary to increase “total_limit” or (and) decrease the “limit” valueto fill the queue (because total_limit/limit = 2000/50 = 40) There must be at least 10-20

There must be at least 10-20 packet places in queue available per user2000/50 = 40) It is necessary to increase “total_limit” or (and) decrease the “limit” value ©

PCQ Adjustments

There are ~340 Basic class clients so:PCQ Adjustments pcq_limit = 40 pcq_total_limit = 7000 ( ~20*340) (~15MB) There are ~40 Standard class

pcq_limit = 40PCQ Adjustments There are ~340 Basic class clients so: pcq_total_limit = 7000 ( ~20*340) (~15MB) There

pcq_total_limit = 7000 ( ~20*340) (~15MB)There are ~340 Basic class clients so: pcq_limit = 40 There are ~40 Standard class clients

There are ~40 Standard class clients so:so: pcq_limit = 40 pcq_total_limit = 7000 ( ~20*340) (~15MB) pcq_limit = 30 pcq_total_limit = 1000

pcq_limit = 30( ~20*340) (~15MB) There are ~40 Standard class clients so: pcq_total_limit = 1000 ( ~20*40) (~2MB)

pcq_total_limit = 1000 ( ~20*40) (~2MB)There are ~40 Standard class clients so: pcq_limit = 30 There are ~20 Business class clients

There are ~20 Business class clients so:so: pcq_limit = 30 pcq_total_limit = 1000 ( ~20*40) (~2MB) pcq_limit = 20 (!!!) pcq_total_limit =

pcq_limit = 20 (!!!)( ~20*40) (~2MB) There are ~20 Business class clients so: pcq_total_limit = 500 ( ~20*20) (~1MB)

pcq_total_limit = 500 ( ~20*20) (~1MB)= 1000 ( ~20*40) (~2MB) There are ~20 Business class clients so: pcq_limit = 20 (!!!)

Traffic Prioritization

Business Class Clients Basic Class Clients Standard Class Clients
Business Class Clients
Basic Class Clients
Standard Class Clients
Class Clients Basic Class Clients Standard Class Clients T3/E3 line ~40 Mbps ~5Mbps abroad You have
Class Clients Basic Class Clients Standard Class Clients T3/E3 line ~40 Mbps ~5Mbps abroad You have

T3/E3 line

Basic Class Clients Standard Class Clients T3/E3 line ~40 Mbps ~5Mbps abroad You have problems with

~40 Mbps ~5Mbps abroad

Standard Class Clients T3/E3 line ~40 Mbps ~5Mbps abroad You have problems with on-line communications (video,

You have problems with on-line communications (video, audio, VOIP, games)

Task:

Make necessary traffic prioritization

© MikroTik 2008

28

Prioritization plan

Prioritization plan © MikroTik 2008 29

Where?

There are 5 places to mangleWhere? There are 4 places to limit © MikroTik 2008 30

There are 4 places to limitWhere? There are 5 places to mangle © MikroTik 2008 30

Where? There are 5 places to mangle There are 4 places to limit © MikroTik 2008

How?

How? © MikroTik 2008 31
Priorities Create packet marks in the mangle chain “Prerouting” for traffic prioritization in the global-

Priorities

Create packet marks in the mangle chain “Prerouting” for traffic prioritization in the global- in queue

Ensign_services (Priority=1)for traffic prioritization in the global- in queue User_requests (Priority=3) Communication_services

User_requests (Priority=3) Communication_services (Priority=5)in the global- in queue Ensign_services (Priority=1) Download_services (Priority=7) P2P_services (Priority=8) ©

Download_services (Priority=7)User_requests (Priority=3) Communication_services (Priority=5) P2P_services (Priority=8) © MikroTik 2008 32

P2P_services (Priority=8)User_requests (Priority=3) Communication_services (Priority=5) Download_services (Priority=7) © MikroTik 2008 32