# Qos Script Lite v1.0
# September 7, 2013
# Compatible with RouterOS 6.3
# Rename ether-WAN and ether-LAN to match your environment
# Mark all UDP traffic for an IP-PBX.
/ip firewall mangle
add chain=forward action=mark-connection protocol=udp src-address=192.168.100.5 connection-state=new new-connection-mark="VOIP" comment="IP-PBX"
add chain=forward action=mark-packet passthrough=no connection-mark="VOIP" new-packet-mark="VOIP"
add chain=forward action=mark-connection protocol=udp dst-address=192.168.100.5 connection-state=new new-connection-mark="VOIP"
add chain=forward action=mark-packet passthrough=no connection-mark="VOIP" new-packet-mark="VOIP"
# Mark everything else.
add chain=forward action=mark-connection connection-mark=no-mark new-connection-mark="OTHER" comment="OTHER"
add chain=forward action=mark-packet passthrough=no connection-mark="OTHER" new-packet-mark="OTHER"
# Create two queue trees set to 90% of ISP Internet service.
/queue tree
add name="LEVEL_A_UP" parent=ether-WAN queue=default max-limit=900k
add name="LEVEL_A_DOWN" parent=ether-LAN queue=default max-limit=4M
add name="LEVEL_B_UP" parent=ether-WAN queue=default max-limit=900k
add name="LEVEL_B_DOWN" parent=ether-LAN queue=default max-limit=4M
# Add our marked connections as children of queue so priority works.
add name="VOIP_U" parent="LEVEL_A_UP" packet-mark="VOIP" queue=default priority=1
add name="VOIP_D" parent="LEVEL_A_DOWN" packet-mark="VOIP" queue=default priority=1
add name="OTHER_U" parent="LEVEL_B_UP" packet-mark="OTHER" queue=default priority=2
add name="OTHER_D" parent="LEVEL_B_DOWN" packet-mark="OTHER" queue=default priority=2
# Date: September 28, 2017
# Version: 1.3
# Tested with RouterOS 6.38.7
# Rename ether-WAN and bridge-LAN to match your environment
###############################################################################
# Mangle
#
# Using prerouting/postrouting since we don't have dst or src checks.
#
/ip firewall mangle
###############################################################################
# DNS requests. Mark in two places because DNS is sent out by the router (itself) too.
add chain=prerouting action=mark-connection protocol=udp port=53 connection-state=new new-connection-mark="DNS" comment="DNS"
add chain=prerouting action=mark-packet passthrough=no connection-mark="DNS" new-packet-mark="DNS"
add chain=postrouting action=mark-connection protocol=udp port=53 connection-state=new new-connection-mark="DNS"
add chain=postrouting action=mark-packet passthrough=no connection-mark="DNS" new-packet-mark="DNS"
# Mark all VoIP traffic. We've set all our equiptment to use SIP 5060,5061 and RTP 10000-20000.
add chain=prerouting action=mark-connection protocol=udp port=5060,5061,10000-20000 new-connection-mark="VOIP" comment="VOIP"
add chain=prerouting action=mark-packet passthrough=no connection-mark="VOIP" new-packet-mark="VOIP"
# Mark all UDP traffic. Mark different UDP streams if you want more granularity.
add chain=prerouting action=mark-connection protocol=udp connection-state=new new-connection-mark="UDP" comment="UDP"
add chain=prerouting action=mark-packet passthrough=no connection-mark="UDP" new-packet-mark="UDP"
# Ping replies. Mark in two places because ICMP is sent out by the router (itself) too.
add chain=prerouting action=mark-connection protocol=icmp connection-state=new new-connection-mark="ICMP" comment="ICMP"
add chain=prerouting action=mark-packet passthrough=no connection-mark="ICMP" new-packet-mark="ICMP"
add chain=postrouting action=mark-connection protocol=icmp connection-state=new new-connection-mark="ICMP"
add chain=postrouting action=mark-packet passthrough=no connection-mark="ICMP" new-packet-mark="ICMP"
# ACK traffic. Based on viewtopic.php?f=2&t=67965
add chain=postrouting action=mark-packet passthrough=no protocol=tcp tcp-flags=ack packet-size=0-123 new-packet-mark="ACK" comment="ACK"
add chain=prerouting action=mark-packet passthrough=no protocol=tcp tcp-flags=ack packet-size=0-123 new-packet-mark="ACK"
# Mark all new HTTP(s) connections with "HTTP" if they have not previously been marked as "HTTP_BIG".
# If the current mark of "HTTP" tranfers more than 5MB and at a rate of 200k+ then mark it as "HTTP_BIG" for the duration of the TCP session.
add chain=prerouting action=mark-connection protocol=tcp connection-mark=!"HTTP_BIG" new-connection-mark="HTTP" connection-state=new port=80,443 comment="HTTP"
add chain=prerouting action=mark-connection protocol=tcp connection-mark="HTTP" new-connection-mark="HTTP_BIG" connection-bytes=500000-0 connection-rate=200k-100M
add chain=prerouting action=mark-packet passthrough=no connection-mark="HTTP_BIG" new-packet-mark="HTTP_BIG"
add chain=prerouting action=mark-packet passthrough=no connection-mark="HTTP" new-packet-mark="HTTP"
# Mark everything else that has no mark applied.
add chain=prerouting action=mark-connection connection-mark=no-mark new-connection-mark="OTHER" comment="OTHER"
add chain=prerouting action=mark-packet passthrough=no connection-mark="OTHER" new-packet-mark="OTHER"
###############################################################################
# HTB Queue Tree a unidirectional queue
#
# Based on 90% of 1Mup/5Mdown Internet service.
#
# Notes:
# priority means 'drop packets' WHEN needed.
# When limit-at=0 priority starts when max-limit is reached.
# When limit-at=123 priority starts when limit-at is reached.
#
# The priority option applies to children not parents. Parent is for setting
# overall limits. Therefore use limit-at and max-limit on the children if
# you want more granularity.
#
# max-limit must always be set or priority will not happen.
#
# Tips for TCP (not VoIP) SOHO network:
# limit-at = Total bandwidth / max hosts
# max-limit = Total bandwidth / min hosts
#
/queue tree
###############################################################################
# The secret to ensuring VoIP quality (or any UDP traffic) is to put it into
# a queue that will never be full and thus never prioritize (drop) packets.
add name="LEVEL_A_UP" parent=ether-WAN queue=default max-limit=900k
add name="LEVEL_A_DOWN" parent=bridge-LAN queue=default max-limit=4M
# Next, create a queue for high priority traffic.
add name="LEVEL_B_UP" parent=ether-WAN queue=default max-limit=900k
add name="LEVEL_B_DOWN" parent=bridge-LAN queue=default max-limit=4M
# Finally, create a queue for traffic that normally exceeds levels.
add name="LEVEL_C_UP" parent=ether-WAN queue=default max-limit=900k
add name="LEVEL_C_DOWN" parent=bridge-LAN queue=default max-limit=4M
# A
add name="VOIP_U" parent="LEVEL_A_UP" packet-mark="VOIP" queue=default priority=1
add name="VOIP_D" parent="LEVEL_A_DOWN" packet-mark="VOIP" queue=default priority=1
# B
add name="ACK_U" parent="LEVEL_B_UP" packet-mark="ACK" queue=default priority=1
add name="ACK_D" parent="LEVEL_B_DOWN" packet-mark="ACK" queue=default priority=1
add name="DNS_U" parent="LEVEL_B_UP" packet-mark="DNS" queue=default priority=2
add name="DNS_D" parent="LEVEL_B_DOWN" packet-mark="DNS" queue=default priority=2
add name="UDP_U" parent="LEVEL_B_UP" packet-mark="UDP" queue=default priority=3
add name="UDP_D" parent="LEVEL_B_DOWN" packet-mark="UDP" queue=default priority=3
add name="ICMP_U" parent="LEVEL_B_UP" packet-mark="ICMP" queue=default priority=4
add name="ICMP_D" parent="LEVEL_B_DOWN" packet-mark="ICMP" queue=default priority=4
# C
add name="HTTP_U" parent="LEVEL_C_UP" packet-mark="HTTP" queue=default priority=1
add name="HTTP_D" parent="LEVEL_C_DOWN" packet-mark="HTTP" queue=default priority=1
add name="HTTP_BIG_U" parent="LEVEL_C_UP" packet-mark="HTTP_BIG" queue=default priority=2
add name="HTTP_BIG_D" parent="LEVEL_C_DOWN" packet-mark="HTTP_BIG" queue=default priority=2
add name="OTHER_U" parent="LEVEL_C_UP" packet-mark="OTHER" queue=default priority=3
add name="OTHER_D" parent="LEVEL_C_DOWN" packet-mark="OTHER" queue=default priority=3
Thank you. My intention was to perfect this post and then have it accepted by MikroTik after all the experts had confirmed it. Then, as you say, have it posted in the Wiki.great info, but it's better to use http://wiki.mikrotik.com for such articles - forum is more for questions, not for tutorials![]()
Good idea. Waiting for next parts.Thank you. My intension was to perfect this post and then have it accepted by MikroTik after all the experts had confirmed it. Then, as you say, have it posted in the Wiki.great info, but it's better to use http://wiki.mikrotik.com for such articles - forum is more for questions, not for tutorials![]()
just add two rules at the bottom of the script# HELP! I don't know how to mark what is left?
with connection byte ?Hello everyone. I've tested and updated the script. It now works correctly on RouterOS 6.1. Note that ether1 is WAN and ether2 is LAN. Adjust those as necessary for your environment.
I would appreciate if someone could tell me how to mark big downloads over HTTP traffic. Currently, the script marks port 80 so everything HTTP gets too much priority. The idea situation would be to let short bursts of HTTP traffic get high priority and the big long downloads get less.
Thank you, the answer is to use connection-bytes and connection-rate.>> how to mark big downloads over HTTP traffic?
With connection byte?
I don't think the 2011 talk was referring to v6, maybe it was. But Prerouting not = input + forward. Look at the 3rd image here. The reason I use pre and post on DNS traffic is because the forward chain is not able to mark traffic sourced from the router itself and also traffic coming into the router from LAN.Prerouting = input + forward
Postrouting = output + forward
In your Option 2 configuration You used prerouting and postrouting together. Will these two mangles come into conflict (because of 2 forwards)? If I’ve understood it correctly, in mangle postrouting we mark traffic that goes from the router (output) and through the router (forward). How will this affect the marked traffic from the prerouting and meant for forward? Will it be remarked?
You are correct to wonder, and indeed there is something at issue here. I'm still perfecting this script. Basically what is happening currently, and why this script works for small networks is that: since Queue A is never full (never exceeds capacity) nothing is ever prioritized (dropped) within it. Queue C will always be exceeding capacity and thus traffic marked to go there will indeed be dropped (prioritized) at times. But as you've correctly noticed only at 900k/4M. This means that Queue A gets a 10% window of head room before ISP equipment starts to buffer.Looking at OPTION 2 above....
In Queue A, you have voip = priority 1
In Queue B, you have ack = priority 1
In Queue C, you have http = priority 1
...
Or, if priority is the wrong term, the real question is: What keeps queue C from using up all the bandwidth and not leaving any for queue A, since they are both maxed at 900k/4M?
/ip firewall connection print count-only where protocol="udp" and dst-address~":50.."
Great question. You must understand that the best way to Qos a network is to have enough bandwidth to work with. People want everything ... but that is a tall order.Might there be a way to add anything to this configuration that would help prioritize streaming video for a home network? Looks as though some of the Netflix traffic for example gets lost in the fray when there is heavy traffic marked as HTTP and the quality tends to suffer. I have seen some stuff pointing to L7 pattern matching, but I can honestly say that I do not know how to implement.
There are a couple of people on the board here who you could pay: efaden, sdischer, or IPANetEngineer. They know what they're doing. I was hoping this post would bring out the VoIP experts but sadly they've not seen it yet. This is something we've all got to get nailed down.Great post and pretty much the only thing out there on VoIP QoS at this level that I can find for Router OS.
Have you progressed any yet? There seem to be some key issues still outstanding.
Any further reading recommendations ... other than who the best support person is to pay to do it at Mikrotik?
Make sure you understand how buffering works. Next, it all depends on how many active phone calls you want to support. A single VoIP call is 90kb both directions ... up and down.
Hi pcunite. I'm have 12M/12M. How to set the upload rates and download rates for Voip? Thanks.
add name="LEVEL_A_UP" parent=ether-WAN queue=default max-limit=10M add name="LEVEL_A_DOWN" parent=ether-LAN queue=default max-limit=10M add name="LEVEL_B_UP" parent=ether-WAN queue=default max-limit=10M add name="LEVEL_B_DOWN" parent=ether-LAN queue=default max-limit=10M add name="LEVEL_C_UP" parent=ether-WAN queue=default max-limit=10M add name="LEVEL_C_DOWN" parent=ether-LAN queue=default max-limit=10MJust so you know, my VoIP script is not perfect. It works, however. Until you really know how to master segmenting traffic you'll at least have VoIP calls working correctly.
The order of the rules is important somewhat ... but let me see what you have and I can hopefully spot the error.In testing your script using YouTube media, I am finding that instead of port 80 traffic getting marked with HTTP or HTTP_BIG mark it is ending up getting marked by the UDP rule in mangle. If I disable UDP in mangle then it correctly marks the traffic with HTTP or HTTP_BIG.
Nice find! Like you've said it's only in the comments.Hello! I've noticed something interesting in your rules. [...]
I. Reduce the number of Queue Trees to 2. One for download & one upload. Your goal is to create a unified hierarchy.another router setup using the same script and I am seeing HTTP_D traffic which is supposed to be priority 1 being dropped before the other traffic in Level C which is lower priority.
any thoughts? piccy attached.
The pcunite examples won't work well in Your case. You need to create another set of mangle and Queue Tree rules.another problem I can't work out yet is how to associate multiple interfaces to a queue, which I will need in this example since I have seperate LANs on seperate interfaces, but they need to use the same queue. I can't bridge the interfaces and apply it there, because two of the subnets have DHCP services and that all stops working when you add bridges in.
Notes:I am seeing HTTP_D traffic (which is priority 1) being dropped before other traffic in Level C, which has a lower priority.
add action=mark-connection chain=postrouting comment="P2P UP" new-connection-mark=p2pupconn out-interface=ether1 p2p=all-p2p add action=mark-packet chain=postrouting connection-mark=p2pupconn new-packet-mark=p2pup passthrough=no add action=mark-connection chain=prerouting comment="P2P DOWN" in-interface=ether1 new-connection-mark=p2pdownconn p2p=all-p2p add action=mark-packet chain=prerouting connection-mark=p2pdownconn new-packet-mark=p2pdown passthrough=no
/queue tree add max-limit=2800k name=LEVEL_A_UP parent=ether1 priority=7 queue=default add max-limit=2800k name=LEVEL_A_DOWN parent=ether2 priority=7 queue=default add max-limit=2800k name=LEVEL_B_UP parent=ether1 priority=7 queue=default add max-limit=2800k name=LEVEL_B_DOWN parent=ether2 priority=7 queue=default add max-limit=2800k name=LEVEL_C_UP parent=ether1 queue=default add max-limit=2800k name=LEVEL_C_DOWN parent=ether2 queue=default add name=ACK_U packet-mark=ACK parent=LEVEL_A_UP priority=1 queue=default add name=ACK_D packet-mark=ACK parent=LEVEL_A_DOWN priority=1 queue=default add name=DNS_U packet-mark=DNS parent=LEVEL_A_UP priority=2 queue=default add name=DNS_D packet-mark=DNS parent=LEVEL_A_DOWN priority=2 queue=default add name=ICMP_U packet-mark=ICMP parent=LEVEL_A_UP priority=3 queue=default add name=ICMP_D packet-mark=ICMP parent=LEVEL_A_DOWN priority=3 queue=default add name=UDP_U packet-mark=UDP parent=LEVEL_B_UP priority=1 queue=default add name=UDP_D packet-mark=UDP parent=LEVEL_B_DOWN priority=1 queue=default add name=OTHER_U packet-mark=OTHER parent=LEVEL_C_UP priority=1 queue=default add name=OTHER_D packet-mark=OTHER parent=LEVEL_C_DOWN priority=1 queue=default add name=HTTP_U packet-mark=HTTP parent=LEVEL_B_UP priority=3 queue=default add name=HTTP_D packet-mark=HTTP parent=LEVEL_B_DOWN priority=3 queue=default add name=HTTP_BIG_U packet-mark=HTTP_BIG parent=LEVEL_B_UP priority=3 queue=default add name=HTTP_BIG_D packet-mark=HTTP_BIG parent=LEVEL_B_DOWN priority=3 queue=default add name=E-MAIL_U packet-mark=E-MAIL parent=LEVEL_B_UP priority=2 queue=default add name=E-MAIL_D packet-mark=E-MAIL parent=LEVEL_B_DOWN priority=2 queue=default add name=TCP_TORRENT_U packet-mark=TCP_TORRENT parent=LEVEL_C_UP priority=2 queue=default add name=TCP_TORRENT_D packet-mark=TCP_TORRENT parent=LEVEL_C_DOWN priority=2 queue=default add name=UDP_TORRENT_U packet-mark=UDP_TORRENT parent=LEVEL_C_UP priority=2 queue=default add name=UDP_TORRENT_D packet-mark=UDP_TORRENT parent=LEVEL_C_DOWN priority=2 queue=default /ip firewall mangle add action=mark-connection chain=prerouting comment=DNS connection-state=new new-connection-mark=DNS port=53 protocol=udp add action=mark-packet chain=prerouting connection-mark=DNS new-packet-mark=DNS passthrough=no add action=mark-connection chain=postrouting connection-state=new new-connection-mark=DNS port=53 protocol=udp add action=mark-packet chain=postrouting connection-mark=DNS new-packet-mark=DNS passthrough=no add action=mark-connection chain=prerouting comment=ICMP connection-state=new new-connection-mark=ICMP protocol=icmp add action=mark-packet chain=prerouting connection-mark=ICMP new-packet-mark=ICMP passthrough=no add action=mark-connection chain=postrouting connection-state=new new-connection-mark=ICMP protocol=icmp add action=mark-packet chain=postrouting connection-mark=ICMP new-packet-mark=ICMP passthrough=no add action=mark-packet chain=postrouting comment=ACK new-packet-mark=ACK packet-size=0-123 passthrough=no protocol=tcp tcp-flags=ack add action=mark-packet chain=prerouting new-packet-mark=ACK packet-size=0-123 passthrough=no protocol=tcp tcp-flags=ack add action=mark-connection chain=prerouting comment=UDP_TORRENT connection-state=new new-connection-mark=UDP_TORRENT port=6881-6891 protocol=udp add action=mark-packet chain=prerouting connection-mark=UDP_TORRENT new-packet-mark=UDP_TORRENT passthrough=no add action=mark-connection chain=prerouting comment=UDP connection-state=new new-connection-mark=UDP protocol=udp add action=mark-packet chain=prerouting connection-mark=UDP new-packet-mark=UDP passthrough=no add action=mark-connection chain=prerouting comment=E-MAIL connection-state=new new-connection-mark=E-MAIL port=110,995,143,993,25,465,587,2525 protocol=tcp add action=mark-packet chain=prerouting connection-mark=E-MAIL new-packet-mark=E-MAIL passthrough=no add action=mark-connection chain=prerouting comment=HTTP connection-mark=!HTTP_BIG connection-state=new new-connection-mark=HTTP port=80,443 protocol=tcp add action=mark-connection chain=prerouting connection-bytes=500000-0 connection-mark=HTTP connection-rate=200k-100M new-connection-mark=HTTP_BIG protocol=tcp add action=mark-packet chain=prerouting connection-mark=HTTP_BIG new-packet-mark=HTTP_BIG passthrough=no add action=mark-packet chain=prerouting connection-mark=HTTP new-packet-mark=HTTP passthrough=no add action=mark-connection chain=prerouting comment=TCP_TORRENT connection-state=new new-connection-mark=TCP_TORRENT port=6881-6891 protocol=tcp add action=mark-packet chain=prerouting connection-mark=TCP_TORRENT new-packet-mark=TCP_TORRENT passthrough=no add action=mark-connection chain=prerouting comment=OTHER connection-mark=no-mark new-connection-mark=OTHER add action=mark-packet chain=prerouting connection-mark=OTHER new-packet-mark=OTHER passthrough=no
/ip firewall mangle add chain=forward action=mark-connection protocol=udp src-address=192.168.100.5 connection-state=new new-connection-mark="VOIP" comment="IP-PBX" add chain=forward action=mark-packet passthrough=no connection-mark="VOIP" new-packet-mark="VOIP" add chain=forward action=mark-connection protocol=udp dst-address=192.168.100.5 connection-state=new new-connection-mark="VOIP" add chain=forward action=mark-packet passthrough=no connection-mark="VOIP" new-packet-mark="VOIP"You are marking packets twice based on the same options. In my opinion rule 2 can be removed.
0 ;;; VOIP - Voip traffic FROM PBX (5060-5061, 10000-20000 udp)
chain=forward action=mark-connection new-connection-mark=VOIP passthrough=yes connection-state=new protocol=udp
src-address=10.10.20.5 port=5060-5061,10000-20000
1 chain=forward action=mark-packet new-packet-mark=VOIP passthrough=no connection-mark=VOIP
2 ;;; VOIP - Voip traffic TO PBX (5060-5061, 10000-20000 udp)
chain=output action=mark-connection new-connection-mark=VOIP passthrough=yes connection-state=new protocol=udp
dst-address=10.10.20.5 port=5060-5061,10000-20000
3 chain=output action=mark-packet new-packet-mark=VOIP passthrough=no connection-mark=VOIP
4 ;;; V_GENERAL - other traffic FROM voice network
chain=forward action=mark-connection new-connection-mark=V_GENERAL passthrough=yes src-address-list=VoIP_Network
connection-mark=no-mark
5 chain=forward action=mark-packet new-packet-mark=V_GENERAL passthrough=no connection-mark=V_GENERAL
6 ;;; V_GENERAL - other traffic TO voice network
chain=output action=mark-connection new-connection-mark=V_GENERAL passthrough=yes dst-address-list=VoIP_Network
connection-mark=no-mark
7 chain=output action=mark-packet new-packet-mark=V_GENERAL passthrough=no connection-mark=V_GENERAL
8 ;;; DNS
chain=forward action=mark-connection new-connection-mark=DNS passthrough=yes connection-state=new protocol=udp port=53
9 chain=forward action=mark-packet new-packet-mark=DNS passthrough=no connection-mark=DNS
10 chain=output action=mark-connection new-connection-mark=DNS passthrough=yes connection-state=new protocol=udp port=53
11 chain=output action=mark-packet new-packet-mark=DNS passthrough=no connection-mark=DNS
12 ;;; UDP
chain=forward action=mark-connection new-connection-mark=UDP passthrough=yes connection-state=new protocol=udp
13 chain=forward action=mark-packet new-packet-mark=UDP passthrough=no connection-mark=UDP
14 ;;; ICMP
chain=forward action=mark-connection new-connection-mark=ICMP passthrough=yes connection-state=new protocol=icmp
15 chain=forward action=mark-packet new-packet-mark=ICMP passthrough=no connection-mark=ICMP
16 chain=output action=mark-connection new-connection-mark=ICMP passthrough=yes connection-state=new protocol=icmp
17 chain=output action=mark-packet new-packet-mark=ICMP passthrough=no connection-mark=ICMP
18 ;;; ACK
chain=output action=mark-packet new-packet-mark=ACK passthrough=no tcp-flags=ack protocol=tcp packet-size=0-123
19 chain=forward action=mark-packet new-packet-mark=ACK passthrough=no tcp-flags=ack protocol=tcp packet-size=0-123
20 X ;;; HTTP
chain=forward action=mark-connection new-connection-mark=HTTP passthrough=yes connection-state=new protocol=tcp
port=80,443 connection-mark=!HTTP_BIG
21 X chain=forward action=mark-connection new-connection-mark=HTTP_BIG passthrough=yes protocol=tcp connection-mark=HTTP
connection-bytes=500000-0 connection-rate=200k-100M
22 X chain=forward action=mark-packet new-packet-mark=HTTP_BIG passthrough=no connection-mark=HTTP_BIG
23 X chain=forward action=mark-packet new-packet-mark=HTTP passthrough=no connection-mark=HTTP
24 X ;;; THE_REST
chain=forward action=mark-connection new-connection-mark=THE_REST passthrough=yes connection-mark=no-mark
25 X chain=forward action=mark-packet new-packet-mark=THE_REST passthrough=no connection-mark=THE_REST
This section is from Option 1. It is marking "src" and then "dst" to the same ip address. Also, unless MikroTik documentation has changed, one must mark the connection and then the packet for performance.I'm a little curious why you have some rules twice.ros code
/ip firewall mangle add chain=forward action=mark-connection protocol=udp src-address=192.168.100.5 connection-state=new new-connection-mark="VOIP" comment="IP-PBX" add chain=forward action=mark-packet passthrough=no connection-mark="VOIP" new-packet-mark="VOIP" add chain=forward action=mark-connection protocol=udp dst-address=192.168.100.5 connection-state=new new-connection-mark="VOIP" add chain=forward action=mark-packet passthrough=no connection-mark="VOIP" new-packet-mark="VOIP"You are marking packets twice based on the same options. In my opinion rule 2 can be removed.
Then first there are two rules marking the connection and setting connection-marks. Then use the connection-mark to mark the packets in one single rule.
add action=mark-connection chain=forward connection-state=new new-connection-mark=UDP protocol=udp
add action=mark-connection chain=forward connection-state=new new-connection-mark=UDP out-interface=ether1 protocol=udp
add action=mark-packet chain=forward connection-mark=UDP new-packet-mark=UDP passthrough=no
add action=mark-connection chain=forward connection-state=new new-connection-mark=VOIP out-interface=ether1 port=5060-5061,10000-20000 protocol=udp src-address=10.10.20.5
add action=mark-connection chain=forward connection-state=new dst-address=10.10.20.5 in-interface=ether1 new-connection-mark=VOIP port=5060-5061,10000-20000 protocol=udp
add action=mark-packet chain=forward connection-mark=HTTP_BIG new-packet-mark=ACK-HTTP-BIG packet-size=0-123 passthrough=no protocol=tcp tcp-flags=ack
add action=mark-packet chain=forward connection-mark=HTTP new-packet-mark=ACK-HTTP packet-size=0-123 passthrough=no protocol=tcp tcp-flags=ack
Thank you for this great explanation!How Buffering and bufferbloat in ISP supplied equipment affects Qos and latency sensitive protocols ...
That is quite a variance! Yes, you are correct ... you can not use "static Qos" techniques to maintain your traffic integrity. There are "dynamic Qos" ways of doing things but that is beyond the scope of this thread and my expertise.Am I correct in my conclusion that without a reasonable estimate of my wan bandwidth, it's impossible to implement qos? Specifically - I have Comcast (cable) and the download speed varies between 60Mbps and 5Mbps
# jun/29/2014 21:38:22 by RouterOS 6.12
# software id = AF8C-ZI5T
#
/ip firewall mangle
#Skype Layer7 Marking
add action=mark-packet chain=prerouting comment=Skype in-interface=PPPoE-UniFi layer7-protocol=skypetoskype new-packet-mark=QoS_1_In passthrough=no
add action=mark-packet chain=postrouting layer7-protocol=skypetoskype new-packet-mark=QoS_1_Out out-interface=PPPoE-UniFi passthrough=no
#VPN Layer 7 Marking
add action=mark-packet chain=prerouting comment=VPN in-interface=PPPoE-UniFi new-packet-mark=QoS_2_In passthrough=no protocol=gre
add action=mark-packet chain=postrouting new-packet-mark=QoS_2_Out out-interface=PPPoE-UniFi passthrough=no protocol=gre
#QoS_4 Steaming Layer 7 Marking
add action=mark-packet chain=prerouting comment="------------QoS_4 [Streaming_Services]------------" in-interface=PPPoE-UniFi layer7-protocol=Streaming new-packet-mark=QoS_4_In passthrough=no
add action=mark-packet chain=postrouting layer7-protocol=Streaming new-packet-mark=QoS_4_Out out-interface=PPPoE-UniFi passthrough=no
add action=mark-packet chain=prerouting in-interface=PPPoE-UniFi layer7-protocol=video new-packet-mark=QoS_4_In passthrough=no
add action=mark-packet chain=postrouting layer7-protocol=video new-packet-mark=QoS_4_Out out-interface=PPPoE-UniFi passthrough=no
#QoS_8 Torrent Layer 7 Marking
add action=mark-packet chain=prerouting comment="------------QoS_8 [Torrent_Services]------------" in-interface=PPPoE-UniFi layer7-protocol=Torrent-wwws new-packet-mark=QoS_8_In passthrough=no
add action=mark-packet chain=postrouting layer7-protocol=Torrent-wwws new-packet-mark=QoS_8_Out out-interface=PPPoE-UniFi passthrough=no
add action=mark-packet chain=prerouting in-interface=PPPoE-UniFi layer7-protocol=torrentDNS new-packet-mark=QoS_8_In passthrough=no
add action=mark-packet chain=postrouting layer7-protocol=torrentDNS new-packet-mark=QoS_8_Out out-interface=PPPoE-UniFi passthrough=no
add action=mark-packet chain=prerouting in-interface=PPPoE-UniFi new-packet-mark=QoS_8_In p2p=all-p2p passthrough=no
add action=mark-packet chain=postrouting new-packet-mark=QoS_8_Out out-interface=PPPoE-UniFi p2p=all-p2p passthrough=no
#QoS_1 Steam
add action=mark-packet chain=prerouting comment="------------QoS_1 [Steam]------------" in-interface=PPPoE-UniFi new-packet-mark=QoS_1_In passthrough=no protocol=tcp src-port=27014-27050
add action=mark-packet chain=postrouting dst-port=27014-27050 new-packet-mark=QoS_1_Out out-interface=PPPoE-UniFi passthrough=no protocol=tcp
add action=mark-packet chain=prerouting in-interface=PPPoE-UniFi new-packet-mark=QoS_1_In passthrough=no protocol=udp src-port=3478,4379,4380,28960,27000-27030
add action=mark-packet chain=postrouting dst-port=3478,4379,4380,28960,27000-27030 new-packet-mark=QoS_1_Out out-interface=PPPoE-UniFi passthrough=no protocol=udp
#QoS_2 DNS
add action=mark-packet chain=prerouting comment="------------QoS_2 [DNS+NTP_PPTP_Services]------------" in-interface=PPPoE-UniFi new-packet-mark=QoS_2_In passthrough=no protocol=udp src-port=53,123,1723
add action=mark-packet chain=postrouting dst-port=53,123,1723 new-packet-mark=QoS_2_Out out-interface=PPPoE-UniFi passthrough=no protocol=udp
add action=mark-packet chain=prerouting connection-state=new in-interface=PPPoE-UniFi new-packet-mark=QoS_2_In passthrough=no protocol=tcp src-port=52,123,1723
add action=mark-packet chain=postrouting dst-port=52,123,1723 new-packet-mark=QoS_2_Out out-interface=PPPoE-UniFi passthrough=no protocol=tcp
#QoS_3 WWW Services + General_Services
add action=mark-packet chain=prerouting comment="------------QoS_3 [WWW_Services]------------" connection-bytes=0-1500000 in-interface=PPPoE-UniFi new-packet-mark=QoS_3_In passthrough=no protocol=tcp src-port=80,443
add action=mark-packet chain=postrouting connection-bytes=0-1500000 dst-port=80,443 new-packet-mark=QoS_3_Out out-interface=PPPoE-UniFi passthrough=no protocol=tcp
add action=mark-packet chain=prerouting comment="------------QoS_3 [General_Services]------------" in-interface=PPPoE-UniFi new-packet-mark=QoS_3_In passthrough=no protocol=tcp src-port=20,21,22,23,25,110,143,465,587,993,995,2525,3535
add action=mark-packet chain=postrouting dst-port=20,21,22,23,25,110,143,465,587,993,995,2525,3535 new-packet-mark=QoS_3_Out out-interface=PPPoE-UniFi passthrough=no protocol=tcp
#QoS_5 WWW_Heavy
add action=mark-packet chain=prerouting comment="------------QoS_5 [WWW_Services_Heavy]------------" connection-bytes=1500000-0 in-interface=PPPoE-UniFi new-packet-mark=QoS_5_In passthrough=no protocol=tcp src-port=80,443
add action=mark-packet chain=postrouting connection-bytes=1500000-0 dst-port=80,443 new-packet-mark=QoS_5_Out out-interface=PPPoE-UniFi passthrough=no protocol=tcp
#QoS_8 Other BULK
add action=mark-packet chain=prerouting comment="------------QoS_8 [Other_Services]------------" in-interface=PPPoE-UniFi new-packet-mark=QoS_8_In passthrough=no protocol=tcp
add action=mark-packet chain=postrouting new-packet-mark=QoS_8_Out out-interface=PPPoE-UniFi passthrough=no protocol=tcp
add action=mark-packet chain=prerouting in-interface=PPPoE-UniFi new-packet-mark=QoS_8_In passthrough=no protocol=udp
add action=mark-packet chain=postrouting new-packet-mark=QoS_8_Out out-interface=PPPoE-UniFi passthrough=no protocol=udp
add action=mark-packet chain=prerouting in-interface=PPPoE-UniFi new-packet-mark=QoS_8_In passthrough=no
add action=mark-packet chain=postrouting new-packet-mark=QoS_8_Out out-interface=PPPoE-UniFi passthrough=no
# jun/29/2014 21:27:09 by RouterOS 6.12
# software id = AF8C-ZI5T
#
/queue tree
#Upload
add max-limit=4700k name=QoS_Global_Upload parent=global queue=default
add limit-at=512k max-limit=3M name="QoS_1_Out(Steam)" packet-mark=QoS_1_Out parent=QoS_Global_Upload priority=1 queue=default
add limit-at=100k max-limit=1M name="QoS_2_Out(DNS+NTP+PPTP)" packet-mark=QoS_2_Out parent=QoS_Global_Upload priority=2 queue=default
add limit-at=1500k max-limit=4M name="QoS_3_Out(WWW)" packet-mark=QoS_3_Out parent=QoS_Global_Upload priority=3 queue=default
add burst-limit=3800k burst-time=3s max-limit=3M name="QoS_4_Out(Streaming)" packet-mark=QoS_4_Out parent=QoS_Global_Upload priority=4 queue=default
add burst-limit=3800k burst-time=3s max-limit=3M name="QoS_5_Out(WWW_Heavy)" packet-mark=QoS_5_Out parent=QoS_Global_Upload priority=5 queue=default
add burst-limit=4300k burst-time=3s max-limit=3500k name="QoS_8_Out(Default)" packet-mark=QoS_8_Out parent=QoS_Global_Upload queue=pcq-upload-default
#Download
add max-limit=4800k name=QoS_Global_Download parent=global queue=default
add limit-at=512k max-limit=3M name="QoS_1_In(Steam)" packet-mark=QoS_1_In parent=QoS_Global_Download priority=1 queue=default
add limit-at=100k max-limit=500k name="QoS_2_In(DNS+NTP+PPTP)" packet-mark=QoS_2_In parent=QoS_Global_Download priority=2 queue=default
add burst-limit=3M burst-threshold=2M burst-time=5s limit-at=1500k max-limit=2M name="QoS_3_In(WWW)" packet-mark=QoS_3_In parent=QoS_Global_Download priority=3 queue=default
add burst-limit=2500k burst-threshold=1M burst-time=5s max-limit=1M name="QoS_4_In(Streaming)" packet-mark=QoS_4_In parent=QoS_Global_Download priority=4 queue=default
add burst-limit=3800k burst-time=2s max-limit=1M name="QoS_5_In(WWW_Heavy)" packet-mark=QoS_5_In parent=QoS_Global_Download priority=5 queue=default
add burst-limit=4300k burst-threshold=4M burst-time=3s max-limit=3M name="QoS_8_In(Default+Torrent)" packet-mark=QoS_8_In parent=QoS_Global_Download queue=pcq-download-default
2 X ;;; LYNC | Mark new source connections
chain=forward action=mark-connection new-connection-mark=Lync-Connected
passthrough=yes connection-state=new src-address-list=Lync in-interface=TPG PPPoe
3 X ;;; LYNC | Mark Packet
chain=forward action=mark-packet new-packet-mark=Lync_Packet passthrough=yes
connection-mark=Lync-Connected
4 X ;;; LYNC | Mark new dest connections
chain=forward action=mark-connection new-connection-mark=Lync-Connected
passthrough=yes connection-state=new dst-address-list=Lync
out-interface=TPG PPPoe
5 X ;;; LYNC | Mark Packet
chain=forward action=mark-packet new-packet-mark=Lync_Packet passthrough=no
connection-mark=Lync-Connected
Perhaps not. I don't (often) torrent, so that isn't a concern. But that was in pcunite's original script, and while prioritizing UDP traffic like that wouldn't necessarily have been something I would have thought to do if I were writing a script myself, I saw no reason to change it.dear "alaskanjackal" giving higher priority to udp packets is not good when u download torrents, right?
i think i will place them under http_big
Thanks. I dropped the connection-rate parameter from Mangle and it works now and properly classifies large transfers in HTTP_BIG once 5MB of data has been transferred. This may have negative consequences for some long-lived HTTP TCP connections that don't use up much speed but may, over time, use more than 5MB of data, but I'm thinking it all probably makes very little practical difference in my network.connection-rate is broken from firmware 6.28 and after. i dont understand why mikrotik dont fix it.
http://forum.mikrotik.com/viewtopic.php ... te#p501644
downgrade to 6.28 and you will see that it works!
thank you for the nice qos script
HiImplementing VoIP traffic prioritization (Qos) with RouterOS v6
Option 3 ... coming soon
alaskanjackal,Thanks. I dropped the connection-rate parameter from Mangle and it works now and properly classifies large transfers in HTTP_BIG once 5MB of data has been transferred. This may have negative consequences for some long-lived HTTP TCP connections that don't use up much speed but may, over time, use more than 5MB of data, but I'm thinking it all probably makes very little practical difference in my network.connection-rate is broken from firmware 6.28 and after. i dont understand why mikrotik dont fix it.
http://forum.mikrotik.com/viewtopic.php ... te#p501644
downgrade to 6.28 and you will see that it works!
thank you for the nice qos script
I also made a couple of additional changes just now: I separated out VOIP into VOIP-TCP and VOIP-UDP. I then put VOIP-UDP_D into a separate queue with a parent of my inbound interface (rather than MASTER_DOWN) without a limit. I also moved the other UDP_D outside of MASTER_DOWN with no limit. I think this is probably good practice, since, as I mentioned above, there's no point in dropping inbound UDP packets if they've already made it this far. I left VOIP-TCP_D in the MASTER_DOWN queue with a limit as well as both VOIP-UDP_U and VOIP-TCP_U under MASTER_UP with limits (very unlikely that I'll ever have more than a few dozen Kbps in VoIP traffic, but you never know what might happen, so why not).
Seems to be working, but I'll play with it a bit more before posting a revised script.
RouterOS v6.36.4 working properly, then upgrade to 6.37.3. Bug fix confirmedis already fix after 6.31 or 6.33. i cant remember exactly
u should install and test bugfix version 6.36.4
Sorry for my long absence here.
If I have s2s ipsec VPN will it go into "OTHER"?Implementing VoIP traffic prioritization (Qos) with RouterOS v6 – Option 2
I also do not understand how LEVEL_A_ gets priority over LEVEL_B_ and then over LEVEL_C_.Implementing VoIP traffic prioritization (Qos) with RouterOS v6 – Option 2
In my opinion, the only way to understand how the traffic prioritization works is to try to implement a simple one on your own and debug it, not to try to understand someone else's complex example like the one above. Once you understand how it works using your simple case, reading the complex example becomes much easier.If I have s2s ipsec VPN will it go into "OTHER"?Implementing VoIP traffic prioritization (Qos) with RouterOS v6 – Option 2
Funny. To me the idea of setting the DSCP field doesn't sound complicated at all as it is basically a single mangle rule. What may be complicated is to distinguish VoIP packets from non-VoIP ones but if you reserve an address range or subnet on each site for your VoIP devices, or if you can ask the VoIP devices to set the DSCP themselves, it is also not very complex. Softphones are a problem unless they can set DSCP themselves because they cannot be identified by IP address and the PCs they run at generate both kinds of traffic.I think I will forget about putting VoIP into VPN, this definitely sounds to complicated. And I will try to tune the example I have already implemented. Just after I understood how LEVEL_A_ gets priority over LEVEL_B_ and then over LEVEL_C_![]()
Do you use VoIP phones or analog/ISDN phones and only the PBXes would talk VoIP to each other? If VoIP phones, do the PBXes tell the phones to send media to each other directly or do they force themselves into the media path? All that plays a role - if VoIP phones send media directly to each other, they must set DSCP or you must do it on their behalf when forwarding the packets to the remote site.Looks like my PBX boxes are adding DSCP = 40 already, I just afraid that by putting this traffic into VPN will add unnecessary overheat and I will end up with having bigger disaster that I have now.
Yes but not only, you must also give the LEVEL_B queue the lowest priority among all the other child queues of LEVEL_A. And LEVEL_C must have the lowest priority among all child queues of LEVEL_B.So to make LEVEL_B and LEVEL_C always lower priority than LEVEL_A I will change parent of B and C to A?
That's the role of DSCP as mentioned in the other (s2s) thread. The "plaintext" traffic on the WAN can be classified as "TCP" and "other protocols" directly; the IPsec transport packets will either be ESP ones or UDP ones (depending on existence of NAT in the path) with a particular source and destination; whether "TCP" or "other" is encrypted inside them can only be determined if the sending side sets the DSCP field and the transit through internet doesn't destroy it completely.I also have ipsec s2s not for the purpose of VoIP, to completely different site. It is moatly RDP.
Since IPsec s2s is also UDP (I think), how I can put it "to not disturb" my VoIP but not to go into LEVEL_C / OTHER?
Should LEVEL_A as a parent of everything haveYes but not only, you must also give the LEVEL_B queue the lowest priority among all the other child queues of LEVEL_A. And LEVEL_C must have the lowest priority among all child queues of LEVEL_B.So to make LEVEL_B and LEVEL_C always lower priority than LEVEL_A I will change parent of B and C to A?
priority=1
add name="LEVEL_A_UP" parent=ether-WAN queue=default max-limit=900k [b]priority=1
[/b]add name="LEVEL_A_DOWN" parent=bridge-LAN queue=default max-limit=4M [b]priority=1
[/b]add name="VOIP_U" parent="LEVEL_A_UP" packet-mark="VOIP" queue=default priority=1
add name="VOIP_D" parent="LEVEL_A_DOWN" packet-mark="VOIP" queue=default priority=1
add name="LEVEL_B_UP" parent=LEVEL_A_UP queue=default max-limit=[b]something smaler than parent A[/b] [b]priority=2
[/b]add name="LEVEL_B_DOWN" parent=LEVEL_A_DOWN queue=default max-limit=something smaler than parent A [b]priority=2
[/b]
add name="ACK_U" parent="LEVEL_B_UP" packet-mark="ACK" queue=default priority=1
add name="ACK_D" parent="LEVEL_B_DOWN" packet-mark="ACK" queue=default priority=1
add name="SOMETHING" parent="LEVEL_B_UP" packet-mark="SOMETHING" queue=default [b]priority=7
[/b]add name="SOMETHING" parent="LEVEL_B_DOWN" packet-mark="SOMETHING" queue=default [b]priority=7
[/b]
add name="LEVEL_C_UP" parent=[b]LEVEL_B_UP[/b] queue=default max-limit=[b]something smaler than parent B[/b] [b]priority=8
[/b]add name="LEVEL_C_DOWN" parent=[b]LEVEL_B_UP[/b] queue=default max-limit=[b]something smaler than parent B[/b] [b]priority=8
[/b]
add name="HTTP_U" parent="LEVEL_C_UP" packet-mark="HTTP" queue=default [b]priority=1
[/b]add name="HTTP_D" parent="LEVEL_C_DOWN" packet-mark="HTTP" queue=default [b]priority=1
[/b]
add name="OTHER_U" parent="LEVEL_C_UP" packet-mark="OTHER" queue=default priority=8
add name="OTHER_D" parent="LEVEL_C_DOWN" packet-mark="OTHER" queue=default priority=8
I don't like to provide theoretical-only answers and as I've stated several times, I didn't have a strong enough reason to test this practically so far. So already my previous response was wrong, as the manual says the following:Should LEVEL_A as a parent of everything haveYes but not only, you must also give the LEVEL_B queue the lowest priority among all the other child queues of LEVEL_A. And LEVEL_C must have the lowest priority among all child queues of LEVEL_B.So to make LEVEL_B and LEVEL_C always lower priority than LEVEL_A I will change parent of B and C to A??Code: Select allpriority=1
Does priority is valid only among members of the same branch. So all children in sub branch will always step down to traffic if they parent priority is smaller than priority of an other branches on the same level. Does not mutter they have 1 but there is another purrent that have 7 ant they parrent has 8?
Regarding bandwidth, how to make C not to stal everything from B, and then B not to eat everything of A.
Do I need to change theirs max-limit to be smaller from each other?
and the example of proper "do not disturb my VoIP" should look like:
Code: Select alladd name="LEVEL_A_UP" parent=ether-WAN queue=default max-limit=900k [b]priority=1 [/b]add name="LEVEL_A_DOWN" parent=bridge-LAN queue=default max-limit=4M [b]priority=1 [/b]add name="VOIP_U" parent="LEVEL_A_UP" packet-mark="VOIP" queue=default priority=1 add name="VOIP_D" parent="LEVEL_A_DOWN" packet-mark="VOIP" queue=default priority=1 add name="LEVEL_B_UP" parent=LEVEL_A_UP queue=default max-limit=[b]something smaler than parent A[/b] [b]priority=2 [/b]add name="LEVEL_B_DOWN" parent=LEVEL_A_DOWN queue=default max-limit=something smaler than parent A [b]priority=2 [/b] add name="ACK_U" parent="LEVEL_B_UP" packet-mark="ACK" queue=default priority=1 add name="ACK_D" parent="LEVEL_B_DOWN" packet-mark="ACK" queue=default priority=1 add name="SOMETHING" parent="LEVEL_B_UP" packet-mark="SOMETHING" queue=default [b]priority=7 [/b]add name="SOMETHING" parent="LEVEL_B_DOWN" packet-mark="SOMETHING" queue=default [b]priority=7 [/b] add name="LEVEL_C_UP" parent=[b]LEVEL_B_UP[/b] queue=default max-limit=[b]something smaler than parent B[/b] [b]priority=8 [/b]add name="LEVEL_C_DOWN" parent=[b]LEVEL_B_UP[/b] queue=default max-limit=[b]something smaler than parent B[/b] [b]priority=8 [/b] add name="HTTP_U" parent="LEVEL_C_UP" packet-mark="HTTP" queue=default [b]priority=1 [/b]add name="HTTP_D" parent="LEVEL_C_DOWN" packet-mark="HTTP" queue=default [b]priority=1 [/b] add name="OTHER_U" parent="LEVEL_C_UP" packet-mark="OTHER" queue=default priority=8 add name="OTHER_D" parent="LEVEL_C_DOWN" packet-mark="OTHER" queue=default priority=8
I'm a little curious why you have some rules twiceros code
/ip firewall mangle add chain=forward action=mark-connection protocol=udp src-address=192.168.100.5 connection-state=new new-connection-mark="VOIP" comment="IP-PBX" add chain=forward action=mark-packet passthrough=no connection-mark="VOIP" new-packet-mark="VOIP" add chain=forward action=mark-connection protocol=udp dst-address=192.168.100.5 connection-state=new new-connection-mark="VOIP" add chain=forward action=mark-packet passthrough=no connection-mark="VOIP" new-packet-mark="VOIP"You are marking packets twice based on the same options. In my opinion rule 2 can be removed.
Then first there are two rules marking the connection and setting connection-marks. Then use the connection-mark to mark the packets in one single rule.
Should this topic be moved to Useful user articles forum?
isn't it enough to just mark it once? once a packet is read, it will be marked with connection mark, connection mark works both ways upload and download in which case you can mark the packet and be used in queue tree.I'm a little curious why you have some rules twiceros code
/ip firewall mangle add chain=forward action=mark-connection protocol=udp src-address=192.168.100.5 connection-state=new new-connection-mark="VOIP" comment="IP-PBX" add chain=forward action=mark-packet passthrough=no connection-mark="VOIP" new-packet-mark="VOIP" add chain=forward action=mark-connection protocol=udp dst-address=192.168.100.5 connection-state=new new-connection-mark="VOIP" add chain=forward action=mark-packet passthrough=no connection-mark="VOIP" new-packet-mark="VOIP"You are marking packets twice based on the same options. In my opinion rule 2 can be removed.
Then first there are two rules marking the connection and setting connection-marks. Then use the connection-mark to mark the packets in one single rule.
This two rules are not the same... src/dst address are in use![]()
Your understanding is correct in terms that the rule translating connection-mark into packet-mark may be there only once (as the last one after the two assigning the connection-mark). Regarding the need for two rules assigning the connection-mark, it is a more complex question.is my understanding correct?
Thanks for the detailed explanation!Your understanding is correct in terms that the rule translating connection-mark into packet-mark may be there only once (as the last one after the two assigning the connection-mark). Regarding the need for two rules assigning the connection-mark, it is a more complex question.is my understanding correct?
One approach would be to have only one such rule (for src- or dst-address) and say that if a single packet in the "wrong" direction doesn't get connection-marked, it causes no harm as the first subsequent packet in the opposite direction will fix this. The other approach, however, is to save CPU by having the connection-mark->packet-mark translation rule before the connection-marking rules so that these rules would only handle packets belonging to not yet marked connections. And this is usually combined with allowing these rules to handle only the initial packet of each connection (connection-state=new), so then you need to use both rules because you don't know in advance which RTP packet will be the first one in a given call.
And of course, the translation rules have to be doubled in the latter case - the first one handles packets belonging to already marked connections early in the chain, and the other one has to be there to handle the translation for the initial packets after the connection-mark has been just assigned.
I am also writing here because I have not found a solution. Has anyone managed to give priority to VoIP, and to work with no problem, with full load on the line? My problem is this.
I have a CRS109-8G.I am also writing here because I have not found a solution. Has anyone managed to give priority to VoIP, and to work with no problem, with full load on the line? My problem is this.
Someday, I hope to do another write up on this subject, when I get time. I had hoped that one would not need to be an expert to get this correct, but as of 2019, it still does. However, I think a better article would help.
From the moment that audio transmits from your equipment, until it gets back, there must not be greater than a 150ms interruption (or thereabout) otherwise you will notice the delay. Now, think about everything that an audio packet has to go through to make that happen. When you understand that, you'll have solved your VoIP issue.
The permanent fix, a separate Internet service line. Can't do that? Then fast hardware performing QoS where VoIP packets get the best treatment when bad things happen (and they will).
![]()
I have a CRS109-8G. With ubiquity the result is much better.
I don't believe that the problem is the hw specifications of CRC.I have a CRS109-8G. With ubiquity the result is much better.
I would not use the CRS109 for QoS tasks. Too under powered in my opinion. However, there are many variables.
Version 3, running smooth
/queue tree
# DOWN
add max-limit=90M name=DOWN parent=bridge1 queue=default
add name="1. VOIP" packet-mark=VOIP parent=DOWN priority=1 queue=default
add name="2. ACK" packet-mark=ACK parent=DOWN priority=1 queue=default
add name="3. DNS" packet-mark=DNS parent=DOWN priority=2 queue=default
add name="4. UDP" packet-mark=UDP parent=DOWN priority=3 queue=default
add name="5. ICMP" packet-mark=ICMP parent=DOWN priority=4 queue=default
add name="6. HTTP" packet-mark=HTTP parent=DOWN priority=5 queue=default
add name="7. HTTP_BIG" packet-mark=HTTP_BIG parent=DOWN priority=6 queue=default
add name="8. QUIC" packet-mark=QUIC parent=DOWN priority=7 queue=default
add name="9. OTHER" packet-mark=OTHER parent=DOWN priority=8 queue=default
# UP
add max-limit=90M name=UP parent=ether1 queue=default
add name="1. VOIP_" packet-mark=VOIP parent=UP priority=1 queue=default
add name="2. ACK_" packet-mark=ACK parent=UP priority=1 queue=default
add name="3. DNS_" packet-mark=DNS parent=UP priority=2 queue=default
add name="4. UDP_" packet-mark=UDP parent=UP priority=3 queue=default
add name="5. ICMP_" packet-mark=ICMP parent=UP priority=4 queue=default
add name="6. HTTP_" packet-mark=HTTP parent=UP priority=5 queue=default
add name="7. HTTP_BIG_" packet-mark=HTTP_BIG parent=UP priority=6 queue=default
add name="8. QUIC_" packet-mark=QUIC parent=UP priority=7 queue=default
add name="9. OTHER_" packet-mark=OTHER parent=UP priority=8 queue=default