Difference between revisions of "QoS"

From CTWUG Wiki
Jump to: navigation, search
(Identified Ports)
(Identified Ports)
Line 8: Line 8:
  
 
{| class="wikitable"
 
{| class="wikitable"
|+ '''Identified Ports'''
+
|+Sortable table
! Description || Port || Protocol || Priority
+
! Description !! Port !! Protocol !! Priority
 
|-
 
|-
 
| Pings || || icmp || Interactive
 
| Pings || || icmp || Interactive

Revision as of 14:59, 14 November 2008

What is QoS

Qos (Quality of Service) is the means of shaping traffic to give certain traffic priority above other. In most cases bulk traffic like p2p, FTP or any other bandwidth consuming transfer protocols gets the lowest priority. By doing this we enable latency dependent protocols like ssh, irc, and gaming to work like it should.

CTWUG uses a combination of WMM, DSCP marks, and queues to prioritise traffic. Traffic is divided into 3 groups namely Bulk, Interactive and Realtime. Bulk traffic has the lowest priority on the network and like its name suggest all bulk traffic, like torrents and DC, goes into this group. Interactive traffic has a high priority, this group is for protocols that require low latency and sometimes higher bandwidth, traffic like games and irc will go into this group. The last group is Realtime, this group is more for low latency dependant traffic like VOIP and has the highest priority.

Identified Ports

Here is a list of ports currently being identified by our QoS rules, please note that of a port is not listed here it will automatically fall withing in the Bulk group. To request new ports to be added please use the discussion page, and specify the application using the port.

Sortable table
Description Port Protocol Priority
Pings icmp Interactive
OSPF ospf Interactive
FTP 21 tcp Bulk
SSH 22 tcp Realtime
Telnet 23 tcp Interactive
DNS 53 udp Realtime
HTTP 80 tcp Interactive
NTP 110 udp Realtime
SNMP 161 tcp Realtime
DC++ 411 tcp Bulk
SysLog 513 udp Realtime
DC++ 2222 tcp/udp Bulk
Remote Desktop 3389-3390 tcp Interactive
DC++ 4321 tcp Bulk
VOIP IAX 4569 tcp/udp Realtime
VOIP SIP 5060 udp Realtime
IRC 6667-6669 tcp Interactive
IRC(SSL) 6697 tcp Interactive
Web Proxy 8118 tcp Interactive
Winbox 8291 tcp Realtime
Teamspeak 8765 tcp Realtime
Teamspeak 8766 udp Realtime
Far Cry 9000-9004 tcp Interactive
COD4 28960 udp Interactive
CSS 27000-27065 udp Interactive
CSS 27000-27065 tcp Interactive
Webmin 10000-10001 tcp Interactive

Current implementation of QoS

This is the current implementation of QoS on all the CTWUG highsites. Due to each highsite having different interfaces the queue trees need to be set up manualy and can't be rolled in with a script, the queue tree scrip posted here is just a template to work from. Please note that these scripts are written for ROS3 and will not work with previous versions.

QoS for Gaming on Client Side

Wireless Interface Config

WMM Needs to be enabled on your Wireless interfaces. This allows the traffic to be prioritised on a wireless level.

1. Click Wireless
2. Open the configuration of the wireless interface (wlanX if you've got the default names)
3. Go to the Wireless Tab
4. Look for the WMM Support option
4.1 If you dont have WMM Support listed, click on the Advanced Setup button on the right
5. Set WMM Support to enabled
6. Click okay

Mangle Rules

Mikrotik Firewall Mangle (ROS3.x) These rules will NOT working on 2.9.x versions of RouterOS

How to apply the new rules:

1. Open Winbox
2. Connect to your Mikrotik Router
3. Go to IP > Firewall
4. Select the mangle tab
5. If you have old rules in there from the previous QoS scripts, delete them
6. Open a New Terminal (Its in the menu on the left)
7. Copy everything in the box below
8. Paste into Terminal (right click, and paste)

/ip firewall mangle
add action=change-dscp chain=prerouting comment="Mark all traffic by default to best effort" disabled=no new-dscp=0
add action=change-dscp chain=prerouting comment="" disabled=no new-dscp=6 protocol=icmp
add action=change-dscp chain=prerouting comment="" disabled=no new-dscp=6 protocol=ospf
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=21 new-dscp=0 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no new-dscp=0 p2p=all-p2p
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=22 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=23 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=53 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=80 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=123 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=161 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=411 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=513 new-dscp=6 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=2222 new-dscp=0 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=2222 new-dscp=0 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=3389-3390 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=4321 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=4569 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=4569 new-dscp=6 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=5060 new-dscp=6 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=6667 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=6697 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=8118 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=8291 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=8765 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=8766 new-dscp=6 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=9000-9004 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=27000-27065 new-dscp=6 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=27000-27065 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=28960 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=10000-10001 new-dscp=4 protocol=tcp
add action=mark-connection chain=postrouting comment="INTERACTIVE - Change DSCP 4 into connection mark Interactive-Conn" disabled=no dscp=4 \
   new-connection-mark=Interactive-Conn passthrough=yes
add action=mark-packet chain=postrouting comment="INTERACTIVE - Change connection mark Interactive-Conn into packet mark Interactive" connection-mark=\
   Interactive-Conn disabled=no new-packet-mark=Interactive passthrough=yes
add action=mark-connection chain=postrouting comment="VOIP - Change DSCP 6 into Connection mark Voice-Conn" disabled=no dscp=6 new-connection-mark=Voice-Conn \
   passthrough=yes
add action=mark-packet chain=postrouting comment="VOIP - Change connection mark Voice-Conn to packet mark Voice" connection-mark=Voice-Conn disabled=no \
   new-packet-mark=Voice passthrough=yes
add action=mark-connection chain=postrouting comment="BULK - Change DSCP 0 into connection mark Bulk-Conn" disabled=no dscp=0 new-connection-mark=Bulk-Conn \
   passthrough=yes
add action=mark-packet chain=postrouting comment="BULK - Change connection mark Bulk-Conn into packet mark Bulk" connection-mark=Bulk-Conn disabled=no \
   new-packet-mark=Bulk passthrough=yes
add action=passthrough chain=postrouting comment="" disabled=no dscp=4 ipv4-options=any
add action=set-priority chain=postrouting comment="" disabled=no new-priority=from-dscp passthrough=yes

Highsites

Queue Types

This specifies how packets gets handled by the queues.

 /queue type
 set default kind=pfifo name=default pfifo-limit=50
 set ethernet-default kind=pfifo name=ethernet-default pfifo-limit=50
 set wireless-default kind=pcq name=wireless-default pcq-classifier=src-address,dst-address pcq-limit=50 pcq-rate=0 pcq-total-limit=2000
 set synchronous-default kind=red name=synchronous-default red-avg-packet=1000 red-burst=20 red-limit=60 red-max-threshold=50 red-min-threshold=10
 set hotspot-default kind=sfq name=hotspot-default sfq-allot=1514 sfq-perturb=5
 add kind=pfifo name=Priorities pfifo-limit=10
 add kind=red name="Queue Testing" red-avg-packet=1000 red-burst=20 red-limit=60 red-max-threshold=50 red-min-threshold=10
 add kind=pcq name=pcq pcq-classifier="" pcq-limit=50 pcq-rate=0 pcq-total-limit=2000
 add kind=red name=Bulk red-avg-packet=1000 red-burst=20 red-limit=60 red-max-threshold=50 red-min-threshold=10
 set default-small kind=pfifo name=default-small pfifo-limit=10

Mangle Rules

/ip firewall mangle
add action=change-dscp chain=prerouting comment="Mark all traffic by default to best effort" disabled=no new-dscp=0
add action=change-dscp chain=prerouting comment="" disabled=no new-dscp=6 protocol=icmp
add action=change-dscp chain=prerouting comment="" disabled=no new-dscp=6 protocol=ospf
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=21 new-dscp=0 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no new-dscp=0 p2p=all-p2p
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=22 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=23 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=53 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=80 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=123 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=161 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=411 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=513 new-dscp=6 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=2222 new-dscp=0 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=2222 new-dscp=0 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=3389-3390 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=4321 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=4569 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=4569 new-dscp=6 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=5060 new-dscp=6 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=6667 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=6697 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=8118 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=8291 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=8765 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=8766 new-dscp=6 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=9000-9004 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=27000-27065 new-dscp=6 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=27000-27065 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=28960 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=10000-10001 new-dscp=4 protocol=tcp
add action=mark-connection chain=postrouting comment="INTERACTIVE - Change DSCP 4 into connection mark Interactive-Conn" disabled=no dscp=4 \
   new-connection-mark=Interactive-Conn passthrough=yes
add action=mark-packet chain=postrouting comment="INTERACTIVE - Change connection mark Interactive-Conn into packet mark Interactive" connection-mark=\
   Interactive-Conn disabled=no new-packet-mark=Interactive passthrough=yes
add action=mark-connection chain=postrouting comment="VOIP - Change DSCP 6 into Connection mark Voice-Conn" disabled=no dscp=6 new-connection-mark=Voice-Conn \
   passthrough=yes
add action=mark-packet chain=postrouting comment="VOIP - Change connection mark Voice-Conn to packet mark Voice" connection-mark=Voice-Conn disabled=no \
   new-packet-mark=Voice passthrough=yes
add action=mark-connection chain=postrouting comment="BULK - Change DSCP 0 into connection mark Bulk-Conn" disabled=no dscp=0 new-connection-mark=Bulk-Conn \
   passthrough=yes
add action=mark-packet chain=postrouting comment="BULK - Change connection mark Bulk-Conn into packet mark Bulk" connection-mark=Bulk-Conn disabled=no \
   new-packet-mark=Bulk passthrough=yes
add action=passthrough chain=postrouting comment="" disabled=no dscp=4 ipv4-options=any
add action=set-priority chain=postrouting comment="" disabled=no new-priority=from-dscp passthrough=yes

Queue Trees

These must be done for each Radio on Highsite changing RadioName to the specific radio and name1 to the unique queue name. Please note that the limits does not apply to backbone interfaces.

 /queue tree
 add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=0 name=name1 packet-mark=""\
 parent=RadioName priority=8 queue=default
 add burst-limit=0 burst-threshold=0 burst-time=0s disabled=yes limit-at=1000000 max-limit=2000000 name=Bulk-name1 packet-mark=Bulk\
 parent=name1 priority=8 queue=Bulk
 add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1000000 max-limit=2000000 name=Interactive-name1 packet-mark=Interactive\
 parent=name1 priority=2 queue=Priorities
 add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=512000 max-limit=1000000 name=Realtime-name1 packet-mark=Voice\
 parent=name1 priority=1 queue=Priorities