20 December 2010

Simple priority queuing for sip

This will allow you to prioritise sip traffic over other traffic both upload and download. It works well for me. This was done on a RouterBoard 1100 with RouterOS v4.15.

First for upload, mark the connection on the prerouting chain on the inbound interface (in this case ether1)

add action=mark-connection chain=prerouting comment="" connection-type=sip \
disabled=no in-interface=ether1 new-connection-mark=sip_out passthrough=\
yes

Then mark the packets based on the connection mark. No need to specify interface.

add action=mark-packet chain=prerouting comment="" connection-mark=sip_out \
disabled=no new-packet-mark=sip-out passthrough=no

*note the passthrough=no

Now repeat for download. This time the inbound interface is the pppoe interface.

add action=mark-connection chain=prerouting comment="" connection-type=sip \
disabled=no in-interface=pppoe-out1 new-connection-mark=sip-in \
passthrough=yes


And then mark the packets...


add action=mark-packet chain=prerouting comment="" connection-mark=sip-in \
disabled=no in-interface=pppoe-out1 new-packet-mark=sip-in passthrough=no


Now we need to mark all other traffic. You can mark what ever is needed if you want to prioritise anything else, such as http.

add action=mark-connection chain=prerouting comment="" disabled=no \
new-connection-mark=other passthrough=yes
add action=mark-packet chain=prerouting comment="" connection-mark=other \
disabled=no new-packet-mark=other passthrough=no


Now that all traffic is marked, we can create the queues. Under /queue tree create a parent queue for each physical interface and create child queues for the traffic within these, specifying a priority between 2 and 8. Best practice is to reserve priority 1 for network and system traffic such as routing protocols.


add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name=total_down_sw1 parent=ether1 priority=8
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name=total_up_pppoeout parent=pppoe-out1 priority=8
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name=sip-outgoing packet-mark=sip-out parent=total_up_pppoeout \
priority=2 queue=default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name=other-outgoing packet-mark=other parent=total_up_pppoeout \
priority=8 queue=default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name=sip-incoming packet-mark=sip-in parent=total_down_sw1 \
priority=2 queue=default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name=other-incoming packet-mark=other parent=total_down_sw1 \
priority=8 queue=default

Watch the queues and mangle rules in winbox and make a test call or two, as well as downloading and uploading data. You should see the traffic hitting all the queues.






No comments:

Post a Comment