Community discussions

MikroTik App
 
TheMG
just joined
Topic Author
Posts: 15
Joined: Mon Mar 15, 2010 4:59 am

Need a little help with VoIP and QoS

Wed Jul 28, 2010 3:57 am

I've been reading around and there seems to be many different methods of prioritizing VoIP, however I'm not sure what to make of all of that and which method would be best suited to my situation.

My setup consists of a Linksys PAP2T VoIP ATA using the SIP protocol, a RB450G router running RouterOS 4.6, and an ADSL connection. PAP2T is connected directly to eth4 port on the Mikrotik. If it makes any difference, VoIP provider is voip.ms

I want to ensure that no matter what other activities are happening on the network, whether it be download or upload traffic, that VoIP quality is never compromised.

What would be the best way to achieve this?
 
TheMG
just joined
Topic Author
Posts: 15
Joined: Mon Mar 15, 2010 4:59 am

Re: Need a little help with VoIP and QoS

Mon Aug 02, 2010 9:10 am

So either no one has an answer, or no one can be bothered to answer....?
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Need a little help with VoIP and QoS

Mon Aug 02, 2010 3:03 pm

http://wiki.mikrotik.com/wiki/Manual:Queue
http://mum.mikrotik.com/presentations/C ... _Megis.pdf

General information on queues (used to prioritize traffic, and to shape it) as well as the canonical MUM presentation for the same.
 
tinka
Frequent Visitor
Frequent Visitor
Posts: 54
Joined: Wed Dec 02, 2009 5:48 pm

Re: Need a little help with VoIP and QoS

Mon Aug 02, 2010 3:25 pm

i have a similar setup with a spa3000.

based information in the manual and mostly
http://wiki.mikrotik.com/wiki/Bandwith_ ... _ADSL_link

#What i do is define two main queues called Download and Upload

/queue tree
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=7500k name=Download parent=ether2 priority=8
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=900k name=Upload parent=ether1 priority=8

# Mangle the different sources. Address 192.168.1.4 is the spa
# and 192.168.1.5 is my server for nzb and torrents.
# Note default all packages are marked with 'users' and
# afterwards i change the things i want to have other priorities.

/ip firewall mangle
add action=mark-connection chain=forward comment="" disabled=no \
new-connection-mark=users-con passthrough=yes src-address=\
192.168.1.0/24
add action=mark-packet chain=forward comment="" connection-mark=users-con \
disabled=no new-packet-mark=users passthrough=yes

add action=mark-connection chain=forward comment="" disabled=no \
new-connection-mark=voip-con passthrough=yes src-address=192.168.1.4
add action=mark-packet chain=forward comment="" connection-mark=voip-con \
disabled=no new-packet-mark=voip passthrough=yes

add action=mark-connection chain=forward comment="" disabled=no \
new-connection-mark=lp-con passthrough=yes src-address=192.168.1.5
add action=mark-packet chain=forward comment="" connection-mark=lp-con \
disabled=no new-packet-mark=lp passthrough=yes

# now setup the different queues. I have an 10Mb down by 1Mb up adsl line.
#
/queue type
add name=DSL-download kind=pcq pcq-classifier=dst-address
add name=DSL-upload kind=pcq pcq-classifier=src-address

/queue tree
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name=queue2 packet-mark=users parent=Download priority=4 \
queue=DSL-download
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name=queue4 packet-mark=users parent=Upload priority=4 queue=\
DSL-upload

add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=100k \
max-limit=7500k name=voip-rx packet-mark=voip parent=Download priority=1 \
queue=default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=100k \
max-limit=900k name=voip-tx packet-mark=voip parent=Upload priority=1 \
queue=default

add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=7500k name=lp-rx packet-mark=lp parent=Download priority=8 \
queue=default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=900k name=lp-tx packet-mark=lp parent=Upload priority=8 queue=\
default

This works for me. It is key that you make sure the limits are set correctly.

Anyone reading this suggestions or improvements (or even what the
heck are you doing) are welcome.
Last edited by tinka on Sun Aug 08, 2010 1:27 pm, edited 1 time in total.
 
TheMG
just joined
Topic Author
Posts: 15
Joined: Mon Mar 15, 2010 4:59 am

Re: Need a little help with VoIP and QoS

Wed Aug 04, 2010 10:23 pm

Ok so "limit-at=100k" reserves 100k of bandwidth, both upload and download, for the packets marked as VoIP? When VoIP is not being used, is that 100k freed up for other uses?

I've had problems understanding the difference between limit-at and max-limit and how all of the rules work together.

Hmmm now that I look at it in the CLI it seems way simpler than it does in WinBox, where there seems to be a whole load of other options. Maybe that's why I've had problems getting anything working is that WinBox shows a bunch of options which don't really exist? Has things like download and upload in there.

And what's with parent=ether2 and parent=ether1?

Also how are you differentiating between upload and download bandwidth in your rules?
 
adrianatkins
Long time Member
Long time Member
Posts: 556
Joined: Wed Sep 05, 2007 10:34 am
Location: Spain
Contact:

Re: Need a little help with VoIP and QoS

Thu Aug 05, 2010 1:59 am

With VoIP in your situation it might be better to simply give any VoIP traffic MAX Priority.

You can do that (as you have less than 1000 VoIP providers) by using the IP-Firewall-Mangle table, and add to rules : src-ip <ip-of-voip-mob> Action: mark packet: voip

add another rule to do the same for dst-ip <ip-of-voip-mob>

All that does is marks the packets as being traffic to/from you VoIP mob.

Next, in Queues, Queue Trees add a Queue with Priority 1 for the packet mark 'voip', probably on the global-total imq.

You will probably have to fiddle with which chain you use in IP-Firewall-Mangle, but you will see it work when the packet counters go crazy when you make a call.

There are a huge number of variations on this theme, but that's as good a place to start as any.
 
tinka
Frequent Visitor
Frequent Visitor
Posts: 54
Joined: Wed Dec 02, 2009 5:48 pm

Re: Need a little help with VoIP and QoS

Sun Aug 08, 2010 1:06 pm

as i got it from http://wiki.mikrotik.com/wiki/Manual:Queue
> limit-at (NUMBER/NUMBER) : normal upload/download data rate that is guaranteed to a target
so this would mean that 100k is not reserved but guaranteed if needed.

ether1 is my adsl and ether2 is my local network.

I have used a backup file sent by email to create the above message and forgot some things. The script i use to setup my device

#
/ip firewall mangle add chain=forward src-address=192.168.1.0/24 action=mark-connection new-connection-mark=users-con
/ip firewall mangle add connection-mark=users-con action=mark-packet new-packet-mark=users chain=forward
#
/queue type add name=DSL-download kind=pcq pcq-classifier=dst-address
/queue type add name=DSL-upload kind=pcq pcq-classifier=src-address
#
/queue tree add name=Download parent=ether2 max-limit=8000k
/queue tree add parent=Download queue=DSL-download packet-mark=users priority=4
#
/queue tree add name=Upload parent=ether1 max-limit=900k
/queue tree add parent=Upload queue=DSL-upload packet-mark=users priority=4
#
/ip firewall mangle add src-address=192.168.1.4/32 action=mark-connection new-connection-mark=voip-con chain=forward
/ip firewall mangle add connection-mark=voip-con action=mark-packet new-packet-mark=voip chain=forward
#
/queue tree add name=voip-rx parent=Download limit-at=100k packet-mark=voip max-limit=8000k priority=1
/queue tree add name=voip-tx parent=Upload limit-at=100k packet-mark=voip max-limit=900k priority=1
#
/ip firewall mangle add src-address=192.168.1.5/32 action=mark-connection new-connection-mark=lp-con chain=forward
/ip firewall mangle add connection-mark=lp-con action=mark-packet new-packet-mark=lp chain=forward
#
/queue tree add name=lp-rx parent=Download packet-mark=lp max-limit=8000k priority=8
/queue tree add name=lp-tx parent=Upload packet-mark=lp max-limit=900k priority=8
#
Ok so "limit-at=100k" reserves 100k of bandwidth, both upload and download, for the packets marked as VoIP? When VoIP is not being used, is that 100k freed up for other uses?

I've had problems understanding the difference between limit-at and max-limit and how all of the rules work together.

Hmmm now that I look at it in the CLI it seems way simpler than it does in WinBox, where there seems to be a whole load of other options. Maybe that's why I've had problems getting anything working is that WinBox shows a bunch of options which don't really exist? Has things like download and upload in there.

And what's with parent=ether2 and parent=ether1?

Also how are you differentiating between upload and download bandwidth in your rules?