About
Marking your packets with DSCP will enable you to implement a QoS policy on your network to give RTP and SIP traffic more priority. Keep in mind that just because you are marking the packets doesn't mean you have QoS. Your network needs to LOOK at the packets and honor the markings in order for this to work.
NetFilter (IPTables)
You can set the RTP port range used by FreeSWITCH in $${conf_dir}/autoload_configs/switch.conf.xml
# Mark RTP packets with EF: iptables -t mangle -A OUTPUT -p udp -m udp --sport 16384:32768 -j DSCP --set-dscp-class ef # Mark SIP UDP packets with CS3: iptables -t mangle -A OUTPUT -p udp -m udp --sport 5060 -j DSCP --set-dscp-class cs3 iptables -t mangle -A OUTPUT -p udp -m udp --dport 5060 -j DSCP --set-dscp-class cs3 # Mark SIP TCP packets with CS3: iptables -t mangle -A OUTPUT -p tcp --sport 5060 -j DSCP --set-dscp-class cs3 iptables -t mangle -A OUTPUT -p tcp --dport 5060 -j DSCP --set-dscp-class cs3 # Mark SIP TLS packets with CS3: iptables -t mangle -A OUTPUT -p tcp --sport 5061 -j DSCP --set-dscp-class cs3 iptables -t mangle -A OUTPUT -p tcp --dport 5061 -j DSCP --set-dscp-class cs3
#For CentOS/RedHat: *mangle -A OUTPUT -p udp -m udp --sport 5060 -j DSCP --set-dscp-class cs3 -A OUTPUT -p udp -m udp --dport 5060 -j DSCP --set-dscp-class cs3 -A OUTPUT -p udp -m udp --sport 16384:32767 -j DSCP --set-dscp-class ef COMMIT
NetFilter (nftables)
table ip mangle { chain output { type route hook output priority -150; policy accept; udp sport 16384-32768 ip dscp set ef udp sport sip ip dscp set cs3 udp dport sip ip dscp set cs3 tcp sport sip ip dscp set cs3 tcp dport sip ip dscp set cs3 tcp sport 5061 ip dscp set cs3 tcp dport 5061 ip dscp set cs3 } }
Windows
NT 6.1 and Later Releases
DSCP marking can be achieved under the system's local group policy named "Policy-based QoS". To reach that menu, you will need to enter the local group policy editor with administrator rights and navigate to the following:
Computer Configuration->Windows Settings->Policy-based QoS
You can set the policy to mark packets coming from FreeSWITCHConsole.exe that way.
Cisco
Sample Cisco Template for CE devices: http://cisconerd.wordpress.com/2012/09/13/qos-template/
End-to-end test script
See: https://github.com/xlab1/voip_qos_probe
Cheat Sheet
Here is a pretty good guide for QoS: http://cisconerd.wordpress.com/2012/09/13/qos-cheatsheet/