QoS
Contents
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.
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.
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