well this may have just become a QOS for gxp2000/asterisk thread, but for those interested, I finally got DiffServ working on outbound SIP/RTP related packets from my trixbox/asterisk box. The wierd part, was I was having trouble getting the firewall to work at all. Every time i did a service iptables status, it would return "firewall stopped". Luckily I ran along the following:
iptables Won't Start
The iptables startup script expects to find the /etc/sysconfig/iptables before it starts. If none exists, then symptoms include the firewall status always being stopped and the /etc/init.d/iptables script running without the typical [OK] or [FAILED] messages.
If you have just installed iptables and have never applied a policy, then you will face this problem. Unfortunately, running the service iptables save command before restarting won't help either. You have to create this file.
[root@bigboy tmp]# service iptables start
[root@bigboy tmp]#
[root@bigboy tmp]# touch /etc/sysconfig/iptables
[root@bigboy tmp]# chmod 600 /etc/sysconfig/iptables
[root@bigboy tmp]# service iptables start
Applying iptables firewall rules: [ OK ]
[root@bigboy tmp]#
from:
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables#iptables_Won.27t_Start
And then i just added the following to my iptables firewall script:
echo "Load rules for mangle table ..."
$IPT -t mangle -A POSTROUTING -p udp --sport 5004:5082 -j DSCP --set-dscp-class EF
$IPT -t mangle -A POSTROUTING -p udp --sport 10000:20000 -j DSCP --set-dscp-class EF
Im still not 100% sure of those port ranges, but I think they cover SIP/RTP just fine.
anyway, a tshark inspection of outbound traffic from my server to gxpphones and my VOIP service providers show the following:
Frame 4 (552 bytes on wire, 552 bytes captured)
Arrival Time: Oct 26, 2007 10:36:15.055755000
[Time delta from previous packet: 0.499513000 seconds]
[Time since reference or first frame: 2.199214000 seconds]
Frame Number: 4
Packet Length: 552 bytes
Capture Length: 552 bytes
[Frame is marked: False]
[Protocols in frame: eth:ip:udp:sip]
Ethernet II, Src: AsustekC_, Dst: Cisco_3c)
Destination: Cisco_3)
Address: Cisco_3)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Source: AsustekC_4)
Address: AsustekC_4)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Type: IP (0x0800)
Internet Protocol, Src: [MY SERVER IP]( [MY SERVER IP]), Dst: [MY VOIP PROVIDER IP]([MY VOIP PROVIDER IP])
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0xb8 (DSCP 0x2e: Expedited Forwarding; ECN: 0x00)
1011 10.. = Differentiated Services Codepoint: Expedited Forwarding (0x2e)
.... ..0. = ECN-Capable Transport (ECT): 0
.... ...0 = ECN-CE: 0
Total Length: 538
Identification: 0x15a0 (5536)
Flags: 0x00
0... = Reserved bit: Not set
.0.. = Don't fragment: Not set
..0. = More fragments: Not set
Fragment offset: 0
Time to live: 64
Protocol: UDP (0x11)
Header checksum: 0x04df [correct]
[Good: True]
hooray.