You wanted an explanation.
my first impression:
scripts like this are supposed to shape traffic which is going OUT of your box - the bandwith values must fit your UPSTREAM bandwith.
It is not entirely clear from what you said that you now have 2 MBit upstream.
(DSL/ADSL-lines here for instance typically are called 2 MBit when there is a DOWNSTREAM of 2 MBit - but the UPSTREAM is just 256 kBit).
The script puts the traffic into different classes - based on certain criteria - here it is done with u32 matches (it looks inside the packets and matches 0xfff - whatever that is).
These classes get a certain bandwidth - an upper limit with "
ceil" and a guaranteed minimum with "
rate".
There is the first problem - the script uses bandwidths as low as 30kbit - this cannot be achieved as it is now - the first line would need to read:
Code:
tc qdisc add dev eth0 root handle 1:0 htb r2q 1
to achieve this.
Also there is no default class - packets not matched by the script do not get a certain (lower) priority - and are thus treated the same as everything else. Looks not very useful to me.
There is something more wrong with this script I think - classid
1:2 is used two times with different values.
Only one of these is needed, I think the first two lines are wrong and not needed.
Quote:
Code:
tc class add dev eth0 parent 1:1 classid 1:2 htb \rate 307kbit ceil 512kbit
tc class add dev eth0 parent 1:2 classid 1:3 htb \rate 204kbit ceil 512kbit
tc class add dev eth0 parent 1:1 classid 1:2 htb \rate 307kbit ceil 307kbit
tc class add dev eth0 parent 1:1 classid 1:3 htb \rate 204kbit ceil 204kbit
|
I'm not sure what these u32 matches actually match - besides the port - what should they do for you? What do you want them to do?
next:
For every "
filter" line "
prio 1" is used (everything gets the same high priority) - this does not make sense to me.
Especially combined with the fact that every class belonging to 1:2 and 1:3 has the same upper bandwidth (
ceil).
I have written a few versions of shaping scripts - one of it is here:
http://wiki.leipzig.freifunk.net/Traffic-Shaping
(have a version with english comments too)
It is most likely not what you want - I made it for my own special purpose.
If you describe what you want your script to do, I or someone else will be able to help you.
opinions?
Cheers