VOIP and QOS

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!

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.

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.

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.

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

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

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.

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

\


Call Center Software