Discussion: QoS with Linux using PRIO and HTB

Comments Filter

problem about QoS with Linux using PRIO and HTB

I used similar scripts to control VOIP and non-VOIP,but when both traffics come the same time , the VOIP traffics sometime disappeared , and then comes again, and the rate limit of non-VOIP is correct. I don't know why ? Anyone can tell me? thanks.
do_cmd() {
echo "> $@"
eval $@
if "$status" != 0 ; then
echo "ERROR: got $status"


start_policing_up() {
local dev vname low_up burst_rate
local devs="${1:-${police_up_ifaces}}"

devs="$(filter_up_ifaces $devs)"

for dev in $devs; do

eval low_up=\$${vname}

log_info "start policing up at ${low_up}Kbps for iface ${dev}"

  1. shape uplink
  2. prio queue gives strict priority to voice, shares rest via HTB

do_cmd tc qdisc add dev $dev root handle 1: prio bands 2 priomap 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

do_cmd tc qdisc add dev $dev parent 1:1 handle 11: pfifo

do_cmd tc qdisc add dev $dev parent 1:2 handle 12: htb r2q 3 default 1

  1. it was determined that burst_rate=$date_rate/20k where data_rate is in kbits
  2. and the burst rate in kbytes through trial and error
burst_rate="$${low_up} / 20k"

do_cmd tc class add dev $dev parent 12: classid 12:1 htb rate ${low_up}kbit burst ${burst_rate}

  1. voice traffic (qos_dscp_high) always goes first
do_cmd tc filter add dev $dev parent 1: prio 1 protocol ip u32 match ip tos $dscp_high_hex 0xfc flowid 1:1

  1. data (non-voice) traffic gets the leftovers

do_cmd tc filter add dev $dev parent 1: prio 3 protocol ip u32 match ip src flowid 1:2

by jackywgw, Wednesday 07 of August, 2013 (10:23:10 UTC)

Can you share how your monitor works?

by doolph, Saturday 02 of September, 2006 (21:55:57 UTC)
box at home with web server and *

I tried multiple htb setups, but they never obeyed the ceil. I tested with scp and http, and they would always suck up all my bandwidth and leave my voip call with major delay and loss.

The HTB manual gave me the answer: mtu. I set the mtu to the maximum packet size, while keeping burst and cburst low, and it finally obeyed ceil.

If you are running a box with any sort of file sharing (http, scp, ftp), I imagine this will help. I have a box at home with a broadband router and comcast cable (6Mbps/340kbps). The box has asterisk, apache, ssh, vsftpd, and more.

The relevant command for the script on this page:
tc class add dev eth0 parent 12:1 classid 12:10 htb rate 1kbit ceil 250kbit prio 1 burst 1b cburst 1b mtu 47000

Do the same with all the htb classes. I haven't tested other burst sizes, but I'm thinking burst is unwanted in this scenario. 250kbit ceil works well for me, providing decent call quality with decent uplink bandwidth. I used ethereal to capture scp and http traffic, and then looked through the packet lengths to find the maximum, 46500, then I chose 47000 for mtu.

In case it's not apparent already, I'm using part of the script given on this page, where voip goes through the pfifo 11: and other things go through htb 12:10-12:12. My box serves local clients and Internet clients, so my tc filters only select Internet-bound traffic, leaving the local traffic to flow at maximum speed. I don't control the downlink, but that may become an issue for me.

by jaaason, Friday 01 of September, 2006 (08:33:26 UTC)

the author is perfectly right. On ADSL, with 192kbit upload, the wondershaper (cbq) and htp based solutions will not do the job. prio shaper is the only feasible solution. thanks Carceri!

by borghart, Friday 09 of June, 2006 (09:35:19 UTC)