Originally posted by diaskimo
###### Download setting ######
#Del DL/UL device
tc qdisc del dev eth0 root
tc qdisc del dev eth1 root
#Create DL Device information
tc qdisc add dev eth0 root handle 1: htb default 7
tc class add dev eth0 parent 1: classid 1:1 htb rate 512kbit ceil 512kbit
#Default DL flow
tc class add dev eth0 parent 1:1 classid 1:7 htb rate 10kbit ceil 512kbit prio 7
tc qdisc add dev eth0 parent 1:7 handle 77: sfq perturb 10
#or rate 200kbit ceil 512kbit
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 200kbit ceil 200kbit prio 0
tc qdisc add dev eth0 parent 1:10 handle 10: sfq
For the rate 200kbit ceil 200kbit case, using prio parameter is not necessary since the 'high prio' class does not have to borrow anyway. I don't recall exactly how many prio levels there are in HTB, but they were not many, so maybe prio 7 is too high a value already?
You also should be aware of the shaping download traffic problems. You actually don't have any influence on the packets that are sent to you. All you can do (so far) is drop packets and hope that the other side is using a TCP/IP implementation that tries to send slower in this case.
Also, you are using SFQ. Be aware that SFQ works by reordering packets, which means they are queued (standard queue 128 packets per SFQ) and then shuffled. This can cause delays, thus you should not use SFQ for interactive traffic.
##### Upload setting ######
#Create UL Device information
tc qdisc add dev eth1 root handle 1000: htb default 8
tc class add dev eth1 parent 1000: classid 1000:1 htb rate 512kbit ceil 512kbit
#Default UL flow
tc class add dev eth1 parent 1000:1 classid 1000:8 htb rate 10kbit ceil 512kbit prio 7
tc qdisc add dev eth1 parent 1000:8 handle 88: sfq perturb 10
This setup is incomplete. Class 1000:8 is an only child. You only have one leaf class you can put traffic into. In other words, there is no other traffic than default traffic. It actually has always 512kbit worth of traffic, because there is no other class that could borrow that bandwidth away. So all this setup does is limit upload to 512kbit, nothing else.
In HTB, only childs never make sense!