LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-16-2008, 03:48 PM   #1
capthookb
LQ Newbie
 
Registered: Oct 2005
Posts: 17

Rep: Reputation: 0
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

Last edited by capthookb; 06-08-2008 at 06:29 AM.
 
Old 05-27-2008, 02:22 PM   #2
SonJelfn
Member
 
Registered: Aug 2003
Location: Sendai, Japan
Distribution: Slackware, Slackware64, Debian
Posts: 63

Rep: Reputation: 17
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.
 
Old 06-08-2008, 06:22 AM   #3
capthookb
LQ Newbie
 
Registered: Oct 2005
Posts: 17

Original Poster
Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
per ip shapping in freebsd 6.2 da1 *BSD 0 06-18-2007 08:14 PM
Firestarter traffic question narz Linux - Newbie 5 05-25-2007 04:57 PM
traffic shapping acidrop Linux - Networking 0 05-26-2005 12:06 PM
Upstream Shapping qtgeo *BSD 2 11-08-2004 02:53 PM
traffic shapping against msn/video marianop Linux - Networking 2 01-05-2004 04:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration