Community discussions

MikroTik App
 
fball
newbie
Topic Author
Posts: 31
Joined: Mon Oct 08, 2007 7:59 pm

VOIP and QOS

Tue May 05, 2009 6:59 pm

I have search the forums and read all I have found but would like to make sure I am implementing this correctly. I have a single VOIP device (Linksys PAP2t) and would like it to have priority traffic for VOIP on my T1 connection. The linksys IP is 10.4.5.99 so here is what I set up:

Mangle:
0 chain=prerouting action=mark-connection new-connection-mark=VOIP passthrough=yes src-address=10.4.5.99
1 chain=postrouting action=mark-connection new-connection-mark=VOIP passthrough=yes dst-address=10.4.5.99
2 chain=prerouting action=mark-packet new-packet-mark=VOIPpack passthrough=yes connection-mark=VOIP
3 chain=postrouting action=mark-packet new-packet-mark=VOIPpack passthrough=yes connection-mark=VOIP
4 chain=prerouting action=mark-connection new-connection-mark=NONVOIP passthrough=yes src-address=!10.4.5.99
5 chain=postrouting action=mark-connection new-connection-mark=NONVOIP passthrough=yes dst-address=!10.4.5.99
6 chain=prerouting action=mark-packet new-packet-mark=NONVOIPpack passthrough=yes connection-mark=NONVOIP
7 chain=postrouting action=mark-packet new-packet-mark=NONVOIPpack passthrough=yes connection-mark=NONVOIP

Queue Tree:
0 name="AllTraffic" parent=global-total packet-mark="" limit-at=0 queue=default priority=8 max-limit=1500000 burst-limit=0 burst-threshold=0 burst-time=0s
1 name="VOIP" parent=AllTraffic packet-mark=VOIPpack limit-at=500000 queue=Q_VOIP priority=1 max-limit=1500000 burst-limit=0 burst-threshold=0 burst-time=0s
2 name="NONVOIP" parent=AllTraffic packet-mark=NONVOIPpack limit-at=0 queue=Q_VOIP priority=8 max-limit=1500000 burst-limit=0 burst-threshold=0 burst-time=0s

Queue Type:
5 name="Q_VOIP" kind=pcq pcq-rate=0 pcq-limit=50 pcq-classifier="" pcq-total-limit=2000

Does this make sense to anyone? It kinda looks like it works. Should anything be added or changed?

Thanks!
 
JJCinAZ
Member
Member
Posts: 475
Joined: Fri Oct 22, 2004 8:03 am
Location: Tucson, AZ

Re: VOIP and QOS

Tue May 05, 2009 7:52 pm

I would use the following mangles:
0 chain=forward action=mark-packet new-packet-mark=NONVOIPpack passthrough=no connection-mark=NONVOIP 
1 chain=forward action=mark-packet new-packet-mark=VOIPpack passthrough=no connection-mark=VOIP 
2 chain=prerouting action=mark-connection new-connection-mark=VOIP passthrough=no src-address=10.4.5.99 
3 chain=prerouting action=mark-connection new-connection-mark=NONVOIP passthrough=no 
On your queues, I wouldn't use PCQ type for this application (just default) and your AllTraffic queue should have a parent of the outgoing interface (ether1 or whatever) not global-total. By using global-total, you are not using the full 1.5mpbs outbound on the T1. Further, you only really get to queue packets going out an interface -- you have little to no control of packets arriving at an interface. This means, of course, that unless your ISP is prioritizing VoIP packets going out to your T1, you are only queuing half the VoIP conversations.
 
fball
newbie
Topic Author
Posts: 31
Joined: Mon Oct 08, 2007 7:59 pm

Re: VOIP and QOS

Tue May 05, 2009 8:19 pm

Thanks a TON! So after mods I have this:

Tree:
0 name="AllTraffic" parent=ether1 packet-mark="" limit-at=0 queue=default priority=8
max-limit=1500000 burst-limit=0 burst-threshold=0 burst-time=0s

1 name="VOIP" parent=AllTraffic packet-mark=VOIPpack limit-at=500000 queue=default
priority=1 max-limit=1500000 burst-limit=0 burst-threshold=0 burst-time=0s

2 name="NONVOIP" parent=AllTraffic packet-mark=NONVOIPpack limit-at=0 queue=default
priority=8 max-limit=1500000 burst-limit=0 burst-threshold=0 burst-time=0s

Mangle:
0 chain=forward action=mark-packet new-packet-mark=NONVOIPpack passthrough=no
connection-mark=VOIP

1 chain=forward action=mark-packet new-packet-mark=VOIPpack passthrough=no
connection-mark=NONVOIP

2 chain=prerouting action=mark-connection new-connection-mark=VOIP passthrough=no
src-address=10.4.5.99

3 chain=prerouting action=mark-connection new-connection-mark=NONVOIP passthrough=no


Does the order of the Mangle matter? I would think the connection mark should be before the new-packet mark.
 
JJCinAZ
Member
Member
Posts: 475
Joined: Fri Oct 22, 2004 8:03 am
Location: Tucson, AZ

Re: VOIP and QOS

Wed May 06, 2009 12:14 am

Well the order of the mangle matters within a chain. The mangle rules are executed multiple times in the packet flow with different chain selectors. For example, in the preroute stage, the mangle rules where chain=prerouting are executed in their order. Then later in the forward stage, the mangle rules are run again but where chain=forward, so the order of prerouting versus forwarding doesn't matter but within the chain it does. Make sense? Study the packet flow diagram in the RouterOS documentation to make more sense of it.

As for the NONVOIP queue, I would set the limit-at to 1000000, else the queue is always over it's CIR and attaches to it's parent immediately. In your case it won't matter though. Finally, I would rename your top queue from AllTraffic to InternetOut or something because that's all you're queuing/shaping here.
 
rpress
Member Candidate
Member Candidate
Posts: 113
Joined: Thu May 07, 2009 5:13 am

Re: VOIP and QOS

Sat May 16, 2009 11:11 pm

I use simple queues for VoIP and it works very well. This is for a 3 Mb/s line with 10.69.77.222 as the asterisk server.
/queue type
add kind=pcq name=pcq-upload pcq-classifier=src-address pcq-limit=50 \
    pcq-rate=0 pcq-total-limit=2000
add kind=pcq name=pcq-download pcq-classifier=dst-address pcq-limit=50 \
    pcq-rate=0 pcq-total-limit=2000
/queue simple
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" \
    direction=both disabled=no dst-address=0.0.0.0/0 interface=public \
    limit-at=0/0 max-limit=2800k/2800k name="Public Interface" parent=none \
    priority=4 queue=pcq-upload/pcq-download total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" \
    direction=both disabled=no dst-address=0.0.0.0/0 interface=all limit-at=\
    0/0 max-limit=0/0 name=VoIP parent="Public Interface" priority=2 queue=\
    default/default target-addresses=10.69.77.222/32 total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" \
    direction=both disabled=no dst-address=0.0.0.0/0 interface=all limit-at=\
    0/0 max-limit=0/0 name=Other parent="Public Interface" priority=4 queue=\
    pcq-upload/pcq-download total-queue=default
 
miahac
Long time Member
Long time Member
Posts: 516
Joined: Wed Dec 14, 2005 5:04 pm
Location: Wichita, KS

Re: VOIP and QOS

Wed Jul 08, 2009 12:39 am

I did
/ip firewall mangle
add chain=forward action=mark-packet new-packet-mark=NONVOIPpack passthrough=no connection-mark=VOIP
add chain=forward action=mark-packet new-packet-mark=VOIPpack passthrough=no connection-mark=NONVOIP
add chain=prerouting action=mark-connection new-connection-mark=VOIP passthrough=no src-address=192.168.10.253
add chain=prerouting action=mark-connection new-connection-mark=NONVOIP passthrough=no


/queue tree
add name="InternetOut" parent=ether2 packet-mark="" limit-at=0 queue=default priority=8 max-limit=740000 burst-limit=0 burst-threshold=0 burst-time=0s
add name="VOIP" parent=InternetOut packet-mark=VOIPpack limit-at=500000 queue=default priority=1 max-limit=740000 burst-limit=0 burst-threshold=0 burst-time=0s
add name="NONVOIP" parent=InternetOut packet-mark=NONVOIPpack limit-at=0 queue=default priority=8 max-limit=256000 burst-limit=0 burst-threshold=0 burst-time=0s 
For a DSL line with 768k up 6m down and a trixbox on 192.168.10.253 that has voip phones on the lan and voip trunks to a carrier... Ether 2 is my lan interface, my wan interface is PPPoE on ether 1 Any suggestions
 
miahac
Long time Member
Long time Member
Posts: 516
Joined: Wed Dec 14, 2005 5:04 pm
Location: Wichita, KS

Re: VOIP and QOS

Thu Jul 09, 2009 11:00 pm

OK that is not quite it. I seem to be queueing all traffic backwards, maybe because I am queueing my lan interface.... I tried changing to my pppoe and now the "VOIP" counter does not increase.
 
julyinin
just joined
Posts: 1
Joined: Wed Jul 15, 2009 7:41 pm

Re: VOIP and QOS

Wed Jul 15, 2009 7:45 pm

I have a single VOIP device, how to set priority traffic for VOIP on a T1 connection..??


_________________
Call Center Software

Who is online

Users browsing this forum: almdandi, Google [Bot] and 69 guests