Community discussions

MikroTik App
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

How to setup DSCP 46 Priority for voip?

Tue Aug 30, 2016 9:55 pm

Hello, I am trying to figure out how to setup a QOS for Dscp 46 for voip.
This dscp is already being set on the packets by our voip server program (3cx)

I am a bit confused on the firewalls and Que setups. They all seem to be wanting to mark the traffic when from what I can see the traffic is already marked by the Voip Server.

Any help would be great.

Thanks
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: How to setup DSCP 46 Priority for voip?

Tue Aug 30, 2016 10:02 pm

I wrote a script to setup DSCP for you.. It's in this thread: http://forum.mikrotik.com/viewtopic.php ... cp#p550055
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

Re: How to setup DSCP 46 Priority for voip?

Tue Aug 30, 2016 10:24 pm

Thank you for the reply, I appreciate it alot!
But I am still confused where the dscp 46 comes into play? I think the priority levels there must contain dscp 46, is that right?

Also if I am looking this right should I adjust the dscp value in your script and does this script basically give dscp 46(voip) priority over all other traffic except for route updates?

Please excuse my ignorance I am not very familiar with Mikrotik or prioritization ;/.
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: How to setup DSCP 46 Priority for voip?

Tue Aug 30, 2016 10:28 pm

The script will setup everything you need. you only need to do is set the WAN upload bandwidth.
You VoIP software / hardware will do the rest. It sets the DSCP on the packets (46 for audio, 20-something for control)
The script just sets up the router and queues to honor the disco value setup
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4051
Joined: Wed May 11, 2011 6:08 pm

Re: How to setup DSCP 46 Priority for voip?

Tue Aug 30, 2016 10:41 pm

DSCP is just a field in the IP packet header.
Think of it the same way as writing "fragile" on a box that you send through snail mail.
Just because you've WRITTEN on the box, it doesn't mean that the postal service will honor that mark.

Basically, you must program the router on how to honor the mark.

Queues will match packets based on certain criteria - namely targets + packet marks.
Targets basically determine the source of packets to enter the queue.
Packet marks are an additional "filter"
So if a target specifies an interface, then all packets on that interface will go into the queue. If a packet mark is also specified, then only packets with that mark AND passing through that interface will go into the queue.

Packet marks are a construct that only exists inside the router itself. There is no actual field on the packet which is changed because of a packet mark.
Packet marking is performed in the mangle table.
You can configure your mangle rules to mark packets based on DSCP values. (there are MANY more ways you could choose to mark packets)

So if you made a prerouting chain rule which marks packets having DSCP=46, then your queue can match packets with the specific mark.
It seems like a lot of extra work to go through for something so simple, but because the mangle table can do lots more crazy things than just match DSCP, it turns out that packet marking gives you a ton of functionality that doesn't exist in just queueing based on DSCP.
When given a spoon,
you should not cling to your fork.
The soup will get cold.
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

Re: How to setup DSCP 46 Priority for voip?

Tue Aug 30, 2016 10:46 pm

Bare with me and thanks again.
I thought the voip devices or in my case the 3cx server sets the dscp 46 on the packets.
So why would we want to mark the packets again on the router and not just route or is the dscp value lost some how when reaching the router.

Also is this line talking about the ethernet port (ethernet-Default)? I ask because mine are renamed?

name=($thisDscp+1 . ". " . $subClass ) parent=$queueName priority=($thisDscp+1) queue=ethernet-default
:for thisQueue from=0 to=7 do={

Thank you
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: How to setup DSCP 46 Priority for voip?

Tue Aug 30, 2016 10:49 pm

ethernet-default is the type of queue.

Yes, your 3cx server sets the disco value on the packet, but the Mikrotik does not directly see that. You need the mangle rule to make the packet in a way that the router and understand and then place it in the correct queue.
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

Re: How to setup DSCP 46 Priority for voip?

Tue Aug 30, 2016 10:58 pm

Thank you for that reply!!!
That helps a lot in understanding. I am still a bit in the dark but its getting a little more clear on how all this works.

So would it be possible to just rely on the dscp value set by the 3cx server program or am I missing it or is it just better to do it the complex way for more functionality later on.

my ethernet setup looks like this
set 0 interface=wlan1
set 1 interface=ether1
set 2 interface=ether2
set 3 interface=ether3
set 4 interface=ether4
set 5 interface=ether5

Not sure how to show it without handing out passwords and secure information.
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

Re: How to setup DSCP 46 Priority for voip?

Tue Aug 30, 2016 10:59 pm

Sorry it is taking me too long to reply and I reply without seeing your replies. Thank you. I think I am getting it.... Maybe. thanks again for lending a hand and not calling me dumb.
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

Re: How to setup DSCP 46 Priority for voip?

Tue Aug 30, 2016 11:07 pm

One last dumb question.

So when I use wireshark, I can easily see the packets from my phones that are marked with dscp 46 but when I run torch in mikrotik I don't seem to see those same ip address of those devices. I get some dscp46 from the ip address of the 3cx server but not to the phone I am calling with or any other phone devices.

Am I missing something or using "torch" incorrectly?
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

Re: How to setup DSCP 46 Priority for voip?

Thu Sep 01, 2016 12:19 am

ethernet-default is the type of queue.

Yes, your 3cx server sets the disco value on the packet, but the Mikrotik does not directly see that. You need the mangle rule to make the packet in a way that the router and understand and then place it in the correct queue.
Thank you Sir for the script!

I ran it and I got the mangle rules however it failed to create the queue and I got some error messages in the terminal. I edited only the upload and wan name(or was I supposed to change anything saying "waninterfaceName". I tried that way as well and it still failed to create the queues but the mangle rules applied but I do not see a huge increase in traffic on dscp 46 and 26 when a call is made. Any help would be great. PS I have 951Ui-2HnD's as my routers
:local wanInterfaceName "Ether1"
:local uploadBandwidth 5500k

:local queueName ("DSCP_" . $wanInterfaceName)
:local dscpClass [:toarray "Network Control,Internetwork Control,Critical,Flash Override,Flash,Immedate,Priority,Routine"]
:local dscp 64

:for thisDscp from 63 to 00 do={
    /ip firewall mangle add action=mark-packet chain=postrouting comment=("dscp_" . $thisDscp) \
         disabled=no dscp=$thisDscp new-packet-mark=("dscp_" . $thisDscp) passthrough=no
}

/queue tree add max-limit=$uploadBandwidth name=$queueName parent=$wanInterfaceName priority=1

:for thisDscp from=0 to=7 do={
   :local subClass ([:pick $dscpClass $thisDscp] . " (" . $wanInterfaceName . ")")
   /queue tree add \ 
      name=($thisDscp+1 . ". " . $subClass ) parent=$queueName priority=($thisDscp+1) queue=ethernet-default
   :for thisQueue from=0 to=7 do={
      :set dscp ($dscp-1)
      /queue tree add name=($subClass . " (Pri: " . $thisQueue+1 .")") \
      parent=($thisDscp+1 . ". " . $subClass) priority=($thisQueue+1) \
      packet-mark=("dscp_" . $dscp) queue=ethernet-default comment=("dscp_" . $dscp)
   }
}
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: How to setup DSCP 46 Priority for voip?

Thu Sep 01, 2016 12:22 am

wanInterfaceName needs to match your WAN internet name... normally "ether1", not "Ether1"
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

Re: How to setup DSCP 46 Priority for voip?

Thu Sep 01, 2016 8:38 pm

Okay great, i'll fix that and check it out. Is it normal though that im not seeing much data on those dscp packets?
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

Re: How to setup DSCP 46 Priority for voip?

Thu Sep 01, 2016 8:43 pm

wanInterfaceName needs to match your WAN internet name... normally "ether1", not "Ether1"
Still the same errors.
I think when I paste into the terminal it is messing up the script.
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: How to setup DSCP 46 Priority for voip?

Thu Sep 01, 2016 8:54 pm

that's your problem. You need to paste it into a script, then run the script.
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

Re: How to setup DSCP 46 Priority for voip?

Thu Sep 01, 2016 8:56 pm

sheesh, im a newb. Thanks for taking time to help!
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: How to setup DSCP 46 Priority for voip?

Thu Sep 01, 2016 8:57 pm

no problem at all! We were all newbs with MikroTik at some point.
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

Re: How to setup DSCP 46 Priority for voip?

Thu Sep 01, 2016 9:00 pm

Awesome it setup the Que tree.
One other question.
Is there anything I need to change to prioritize things if I have 2 different locations connected via vpn to this router.(the other locations are on their own subnets but still come back and communicate with the 3cx server)
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: How to setup DSCP 46 Priority for voip?

Thu Sep 01, 2016 9:03 pm

nope. The Mangle rules will catch all the packets passing through the router and read the DSCP, then tag the packet for the queue. If you trust the 3cx server and phones, you are good to go. If you don't trust it, then you can write some extra mangles to catch more and mark them with what you want.

You should be able to look at the queue tree and see just how much is passing through each queue.
After a day or two, you can also turn off any queues & mangles that have 0 traffic. that will lighten the work load on the processor.
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

Re: How to setup DSCP 46 Priority for voip?

Thu Sep 01, 2016 9:05 pm

Thank You! You are a huge benefit to the Mikrotik Community!!!
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: How to setup DSCP 46 Priority for voip?

Thu Sep 01, 2016 9:08 pm

My pleasure!
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
pe1chl
Forum Guru
Forum Guru
Posts: 6783
Joined: Mon Jun 08, 2015 12:09 pm

Re: How to setup DSCP 46 Priority for voip?

Thu Sep 01, 2016 11:57 pm

In my network I use CS1 (DSCP 08) as "background" priority, below the best effort (DSCP 00) priority.
This is also the standard on 802.11p but it does not appear in all DSCP descriptions. There are documents
that specify CS1 and even CS2 (DSCP 10) as "background", unclear if CS2 is below CS1 or reverse.
WMM (the handling of DSCP on WiFi links) also follows this practice.
However, I cannot locate such handling in your script... CS1 and CS2 appear to have higher priority than default.
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: How to setup DSCP 46 Priority for voip?

Fri Sep 02, 2016 12:35 am

The script only places existing dscp tagged packets into the correct dscp queue. It does not mark any traffic that does not have a dscp tag already.
An additional mangle rule would be needed to remark traffic. Anything without a dscp tag or a tag of 0 get placed in the dscp 0 queue.
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
rgrocery
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Thu Oct 02, 2014 6:38 am

Re: How to setup DSCP 46 Priority for voip?

Mon Apr 10, 2017 9:12 pm

Hey Guys,
So I know this is an old post but we are having trouble with phone calls having silent spots. As in talking to someone and they say "can you repeat that again" or we hear someone talking and theres suddenly no audio coming from them.
Currently we have the given DSCP Que in place but I am not sure it is functioning properly.


Any help would be great!
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 1724
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Randburg
Contact:

Re: How to setup DSCP 46 Priority for voip?

Thu Jan 18, 2018 12:40 pm

I wrote a script to setup DSCP for you.. It's in this thread: http://forum.mikrotik.com/viewtopic.php ... cp#p550055
This looks impressive and I want to try and implement this at one of my clients but have 2 questions.

1. I want to read up a bit more in this but unable to access the thread/topic, gives me "file not found"?
2. Can I use this and add the reverse, i.e. use it to prioritize incoming traffic from the Internet, if so, besides changing the port to the internal port, what other changes will need to be done?

Thanking you in advance
MTCNA, MTCTCE, MTCRE & MTCINE
 
sindy
Forum Guru
Forum Guru
Posts: 5509
Joined: Mon Dec 04, 2017 9:19 pm

Re: How to setup DSCP 46 Priority for voip?

Thu Jan 18, 2018 1:09 pm

unable to access the thread/topic, gives me "file not found"?
sounds strange as when I've clicked the link inside the quotation inside your own post, I could normally read the topic, so it is definitely not gone
Can I use this and add the reverse, i.e. use it to prioritize incoming traffic from the Internet
You definitely can prioritize traffic incoming from the internet in terms that you set up output queues also on interfaces forwarding that traffic further to your network, but doing so can only help with issues arising from bandwidth limitations inside your own network. If the bottleneck is already your internet connection, prioritizing received traffic while forwarding it won't help as damage has already been done, and you cannot affect how your ISP prioritizes the traffic towards you by any traffic engineering at your side, only by asking the ISP to do that for you. Well, I'm not completely correct, you can affect the incoming TCP bandwidth to some extent by throttling it during forwarding and/or throttling the responses, but that way you can only leave more space for the priority traffic on the link. So this is rather a bandwidth reservation than an actual traffic prioritization - unless you could detect actual presence of incoming priority traffic and activate TCP throttling of the rest only when needed.

So be more specific about what you actually need to address/solve and what kind of traffic would you like to prioritize.
Instead of writing novels, post /export hide-sensitive. Use find&replace in your favourite text editor to systematically replace all occurrences of each public IP address potentially identifying you by a distinctive pattern such as my.public.ip.1.
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 1724
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Randburg
Contact:

Re: How to setup DSCP 46 Priority for voip?

Thu Jan 18, 2018 1:35 pm

Thank you Sindy,

What you say makes perfect sense.

Problem is downloads are utilizing all bandwidth onsite, the script requires you to specify internet speed, I was thinking of reducing that figure in the script, i.e. link is 20Mb, specify 19Mb in script which should prevent the link from saturating so VoIP data should get to router ok from outside, then prioritize internal according to the DSCP.

Do I have it wrong?
MTCNA, MTCTCE, MTCRE & MTCINE
 
sindy
Forum Guru
Forum Guru
Posts: 5509
Joined: Mon Dec 04, 2017 9:19 pm

Re: How to setup DSCP 46 Priority for voip?

Thu Jan 18, 2018 2:20 pm

Well, the name of the variable in the script is uploadBandwidth which should be self-explaining - you've noticed yourself that it's the downloads what is using all the bandwidth. So unless you can talk to the ISP (the bigger the ISP, the lower the chance it makes sense), the indirect method of keeping part of the download bandwidth free by throttling the downloads is your only option.

So the (bad for you) management summary is that just tuning parameters of this script is useless for your task because the script only provides:
  • creation of priority queues for the upload direction
  • creation of firewall rules which translate DSCP values to routing marks used to place the packets to appropriate queues
Also bear in mind that the DSCP marks are usually at least ignored, if not rewritten, in the internet and it is deemed a Good Thing (called net neutrality).

What you need is to create bandwidth-limiting queues for the download direction, which will slow down any TCP traffic so that its mean bandwidth occupation would be less than the available downlink bandwidth, with some margin on top of what you need to reserve for the summary volume of voice traffic during peak. The need for the margin comes from the fact that TCP is built so that it would work good on paths with high round-trip delays, so it does not require a reception acknowledge for every single packet before sending the next one. Due to this, it takes time before the sending endpoint "notices" that the available bandwidth on the path is limited, so whenever a new connection gets established, and also whenever a new chunk of data comes after a pause, the first packets will come quickly following one another. This can be mitigated by tampering with TCP control information in the uplink packets but I'm not sure whether Mikrotik's firewall implementation provides any means for this. And it has quite a devastating effect on the TCP performance.

Theoretically, you could dynamically adjust the intensity of the throttling (keeping free space for, say, two RTP streams while nobody calls, and as soon as at least one appears, change the throttling parameters accordingly), but I am afraid it would be a lot of effort spent to obtain little effect.
Instead of writing novels, post /export hide-sensitive. Use find&replace in your favourite text editor to systematically replace all occurrences of each public IP address potentially identifying you by a distinctive pattern such as my.public.ip.1.
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 1724
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Randburg
Contact:

Re: How to setup DSCP 46 Priority for voip?

Thu Jan 18, 2018 4:50 pm

Sindy, thank you for excellent response/explanation, I will hit the wiki pages a bit more to see what solution will work best for me.

Many thanks again
MTCNA, MTCTCE, MTCRE & MTCINE
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 1724
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Randburg
Contact:

Re: How to setup DSCP 46 Priority for voip?

Thu Jan 18, 2018 6:25 pm

Reposted in my own thread/topic, apologies again for hijacking :-(
Last edited by CZFan on Thu Jan 18, 2018 8:29 pm, edited 1 time in total.
MTCNA, MTCTCE, MTCRE & MTCINE
 
sidster262
just joined
Posts: 1
Joined: Sat Jan 27, 2018 6:07 pm

Re: How to setup DSCP 46 Priority for voip?

Sat Jan 27, 2018 7:11 pm

Firstly thanks for the awesome people that go out of their way to help newbies on the forums!

I have a few questions which will hopefully help me understand queues and priorities a bit better. I'll start with dumber questions first :-P

If you have a really big internet connection like say 10Gbps which your ISP does not shape or throttle, do you even need queues or some sort of QoS? Assuming you have a powerful enough router, like say a CCR1009 and a fairly close to default setup, are you still at risk of dropping VoIP packets or experiencing jitter? Just for some clarity, I mean VoIP traffic which leaves over my internet connection and goes to my VoIP provider and back. I have uplinked all my switches to the CCR1009 to the 1Gbps ethernet interfaces and my PBX server is connected to one of those switches. I suppose I could connect it directly to the CCR but I'm not even sure it's necessary. The reason I ask this question is because I've read that queues only start working when you reach the max limit on the affected traffic. If my internet connection is never near its maximum capacity are queues even necessary?

I know the setup on my VoIP providers side is also a factor. Most likely they do not even have more than 1Gbps breakout :-D but let's assume that they are willing to work with me to set up QoS, what would they need to do?

Second question, I have been considering moving my VoIP server to a hosted environment. I'm planning on connecting my office router to the VoIP server using OpenVPN so that my SIP devices will connect directly to the VoIP server and eliminate the complications that come with NAT'ing VoIP traffic. Does the same apply to VPN connections as per my first question? If not, is their a simple way to protect or prioritise the VPN interface?

I ended up trying out a combination of the script for DSCP above and tweaking it a bit for download as well. I noticed that I can't set my Max Limit to 10G. It seems 1000M is the highest that can be set. That was the reason for me looking up this thread and got me to thinking about the importance of queues.

In terms of our environment, we have about 30 sip devices in a call center and about 10 - 15 active calls at any given time (Tiny, I know XD). Our internet usage hovers around 50 to 100 Mbps during the day with occasional spikes to 200 or 300 Mbps. We haven't had any major complaints about voice quality but I've noticed some audio cut out on occasion. I know if I take this up with my VoIP provider the first thing they will ask is if I have proper QoS in place. I'm not at the stage where I want to investigate call quality yet so I'm just learning a bit more about the proper way to make sure my setup is correct.

Keep in mind that, like so many others on this forum, just because a setup is completely overkill or unnecessary doesn't mean we don't want to try it ;-P Sometimes it's just to learn or to try something new and maybe it helps us understand!
 
sindy
Forum Guru
Forum Guru
Posts: 5509
Joined: Mon Dec 04, 2017 9:19 pm

Re: How to setup DSCP 46 Priority for voip?

Mon Feb 05, 2018 10:54 pm

... The reason I ask this question is because I've read that queues only start working when you reach the max limit on the affected traffic. If my internet connection is never near its maximum capacity are queues even necessary?
You've pinpointed it. Queueing traffic only makes sense if there is competition about the bandwidth. But bear in mind that the competition may exist also in short-term and if there would be no queues at all, packets could be lost even when the bandwidth would be used for 1 %. Imagine that all your 15 IP phones send a RTP packet towards the VoIP provider's equipment at the very same instant of time - without queueing on the interface, only the first of these packets would make it through and the rest would be dropped. So some queue must exist at the egress interface. But multiple queues with priorities between them are not necessary if there is enough bandwidth.
I know the setup on my VoIP providers side is also a factor. Most likely they do not even have more than 1Gbps breakout :-D but let's assume that they are willing to work with me to set up QoS, what would they need to do?
Most VoIP providers do set DSCP on their outbound traffic, but unless your ISP == your VoIP provider, there is no guarantee that the ISP would respect the VoIP provider's DSCP marking (in some countries discrimination on internet traffic is even illegal).
Second question, I have been considering moving my VoIP server to a hosted environment. I'm planning on connecting my office router to the VoIP server using OpenVPN so that my SIP devices will connect directly to the VoIP server and eliminate the complications that come with NAT'ing VoIP traffic. Does the same apply to VPN connections as per my first question? If not, is their a simple way to protect or prioritise the VPN interface?
A VPN connection is a stream of packets just like any other one, but the encryption of the packets may limit the bandwidth (if the encryption is running in software, the CPU manages to encrypt only some volume of data flow, and hardware encryption also has its capacity limits). This should not be an issue for 15 RTP streams, though.

If you think about using OpenVPN at Mikrotik for VoIP, I wouldn't recommend that as Mikrotik's implementation of OpenVPN is only able to use TCP as transport, and that's bad for VoIP. Everything is fine until the first TCP packet gets lost; if it does, it is retransmitted, and the receiving side does not forward the packets following the lost one although it has already received them until the retransmission of the lost one arrives. So you get jitter values of 100s of milliseconds.

The only type of VPN supported by Mikrotik which is ciphered and uses non-reliable transport (i.e. not retransmitting lost packets on its own) is currently IPsec.
I ended up trying out a combination of the script for DSCP above and tweaking it a bit for download as well. I noticed that I can't set my Max Limit to 10G. It seems 1000M is the highest that can be set. That was the reason for me looking up this thread and got me to thinking about the importance of queues.
I've noticed something like that (max limit of 1000 M) somwehere on this forum.
In terms of our environment, we have about 30 sip devices in a call center and about 10 - 15 active calls at any given time (Tiny, I know XD). Our internet usage hovers around 50 to 100 Mbps during the day with occasional spikes to 200 or 300 Mbps. We haven't had any major complaints about voice quality but I've noticed some audio cut out on occasion. I know if I take this up with my VoIP provider the first thing they will ask is if I have proper QoS in place. I'm not at the stage where I want to investigate call quality yet so I'm just learning a bit more about the proper way to make sure my setup is correct.
This first question of the VoIP provider comes from the fact that many internal company networks have insufficient bandwidth, so even though the uplink is not that busy, the internal connections may drop or delay voice traffic without QoS in place. So sniff at the uplink interface and watch the jitter there. If there is more than 5 ms jitter or even lost packets in outgoing direction, your internal network is worth inspection. If there is more than 5 ms jitter or lost packets in incoming direction, the network path between your VoIP provider and your ISP may be an issue. In practical terms, jitter values below 100 ms rarely cause voice drop-outs as most VoIP equipment has de-jittering buffers which handle that, but such high values already cause some discomfort as 200 ms round-trip delay is at the edge of acceptability.
Instead of writing novels, post /export hide-sensitive. Use find&replace in your favourite text editor to systematically replace all occurrences of each public IP address potentially identifying you by a distinctive pattern such as my.public.ip.1.
 
CTSsean
just joined
Posts: 23
Joined: Fri Sep 15, 2017 12:56 pm

Re: How to setup DSCP 46 Priority for voip?

Sun Mar 11, 2018 7:02 pm

first, Thank you IntrusDave for the script. If someone wouldn't mind explaining, why put the DSCP mangle on the post routing chain and not the pre-routing chain?

Also, why use the default queue tree and not say pcq?
 
marwooj
newbie
Posts: 35
Joined: Mon Nov 06, 2017 10:44 am

Re: How to setup DSCP 46 Priority for voip?

Fri Mar 16, 2018 6:25 pm

In practical terms, jitter values below 100 ms rarely cause voice drop-outs as most VoIP equipment has de-jittering buffers which handle that, but such high values already cause some discomfort as 200 ms round-trip delay is at the edge of acceptability.
How to measure jitter ?
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 1724
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Randburg
Contact:

Re: How to setup DSCP 46 Priority for voip?

Fri Mar 16, 2018 6:38 pm

In practical terms, jitter values below 100 ms rarely cause voice drop-outs as most VoIP equipment has de-jittering buffers which handle that, but such high values already cause some discomfort as 200 ms round-trip delay is at the edge of acceptability.
How to measure jitter ?

T = Dpeak-to-peak + 2× n×Rrms, :D :D

From Wiki:
"In the context of computer networks, jitter is the variation in latency as measured in the variability over time of the packet latency across a network. A network with constant latency has no variation (or jitter).[5] Packet jitter is expressed as an average of the deviation from the network mean latency. However, for this use, the term is imprecise. The standards-based term is "packet delay variation" (PDV).[6] PDV is an important quality of service factor in assessment of network performance."
Last edited by CZFan on Fri Mar 16, 2018 6:42 pm, edited 1 time in total.
MTCNA, MTCTCE, MTCRE & MTCINE
 
sindy
Forum Guru
Forum Guru
Posts: 5509
Joined: Mon Dec 04, 2017 9:19 pm

Re: How to setup DSCP 46 Priority for voip?

Fri Mar 16, 2018 6:41 pm

How to measure jitter ?
The best way is to sniff the traffic on Mikrotik into file and open that file using Wireshark, or configure port mirroring on the switch chip and sniff by Wireshark directly. Make a call while sniffing.
For a particular RTP stream, Wireshark will show you the peak an mean jitter values. You are interested in the jitter as close as possible to the receiving phone. The jitter values for the opposite direction (where you are close to the transmitter) should be almost 0.
Instead of writing novels, post /export hide-sensitive. Use find&replace in your favourite text editor to systematically replace all occurrences of each public IP address potentially identifying you by a distinctive pattern such as my.public.ip.1.
 
satpro74
just joined
Posts: 1
Joined: Sat Jan 26, 2019 4:26 am

Re: How to setup DSCP 46 Priority for voip?

Sat Jan 26, 2019 4:44 am

I’m not terribly familiar with MikroTik and I realize this post is old but from what I understand from research most vendors VoIP phones automatically mark RTP with DSCP 46 by default and SIP is usually DCSP 24 and can be either UDP or TCP but it could be configurable although most vendors do not recommend deviating from their defaults. From my understanding with today’s internet DSCP markings should be preserved through the internet so they can be trusted and/or actioned on the edge devices where needed.
 
sindy
Forum Guru
Forum Guru
Posts: 5509
Joined: Mon Dec 04, 2017 9:19 pm

Re: How to setup DSCP 46 Priority for voip?

Sat Jan 26, 2019 7:41 pm

From my understanding with today’s internet DSCP markings should be preserved through the internet so they can be trusted and/or actioned on the edge devices where needed.
Unfortunately this expectation is too optimistic. Not only that ISPs ignore the DSCP marking (and more than that, doing so is even required by law in some countries/states, requesting so-called "net neutrality"), but they also rewrite the TOS byte values so you cannot rely on your marking from one site to make it to your other site.
Instead of writing novels, post /export hide-sensitive. Use find&replace in your favourite text editor to systematically replace all occurrences of each public IP address potentially identifying you by a distinctive pattern such as my.public.ip.1.

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Znevna and 73 guests