Pablo Osuna
2006-Jul-01 15:42 UTC
How to priorize VoIP in a Wi-Fi scenario? Default qdisc in Linux, PRIO, HTB and HFSC ...
Hi all, Long email but please be patient :) I am part of EHAS [1], a non profit organization which main goal is to improve the Healthcare assistance in isolated rural areas in developing countries. Recently we have developed a long distance Wi-Fi network in Cuzco (Peru). This network provides connectivity to 12 nodes (they are in fact Health Centers). As VoIP is a essential service in this scenario we have setup a software PBX (Asterisk). Also nodes can browse through Internet and we probably add video service (by WebCams) in the future. So we have three services, in order of priority: VoIP, video and data. As we want to priorize Voice and Video I have been studying in the last month how to do that with Linux. After reading lot of documentation [2] [3] [4], I have setup a testbed with a chain of 3 nodes in the laboratory. Using iperf I inject TCP traffic and every 20s a different flow of UDP traffic (to simulate VoIP, video and noise). I process the logs and get graphs from them: nodeA <--(channel1)--> nodeB <--(channel6)--> nodeC - 0-80s: TCP - 20-80s: TCP + UDP (voice) - 40-80s: TCP + UDP (voice) + UDP (video) - 60-80s: TCP + UDP (voice) + UDP (video) + UDP (noise) Basically I wanted to test which is the best qdisc to do this. I have setup two schemes: 1) One using PRIO as the main qdisc and some leaf classes as RED, SFQ and short pfifo queues. 2) And the second scheme uses HTB as the main qdisc with the same kind of leaf classes. And now some conclusions and questions: --- PRIO --- My concern is that I am getting very similar results when I setup PRIO and when I setup default qdisc (actually without doing nothing). PRIO setup is: tc qdisc add dev wlan0 root handle 1: prio tc filter add dev wlan0 parent 1:0 prio 1 protocol ip u32 match ip tos 0xa0 0xff flowid 1:1 tc filter add dev wlan0 parent 1:0 prio 2 protocol ip u32 match ip tos 0x60 0xff flowid 1:2 tc filter add dev wlan0 parent 1:0 prio 3 protocol ip u32 match ip tos 0x00 0xff flowid 1:3 tc qdisc add dev wlan0 parent 1:1 sfq perturb 10 tc qdisc add dev wlan0 parent 1:2 sfq perturb 10 tc qdisc add dev wlan0 parent 1:3 sfq perturb 10 VoIP traffic is marked with 0x0a and Video traffic with 0x60. The thing is that voice and video get the same throughput as UDP noise (TCP get nothing as it was expected). I expected to see VoIP beating video, and video beating noise but I saw these 3 flows getting the same throughput, as default behaviour. Can someone tell me what is the default qdisc running in Linux? I have read somewhere that the default qdisc was pfifo with 3 children. Maybe the default qdisc is in fact very similar to PRIO qdisc??? --- HTB --- With HTB I am getting much nicer results and I can see the difference among that and doing nothing. But there is a problem with this qdisc as it has been said in this list before: Lets presume we have 1Mbps of total throughput in the wireless links. When I reduce the speed of the wireless links to 0.5Mbps (that can be very normal in a real wireless scenario) and keep the HTB with same parameters from 1Mbps test, the results get much worse. I read that HTB root has to be the bottleneck but never understood well why ... can someone explain me that? --- HFSC --- I have read the English translation [4] (thanks Martin Brown!) but still do not get the whole idea behind this qdisc. Could it be a solution for unstable networks (in terms of variable bandwidth) as WiFi networks are? After reading [5] I have changed our HTB setup to a HFSC setup: First my HTB setup: tc qdisc add dev wlan0 root handle 1:0 htb tc class add dev wlan0 parent 1:0 classid 1:1 htb rate 0.95Mbit tc class add dev wlan0 parent 1:1 classid 1:2 htb rate 0.7Mbit ceil 0.95Mbit prio 0 tc class add dev wlan0 parent 1:1 classid 1:3 htb rate 0.29Mbit ceil 0.95Mbit prio 1 tc class add dev wlan0 parent 1:1 classid 1:4 htb rate 0.01Mbit ceil 0.95Mbit prio 2 tc qdisc add dev wlan0 parent 1:2 sfq perturb 10 tc qdisc add dev wlan0 parent 1:3 sfq perturb 10 tc qdisc add dev wlan0 parent 1:4 sfq perturb 10 tc filter add dev wlan0 parent 1:0 prio 1 protocol ip u32 match ip tos 0xa0 0xff flowid 1:2 tc filter add dev wlan0 parent 1:0 prio 2 protocol ip u32 match ip tos 0x60 0xff flowid 1:3 tc filter add dev wlan0 parent 1:0 prio 3 protocol ip u32 match ip tos 0x00 0xff flowid 1:4 And now my HFSC setup: tc qdisc add dev $INTWIRELESS root handle 1:0 hfsc tc class add dev $INTWIRELESS parent 1:0 classid 1:1 hfsc sc rate 0.95Mbit ul rate 0.95Mbit tc class add dev $INTWIRELESS parent 1:1 classid 1:2 hfsc sc rate 0.7Mbit ul rate 0.95Mbit tc class add dev $INTWIRELESS parent 1:1 classid 1:3 hfsc sc rate 0.29Mbit ul rate 0.95Mbit tc class add dev wlan0 parent 1:1 classid 1:4 hfsc sc rate 0.01Mbit ul rate 0.95Mbit tc qdisc add dev wlan0 parent 1:2 sfq perturb 10 tc qdisc add dev wlan0 parent 1:3 sfq perturb 10 tc qdisc add dev wlan0 parent 1:4 sfq perturb 10 tc filter add dev wlan0 parent 1:0 prio 1 protocol ip u32 match ip tos 0xa0 0xff flowid 1:2 tc filter add dev wlan0 parent 1:0 prio 2 protocol ip u32 match ip tos 0x60 0xff flowid 1:3 tc filter add dev wlan0 parent 1:0 prio 3 protocol ip u32 match ip tos 0x00 0xff flowid 1:4 The problem is that when I activate HFSC I lose the wireless connection between the nodes so probably I am doing something wrong. I know I am missing some HFSC parameters as dmax and umax but I do not know very well how to setup them. In case of saturation I just want to have VoIP with 70% of the resources, video with 29% and data with 1%. In case of no saturation I would like borrowing among them. Please, can someone tell me a nice HSFC setup to get this? On the other hand iperf probably is not the best tool but it is the only one I have tested. If someone has any other recommendation it is more than welcome :) Well, this was my first email to the list. Hope I am lucky and get some answers to my questions. I will keep doing tests and will post more results here. Regards: Pablo [1] http://www.ehas.org/index_html?set_language=en&cl=en [2] http://www.opalsoft.net/qos/DS.htm [3] http://lartc.org/ [4] http://linux-ip.net/tc/hfsc.en/ [5] http://mailman.ds9a.nl/pipermail/lartc/2006q2/018865.html
Say if I have a few routes like this ip rule add from 19.21.12.12 lookup 200 ip route add default via 10.0.0.253 ip rule add to 13.1.2.2 lookup 201 ip route add default via 10.0.0.254 ip route add default via 10.0.0.254 How do I save them, I have looked through the list and have googled this Q for some time and do not have an concrete answers. I have read that you just save and rerun the command but that does not work as the "from all to" is not valid it has to be the "to" without the "from all". I have used multiple versions of iproute2 and still the same problem. I written a script and put in many sed''s to get around problems but its nasty code. Surely someone solved this is there a "saveall" script or bin that is distro independant. Thanks.
On 01-08-2006 11:28, Oscar Mechanic wrote:> Say if I have a few routes like this > > ip rule add from 19.21.12.12 lookup 200 > ip route add default via 10.0.0.253 > ip rule add to 13.1.2.2 lookup 201 > ip route add default via 10.0.0.254 > ip route add default via 10.0.0.254 > > How do I save them, I have looked through the list and have googled this > Q for some time and do not have an concrete answers. I have read that > you just save and rerun the command but that does not work as the "from > all to" is not valid it has to be the "to" without the "from all". I > have used multiple versions of iproute2 and still the same problem. I > written a script and put in many sed''s to get around problems but its > nasty code. Surely someone solved this is there a "saveall" script or > bin that is distro independant.Maybe I miss your point, but ip doesn''t care if you write a command by hand (from shell) or run it from a shell script. If you don''t use "from ...", it is the same as if you''ve written "from all". It doesn''t contradict with "to ..." which is another parameter. After your last command there will be an error because it repeats the previous one. If you add in a script: set -x before the first command, you will see, which end with errors. Jarek P.