QoS

From CTWUG Wiki
Revision as of 14:02, 23 April 2012 by Pilgrim (talk | contribs)

Jump to: navigation, search

Warning48.png ATTENTION!

This page is currently under review.

Please check it for accuracy remove the ReviewNeeded tag after it has been updated.

If the page is obsolete, please replace this tag with the Obsolete tag.


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.

Please note: Any ports found on any highsite, not identified here, will be removed. TheFox 18:03, 16 November 2008 (UTC)

Last Update By --Rellik 13:21, 18 January 2009 (UTC)

Identified Ports
Description Port Protocol Priority On Latest Script? On All highsites?
Network Tools
Pings icmp Interactive Yes Yes
OSPF ospf Interactive Yes Yes
SSH 22 tcp Realtime Yes Yes
Telnet 23 tcp Interactive Yes Yes
DNS 53 udp Realtime Yes Yes
NTP 110 udp Realtime Yes Yes
SNMP 161 tcp Realtime Yes Yes
SysLog 513 udp Realtime Yes Yes
IRC 6667-6669 tcp Interactive Yes Yes
IRC(SSL) 6697 tcp Interactive Yes Yes
Webmin 10000-10001 tcp Interactive Yes Yes
HTTP 80 tcp Interactive Yes Yes
Remote Desktop 3389-3390 tcp Interactive Yes Yes
PPTP 1723 tcp Interactive Yes No
Winbox 8291 tcp Realtime Yes Yes
Web Proxy 8118 tcp Interactive Yes Yes
VOIP
Teamspeak 8765 tcp Realtime Yes Yes
Teamspeak 8766 udp Realtime Yes Yes
VOIP IAX 4569 tcp/udp Realtime Yes Yes
VOIP SIP 5060 udp Realtime Yes Yes
Windows File Sharing 137 udp Realtime Yes Yes
Windows File Sharing 138 udp Realtime Yes Yes
Windows File Sharing 445 udp Realtime Yes Yes
Windows File Sharing 139 tcp Realtime Yes Yes
Bulk
FTP 21 tcp Bulk Yes Yes
DC++ 411 tcp Bulk Yes Yes
DC++ 2222 tcp/udp Bulk Yes Yes
Torrents 7000 tcp Bulk Yes Yes
Games
BF2 16567 udp Interactive Yes No
BF2142 17567 udp Interactive Yes No
BNET/war3 6112-6119 udp/tcp Interactive Yes Yes
Far Cry 9000-9004 tcp Interactive Yes Yes
COD4 28960 udp Interactive Yes Yes
WoW 3724,6112,6881-6999 TCP Interactive Yes Yes
CSS 27000-27065 udp Interactive Yes Yes
CSS 27000-27065 tcp Interactive Yes Yes
Flatout2 23756 udp Interactive Yes Yes
Grid 3074 tcp & udp Interactive Yes Yes
RFactor 34297,34447 tcp Interactive Yes Yes
RFactor 34397 udp Interactive Yes Yes
Graw 15250 udp Interactive Yes Yes
TMF 2350 udp Interactive Yes Yes
TMF 2350 udp Interactive Yes Yes

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="Winbox" 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=161 new-dscp=6 protocol=tcp
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 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=513 new-dscp=6 protocol=udp
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="SSH" disabled=no dst-port=22 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="Telnet" disabled=no dst-port=23 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=27000-27065 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="BF2" disabled=no dst-port=16567 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="BF2142" disabled=no dst-port=17567 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=27000-27065 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="PPTP" disabled=no dst-port=1723 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="DNS" disabled=no dst-port=53 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="HTTP" 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="DC" disabled=no dst-port=411 new-dscp=4 protocol=tcp
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="DC" disabled=no dst-port=4321 new-dscp=4 protocol=tcp
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="COD" disabled=no dst-port=28960 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment=BNET disabled=no dst-port=6112-6119 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment=BNET disabled=no dst-port=6112-6119 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment=WoW disabled=no dst-port=3724 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment=WoW disabled=no dst-port=6112 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment=WoW disabled=no dst-port=6881-6999 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=10000-10001 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="FTP" disabled=no dst-port=21 new-dscp=0 protocol=tcp
add action=change-dscp chain=prerouting comment="Peer-to-peer" disabled=no new-dscp=0 p2p=all-p2p
add action=change-dscp chain=prerouting comment="DC" disabled=no dst-port=2222 new-dscp=0 protocol=tcp
add action=change-dscp chain=prerouting comment="DC" disabled=no dst-port=2222 new-dscp=0 protocol=udp
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="Winbox" 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=161 new-dscp=6 protocol=tcp
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 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=513 new-dscp=6 protocol=udp
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="SSH" disabled=no dst-port=22 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="Telnet" disabled=no dst-port=23 new-dscp=6 protocol=tcp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=27000-27065 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="BF2" disabled=no dst-port=16567 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="BF2142" disabled=no dst-port=17567 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="" disabled=no dst-port=27000-27065 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="PPTP" disabled=no dst-port=1723 new-dscp=4 protocol=tcp
add action=change-dscp chain=prerouting comment="DNS" disabled=no dst-port=53 new-dscp=4 protocol=udp
add action=change-dscp chain=prerouting comment="HTTP" 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="DC" disabled=no dst-port=411 new-dscp=4 protocol=tcp
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="DC" disabled=no dst-port=4321 new-dscp=4 protocol=tcp
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="COD" 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=change-dscp chain=prerouting comment="FTP" disabled=no dst-port=21 new-dscp=0 protocol=tcp
add action=change-dscp chain=prerouting comment="Peer-to-peer" disabled=no new-dscp=0 p2p=all-p2p
add action=change-dscp chain=prerouting comment="DC" disabled=no dst-port=2222 new-dscp=0 protocol=tcp
add action=change-dscp chain=prerouting comment="DC" disabled=no dst-port=2222 new-dscp=0 protocol=udp
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