LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Traffic shapping question(s) (https://www.linuxquestions.org/questions/linux-networking-3/traffic-shapping-question-s-642725/)

capthookb 05-16-2008 02:48 PM

Traffic shapping question(s)
 
I have a linksys wag354g adsl modem router, and when i enable qos things get worse, instead of better. After a few minutes i cannot browse the net at all, and all http requests are timing out because of saturation of the router, from p2p traffic.
This is the script of the router for qos with web (port 80) at the hightest of the three levels, and all other traffic at the lowest.

Do you see anything wrong with the script? I noticed that the ceil value is lower than the rate value. Is this correct;

Code:

#!/bin/sh                   

###### Upstream side #########
/usr/sbin/tc qdisc del dev ppp0 root 2> /dev/null > /dev/null
echo "root PQ"                                             
/usr/sbin/tc qdisc add dev ppp0 root handle 1: prio         
echo "PQ 1:1"                                               
/usr/sbin/tc qdisc add dev ppp0 parent 1:1 handle 110:0 dsmark indices 8
/usr/sbin/tc class change dev ppp0 classid 110:1 dsmark mask 0x3 value 0x80
echo "change tos of EF"                                                   
/usr/sbin/tc qdisc add dev ppp0 parent 1:2 handle 2:0 htb default 50     
echo "HTB for non-EF"                                                     
/usr/sbin/tc class  add dev ppp0 parent 2:0 classid 2:1 htb ceil 256kbit rate 256kbit
echo "HTB parent class"                                                             
/usr/sbin/tc class add dev ppp0 parent 2:1 classid 2:10 htb rate 256kbit ceil 204kbit prio 1 quantum 1 burst 6k
echo "HTB AF1"                                                                                               
/usr/sbin/tc qdisc add dev ppp0 parent 2:10 handle 210:0 dsmark indices 8                                     
/usr/sbin/tc class change dev ppp0 classid 210:1 dsmark mask 0x3 value 0x60                                   
echo "change tos of AF1"                                                                                     
/usr/sbin/tc class add dev ppp0 parent 2:1 classid 2:20 htb rate 256kbit ceil 25kbit prio 2 quantum 2 burst 6k
echo "HTB AF2"                                                                                               
/usr/sbin/tc qdisc add dev ppp0 parent 2:20 handle 220:0 dsmark indices 8                                     
/usr/sbin/tc class change dev ppp0 classid 220:1 dsmark mask 0x3 value 0x40                                   
echo "change tos of AF2"                                                                                     
/usr/sbin/tc class add dev ppp0 parent 2:1 classid 2:30 htb rate 256kbit ceil 12kbit prio 3 quantum 3 burst 6k
echo "HTB AF3"                                                                                               
/usr/sbin/tc qdisc add dev ppp0 parent 2:30 handle 230:0 dsmark indices 8                                     
/usr/sbin/tc class change dev ppp0 classid 230:1 dsmark mask 0x3 value 0x20                                   
echo "change tos of AF3"                                                                                     
/usr/sbin/tc class add dev ppp0 parent 2:1 classid 2:40 htb rate 256kbit ceil 10kbit prio 4 quantum 4 burst 6k
echo "HTB AF4"
/usr/sbin/tc qdisc add dev ppp0 parent 2:40 handle 240:0 dsmark indices 8
/usr/sbin/tc class change dev ppp0 classid 240:1 dsmark mask 0x3 value 0xa0
echo "change tos of AF4"
/usr/sbin/tc class add dev ppp0 parent 2:1 classid 2:50 htb rate 256kbit ceil 5kbit prio 5 quantum 5 burst 6k
echo "HTB BE!"

######Filters#########
/usr/sbin/tc filter add dev ppp0 parent 110:0 protocol ip u32 match ip src 0.0.0.0/0 flowid 110:1
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 5 u32 match ip sport 20 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 5 u32 match ip sport 20 0xffff flowid 2:50
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 5 u32 match ip dport 20 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 5 u32 match ip dport 20 0xffff flowid 2:50
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 1 u32 match ip sport 80 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 1 u32 match ip sport 80 0xffff flowid 2:10
/usr/sbin/tc filter add dev ppp0 parent 210:0 protocol ip prio 1 u32 match ip sport 80 0xffff flowid 210:1
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 1 u32 match ip dport 80 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 1 u32 match ip dport 80 0xffff flowid 2:10
/usr/sbin/tc filter add dev ppp0 parent 210:0 protocol ip prio 1 u32 match ip dport 80 0xffff flowid 210:1
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 5 u32 match ip sport 53 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 5 u32 match ip sport 53 0xffff flowid 2:50
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 5 u32 match ip dport 53 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 5 u32 match ip dport 53 0xffff flowid 2:50
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 5 u32 match ip sport 23 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 5 u32 match ip sport 23 0xffff flowid 2:50
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 5 u32 match ip dport 23 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 5 u32 match ip dport 23 0xffff flowid 2:50
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 5 u32 match ip sport 25 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 5 u32 match ip sport 25 0xffff flowid 2:50
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 5 u32 match ip dport 25 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 5 u32 match ip dport 25 0xffff flowid 2:50
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 5 u32 match ip sport 110 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 5 u32 match ip sport 110 0xffff flowid 2:50
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 5 u32 match ip dport 110 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 5 u32 match ip dport 110 0xffff flowid 2:50
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 1 u32 match ip sport 123 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 1 u32 match ip sport 123 0xffff flowid 2:10
/usr/sbin/tc filter add dev ppp0 parent 210:0 protocol ip prio 1 u32 match ip sport 123 0xffff flowid 210:1
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 1 u32 match ip dport 123 0xffff flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 1 u32 match ip dport 123 0xffff flowid 2:10
/usr/sbin/tc filter add dev ppp0 parent 210:0 protocol ip prio 1 u32 match ip dport 123 0xffff flowid 210:1
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 0 u32 match ip tos 0x80 0xe0 flowid 1:1
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 1 u32 match ip tos 0x60 0xe0 flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 1 u32 match ip tos 0x60 0xe0 flowid 2:10
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 2 u32 match ip tos 0x40 0xe0 flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 2 u32 match ip tos 0x40 0xe0 flowid 2:20
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 3 u32 match ip tos 0x20 0xe0 flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 3 u32 match ip tos 0x20 0xe0 flowid 2:30
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 4 u32 match ip tos 0xa0 0xe0 flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 4 u32 match ip tos 0xa0 0xe0 flowid 2:40
/usr/sbin/tc filter add dev ppp0 parent 1:0 protocol ip prio 5 u32 match ip tos 0x0 0xe0 flowid 1:2
/usr/sbin/tc filter add dev ppp0 parent 2:0 protocol ip prio 5 u32 match ip tos 0x0 0xe0 flowid 2:50



The scematic of current traffic shapping settings is this:
http://img381.imageshack.us/img381/6...raphcj7.th.gif

and the settings on the configuration page of the router is this:
http://img396.imageshack.us/img396/5636/wagfb6.th.jpg

SonJelfn 05-27-2008 01:22 PM

Hello,

the script generated has a flaw. Since you are using HTB as a queuing discipline, your rate, which is the guaranteed minimum speed for a class when your link is full, should always be equal to or less than the ceil, which is the maximum speed that your class can go at including borrowing from other classes.

I don't know how you generated the script but it seems that your rate value should be your ceil value and your ceil value should be your rate value. If you change those around you should get the desired effect.

I hope that helps.

Good luck.

capthookb 06-08-2008 05:22 AM

The script is automatically generated by the router firmware (i have the source code).

But when i enter manually some script of my own like this:

Quote:

#!/bin/sh
DEV=ppp0

tc qdisc del dev $DEV root

echo "Shaping device $1....."
#OURA TIS ETHERNET $DEV
tc qdisc add dev $DEV parent root handle 1:0 htb default 20
tc class add dev $DEV parent 1:0 classid 1:1 htb rate 255kbit

#KLASH GIA TO PC
tc class add dev $DEV parent 1:1 classid 1:20 htb rate 155kbit ceil 255 prio 3

#KLASH GIA TO XBOX
tc class add dev $DEV parent 1:1 classid 1:30 htb rate 100kbit ceil 255 prio 0

tc filter add dev $DEV parent 1:0 protocol ip u32 match ip src 192.168.1.2 classid 1:30
tc filter add dev $DEV parent 1:0 protocol ip u32 match ip src 192.168.1.4 classid 1:20
the internet led goes off, and the router becomes unreachable. I cannot even ping it. If i ommit the ceil value, the above script has no problem.


All times are GMT -5. The time now is 06:25 AM.