JAWUG:QOS Mikrotik

From WugWiki

Jump to: navigation, search

We've started using WMM to do traffic prioritisation on the Network. Initial testing showed that it worked quite well, so this is an attempt at documenting it for general deployment.


Contents


[edit] QoS for Gaming on Client Nodes

[edit] Wireless interface configuration

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


[edit] Mangle Rules for traffic matching

Mikrotik Firewall Mangle (ROS3.x) These rules will NOT work 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="" disabled=no new-dscp=0 
 add action=change-dscp chain=prerouting comment="ssh" disabled=no dst-port=22 new-dscp=4 protocol=tcp 
 add action=change-dscp chain=prerouting comment="telnet" disabled=no dst-port=23 new-dscp=4 protocol=tcp 
 add action=change-dscp chain=prerouting comment="bgp" disabled=no dst-port=179 new-dscp=4 protocol=tcp
 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=4569 new-dscp=6 protocol=udp 
 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=4569 new-dscp=6 protocol=tcp 
 add action=change-dscp chain=prerouting comment="ospf" disabled=no new-dscp=4 protocol=ospf 
 add action=change-dscp chain=prerouting comment="icmp" disabled=no new-dscp=4 protocol=icmp 
 add action=change-dscp chain=prerouting comment="irc" disabled=no dst-port=6667 new-dscp=4 protocol=tcp 
 add action=change-dscp chain=prerouting comment="" disabled=no dst-port=6668 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=7324 new-dscp=4 protocol=tcp 
 add action=change-dscp chain=prerouting comment="" disabled=no dst-port=7325 new-dscp=4 protocol=tcp 
 add action=change-dscp chain=prerouting comment="" disabled=no dst-port=64738 new-dscp=6 protocol=tcp  
 add action=change-dscp chain=prerouting comment="" disabled=no dst-address=172.16.1.1 dst-port=80 new-dscp=4 protocol=tcp 
 add action=change-dscp chain=prerouting comment="WINBOX - Mark DSCP as 4" disabled=no dst-port=8291 new-dscp=4 protocol=tcp 
 add action=change-dscp chain=prerouting comment="WINBOX - Mark DSCP as 4" disabled=no src-port=8291 new-dscp=4 protocol=tcp 
 add action=change-dscp chain=prerouting comment="SNMP - Mark DSCP as 4" disabled=no dst-port=161 new-dscp=4 protocol=udp 
 add action=change-dscp chain=prerouting comment="SNMP - Mark DSCP as 4" disabled=no src-port=161 new-dscp=4 protocol=udp 
 add action=change-dscp chain=prerouting comment="COH - Mark DSCP as 4" disabled=no dst-port=30260 new-dscp=4 protocol=udp 
 add action=change-dscp chain=prerouting comment="COH - Mark DSCP as 4" disabled=no dst-port=9100 new-dscp=4 protocol=udp 
 add action=change-dscp chain=prerouting comment="HL2 - Mark DSCP as 4" disabled=no dst-port=27000-27065 new-dscp=4 protocol=udp 
 add action=change-dscp chain=prerouting comment="COD4 - Mark DSCP as 4" disabled=no dst-port=28960 new-dscp=4 protocol=udp 
 add action=change-dscp chain=prerouting comment="WAR3 - Mark DSCP as 4" disabled=no dst-port=6112 new-dscp=4 protocol=tcp 
 add action=change-dscp chain=prerouting comment=UT2004 disabled=no dst-port=7777-7778 new-dscp=4 protocol=udp 
 add action=change-dscp chain=prerouting comment=Diablo2 disabled=no dst-port=4000 new-dscp=4 protocol=tcp
 add action=change-dscp chain=prerouting comment=Quake3 disabled=no dst-port=27960-27965 new-dscp=4 protocol=udp  
 add action=change-dscp chain=prerouting comment=Time disabled=no dst-port=123 new-dscp=4 protocol=udp 
 add action=change-dscp chain=prerouting comment="Icecast / Shoutcast" disabled=no dst-port=8000 new-dscp=4 protocol=tcp 
 add action=change-dscp chain=prerouting comment=ShoutCaster disabled=no dst-port=8001 new-dscp=4 protocol=tcp 
 add action=change-dscp chain=prerouting comment=Teamspeak disabled=no dst-port=8767 new-dscp=6 protocol=udp
 add action=change-dscp chain=prerouting comment=SpaceSiege disabled=no dst-port=4 new-dscp=4 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="Translate DSCP Values into WMM priorities" disabled=no new-priority=from-dscp passthrough=yes

[edit] QoS Queues for Highsites Only

Above Firewall Mangle rules also need to be applied, along with the below Queue configs.

[edit] Queue Types

 /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

[edit] Queue trees

These must be done for each Radio on Highsite changing RadioName to the specific radio and name1 to the unique queue name{ROS v3.10)

 /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=1000000 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=512000 max-limit=1000000 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=256000 max-limit=512000 name=Voice-name1 packet-mark=Voice\
 parent=name1 priority=1 queue=Priorities

--Daffy 16:51, 4 November 2008 (SAST) --Atti2de 21:36, 26 May 2009 (SAST)

Personal tools