Hello, I have made every effort learning QoS. I chose HTB and wrote a script (attached to the message). The problem is error messages in syslog. They appear on heavy load. It looks like: Jun 12 23:00:04 server kernel: KERNEL: assertion (delay > 0 && delay < 5000000) failed at sch_htb.c(411) Jun 12 23:00:41 server last message repeated 12 times Jun 12 23:01:42 server last message repeated 72 times Jun 12 23:02:43 server last message repeated 49 times Jun 12 23:03:51 server last message repeated 29 times Jun 12 23:04:52 server last message repeated 46 times Jun 12 23:05:02 server last message repeated 16 times What does it mean? There was another type of messages: Jun 12 19:42:33 server kernel: htb*r0 m=0 Jun 12 19:42:34 server kernel: HTB: quantum of class 10040 is small. Consider r2q change.<7>htb*g j=7636248 Jun 12 19:42:34 server kernel: htb*r7 m=0 Jun 12 19:42:34 server kernel: htb*r6 m=0 Jun 12 19:42:34 server kernel: htb*r5 m=0 Jun 12 19:42:34 server kernel: htb*r4 m=0 Jun 12 19:42:34 server kernel: htb*r3 m=0 Jun 12 19:42:34 server kernel: htb*r2 m=0 Jun 12 19:42:34 server kernel: htb*r1 m=0 but after I added "r2q 1" parameter to a htb qdisc, kernel started complaining with the message above. Please help me or give some kind of hint. Bye, Tadas
#!/bin/bash #Left to do # * WWW -> 1:20 # * ICQ,IRC # * takas proxy # * fwrules (proxy.takas.lt->here) # * FTP <-> # Definitions PPP=ppp0 IMQ=imq0 BURST=6k UPLINK=63 DOWNLINK=255 CLASS1_REMOTE_PORTS="27015 27016 27020" CLASS2_REMOTE_PORTS="6667 5190 22" CLASS4_REMOTE_PORTS="1214 20 `seq -f \"4100%g\" 0 9` `seq -f \"410%g\" 10 20`" CLASS4_LOCAL_PORTS="25 20 80 `seq -f \"4100%g\" 0 9` `seq -f \"410%g\" 10 20`" ############## Function definitions ################## #echo -e "\033[1;35m xxx \033[0m" function add_qdisc { echo -e "\033[0;35m>>>\033[0;31m $1\033[0m" $1 } function add_class { # echo -e " \033[0;35m>>>\033[0;36m " # COUNTER=0 # while [ $COUNTER -lt $2 ]; do # let COUNTER=COUNTER+1 # echo -n " " # done # echo -e "$1\033[0m" echo -e " \033[0;35m>>>\033[0;36m $1\033[0m" $1 } function msg { echo -e " \033[1;35m* \033[0;34m $1\033[0m" } function add_filter { if [ "$1" = "debug" ] then echo -e " \033[0;35m>>>\033[0;32m $1\033[0m" fi $1 } function show_dev { echo -e " \033[0;31m$1\033[0m" } function show_class { echo -e " \033[0;32m$1\033[0m" } function show_qdisc { echo -e " \033[0;36m$1\033[0m" } ############## Show status ########################### if [ "$1" = "status" ] then show_dev "******* $PPP *******" echo -e " \033[0;36m" tc -s qdisc ls dev $PPP echo -e " \033[0;32m" tc -s class ls dev $PPP show_dev "******* $IMQ *******" echo -e " \033[0;36m" tc -s qdisc ls dev $IMQ echo -e " \033[0;32m" tc -s class ls dev $IMQ echo -e "\033[0m" exit fi ################# Firewall & system settings ########### modprobe imq numdevs=1 ip link set imq0 up # Clean mangle table iptables -t mangle -F PREROUTING iptables -t mangle -F POSTROUTING iptables -t mangle -F INPUT iptables -t mangle -F OUTPUT iptables -t mangle -F FORWARD # Some packet marking iptables -t mangle -A INPUT -i $PPP -s proxy.takas.lt -p tcp -m tcp --sport 8080 -j MARK --set-mark=7 iptables -t mangle -A OUTPUT -o $PPP -d proxy.takas.lt -p tcp -m tcp --dport 8080 -j MARK --set-mark=3 iptables -t mangle -A PREROUTING -i $PPP -p udp -m udp --sport 53 -j MARK --set-mark 6 iptables -t mangle -A PREROUTING -p udp -m udp --dport 53 -j MARK --set-mark 2 iptables -t mangle -A INPUT -i $PPP -p udp -m udp --sport 53 -j MARK --set-mark 6 iptables -t mangle -A OUTPUT -p udp -m udp --dport 53 -j MARK --set-mark 2 #iptables -t mangle -A PREROUTING -i $PPP -p tcp -m tos --tos minimize-delay -m state --state ESTABLISHED -j MARK --set-mark 2 # Queue incoming packets #iptables -t mangle -A PREROUTING -i $PPP -j LOG iptables -t mangle -A PREROUTING -i $PPP -j IMQ ####################################################### # clean existing down- and uplink qdiscs, hide errors tc qdisc del dev $PPP root 2> /dev/null > /dev/null tc qdisc del dev $PPP ingress 2> /dev/null > /dev/null tc qdisc del dev $IMQ root 2> /dev/null > /dev/null tc qdisc del dev $IMQ ingress 2> /dev/null > /dev/null if [ "$1" = "stop" ] then exit fi show_dev "########## Uplink ###########" add_qdisc "tc qdisc add dev $PPP root handle 1: htb default 30 r2q 1" add_class "tc class add dev $PPP parent 1: classid 1:1 htb rate 63kbit burst $BURST" add_class "tc class add dev $PPP parent 1:1 classid 1:10 htb rate $[$UPLINK*45/100]kbit ceil ${UPLINK}kbit burst $BURST prio 1" add_class "tc class add dev $PPP parent 1:1 classid 1:20 htb rate $[$UPLINK*35/100]kbit ceil ${UPLINK}kbit burst $BURST prio 2" add_class "tc class add dev $PPP parent 1:1 classid 1:30 htb rate $[$UPLINK*19/100]kbit ceil ${UPLINK}kbit burst $BURST prio 2" add_class "tc class add dev $PPP parent 1:1 classid 1:40 htb rate 1kbit ceil $[8*$UPLINK/10]kbit burst $BURST prio 2" add_qdisc "tc qdisc add dev $PPP parent 1:10 handle 10: sfq perturb 10" add_qdisc "tc qdisc add dev $PPP parent 1:20 handle 20: sfq perturb 10" add_qdisc "tc qdisc add dev $PPP parent 1:30 handle 30: sfq perturb 10" add_qdisc "tc qdisc add dev $PPP parent 1:40 handle 40: sfq perturb 10" # Matches U32="tc filter add dev $PPP protocol ip parent 1:0 prio 1 u32" msg "- UP - 1 -------" #echo "Adding EXTREMALY high priority UPLOAD trafic filters" for a in $CLASS1_REMOTE_PORTS do add_filter "$U32 match ip dport $a 0xffff flowid 1:10" done msg " ICMP (ip protocol 1) in the interactive class 1:10 so we \ can do measurements & impress our friends:" add_filter "$U32 match ip protocol 1 0xff flowid 1:10" msg "- UP - 2 -------" #Important packets # TOS Minimum Delay (ssh, NOT scp) in 1:10: add_filter "$U32 match ip tos 0x10 0xff flowid 1:20" msg "Adding fiilters for dport ranges" for a in $CLASS2_REMOTE_PORTS do add_filter "$U32 match ip dport $a 0xffff flowid 1:20" done msg "- UP - 4 -------" # echo "Adding lowest priority uplink filters" for a in $CLASS4_REMOTE_PORTS do add_filter "$U32 match ip dport $a 0xffff flowid 1:40" done for a in $CLASS4_LOCAL_PORTS do add_filter "$U32 match ip sport $a 0xffff flowid 1:40" done msg "prioritize small packets (<64 bytes)" add_filter "$U32 match ip protocol 6 0xff \ match u8 0x05 0x0f at 0 \ match u16 0x0000 0xffc0 at 2 \ flowid 1:20" msg "filter by fw mark" #add_filter "tc filter add dev $PPP protocol ip pref 2 parent 1:0 handle 2 fw classid 1:10" add_filter "tc filter add dev $PPP protocol ip pref 3 parent 1:0 handle 3 fw classid 1:20" add_filter "tc filter add dev $PPP protocol ip pref 4 parent 1:0 handle 4 fw classid 1:30" add_filter "tc filter add dev $PPP protocol ip pref 5 parent 1:0 handle 5 fw classid 1:40" add_filter "$U32 match ip dst 0.0.0.0/0 flowid 1:30" show_dev "############ Downlink ####################" # Classes add_qdisc "tc qdisc add dev $IMQ root handle 1: htb default 30" add_class "tc class add dev $IMQ parent 1: classid 1:1 htb rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit" add_class "tc class add dev $IMQ parent 1:1 classid 1:10 htb rate $[$DOWNLINK*45/100]kbit ceil ${DOWNLINK}kbit burst $BURST prio 1" add_class "tc class add dev $IMQ parent 1:1 classid 1:20 htb rate $[$DOWNLINK*35/100]kbit ceil ${DOWNLINK}kbit burst $BURST prio 2" add_class "tc class add dev $IMQ parent 1:1 classid 1:30 htb rate $[$DOWNLINK*19/100]kbit ceil ${DOWNLINK}kbit burst $BURST prio 2" add_class "tc class add dev $IMQ parent 1:1 classid 1:40 htb rate 1kbit ceil $[8*$DOWNLINK/10]kbit burst $BURST prio 2" add_qdisc "tc qdisc add dev $IMQ parent 1:10 handle 10: sfq perturb 10" add_qdisc "tc qdisc add dev $IMQ parent 1:20 handle 20: sfq perturb 10" add_qdisc "tc qdisc add dev $IMQ parent 1:30 handle 30: sfq perturb 10" add_qdisc "tc qdisc add dev $IMQ parent 1:40 handle 40: sfq perturb 10" # Matches U32="tc filter add dev $IMQ protocol ip parent 1:0 prio 1 u32" msg "Adding EXTREMALY high priority DOWNLOAD trafic filters" for a in $CLASS1_REMOTE_PORTS do add_filter "$U32 match ip sport $a 0xffff flowid 1:10" done # ICMP (ip protocol 1) in the interactive class 1:10 so we # can do measurements & impress our friends: add_filter "$U32 match ip protocol 1 0xff flowid 1:10" msg "Adding other high priority DOWNLOAD trafic filters" # TOS Minimum Delay (ssh, NOT scp) in 1:20 add_filter "$U32 match ip tos 0x10 0xff flowid 1:20" # Source port ranges for a in $CLASS2_REMOTE_PORTS do add_filter "$U32 match ip sport $a 0xffff flowid 1:20" done msg "Adding lowest priority uplink filters" for a in $CLASS4_REMOTE_PORTS do add_filter "$U32 match ip sport $a 0xffff flowid 1:40" done for a in $CLASS4_LOCAL_PORTS do add_filter "$U32 match ip dport $a 0xffff flowid 1:40" done # prioritize small packets (<64 bytes) add_filter "$U32 match ip protocol 6 0xff \ match u8 0x05 0x0f at 0 \ match u16 0x0000 0xffc0 at 2 \ flowid 1:20" msg "Filters by fw mark" #add_filter "tc filter add dev $IMQ protocol ip pref 6 parent 1:0 handle 6 fw classid 1:10" add_filter "tc filter add dev $IMQ protocol ip pref 7 parent 1:0 handle 7 fw classid 1:20" add_filter "tc filter add dev $IMQ protocol ip pref 8 parent 1:0 handle 8 fw classid 1:30" add_filter "tc filter add dev $IMQ protocol ip pref 9 parent 1:0 handle 9 fw classid 1:40" add_filter "$U32 match ip dst 0.0.0.0/0 flowid 1:30"