I'm moving my old HTB script over from my old slackware install (using =
older iproute2, version iproute2-ss991023) onto my brand-spanking-new =
Debian 3.0r0 (woody) machine, running newer version iproute2-ss010824. =
But in the new version of "tc", the very first command of the script =
gives "RTNETLINK answers: Invalid argument". However, if I use the
OLD =
tc (991023), it works fine (and so does the rest of my script). =
Therefore it's not my kernel etc; it must be some difference on the =
cmd-line between the two versions of iproute2. But no matter how hard i =
try, I can't find out what the new syntax should be. Here's the line =
that's failing:
tc qdisc add dev eth0 root handle 1: htb default 13
Any ideas how to make that work with the new version?
Also, here's my HTB/SFQ setup for my house, I wonder if one of you genii =
could have a look over it and tell me the crap parts and how to improve =
:) My setup is one cablemodem connection with 25k/sec max upstream, and =
about 100k/sec downstream. I have 3 main classes (if that's the right =
word), one for SSH traffic, one for ACKs, and one for the personal PCs =
of the 3 guys that live in our house (including me). Here goes:
------------------------
#!/bin/sh
tc qdisc del dev eth0 root handle 1: htb default 13 1>/dev/null =
2>/dev/null
tc qdisc add dev eth0 root handle 1: htb default 13
UPRATE=3D"21"
SINGLE_HUMAN_CEIL=3D"19"
NON_CRITICAL=3D"14"
SINGLE_HUMAN_UPRATE=3D"4"
CRIT_SSH=3D"2"
CRIT_NONSSH=3D"5"
# root
tc class add dev eth0 parent 1: classid 1:1 htb rate ${UPRATE}kbps ceil =
${UPRATE}kbps burst 2k
# child 1 - PCs (tim/peter/brian/router PCs) - has leaves underneath
tc class add dev eth0 parent 1:1 classid 1:2 htb rate =
${NON_CRITICAL}kbps ceil ${UPRATE}kbps burst 2k prio 3
# child 2 - time critical traffic (interactive traffic, etc) - has no =
leaves!
tc class add dev eth0 parent 1:1 classid 1:3 htb rate ${CRIT_SSH}kbps =
ceil ${UPRATE}kbps burst 2k prio 1
# child 3 - time critical traffic (interactive traffic, etc) - has no =
leaves!
tc class add dev eth0 parent 1:1 classid 1:4 htb rate ${CRIT_NONSSH}kbps =
ceil ${UPRATE}kbps burst 2k prio 2
# 1:10 tim
tc class add dev eth0 parent 1:2 classid 1:10 htb rate =
${SINGLE_HUMAN_UPRATE}kbps ceil ${SINGLE_HUMAN_CEIL}kbps burst 2k prio
3
# 1:11 peter
tc class add dev eth0 parent 1:2 classid 1:11 htb rate =
${SINGLE_HUMAN_UPRATE}kbps ceil ${SINGLE_HUMAN_CEIL}kbps burst 2k prio
3
# 1:12 brian
tc class add dev eth0 parent 1:2 classid 1:12 htb rate =
${SINGLE_HUMAN_UPRATE}kbps ceil ${SINGLE_HUMAN_CEIL}kbps burst 2k prio
3
# 1:13 default - includes this router
tc class add dev eth0 parent 1:2 classid 1:13 htb rate 2kbps ceil =
${SINGLE_HUMAN_CEIL}kbps burst 2k prio 3
# use SFQ (stochastic fair queueing) for everything
tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev eth0 parent 1:11 handle 11: sfq perturb 10
tc qdisc add dev eth0 parent 1:12 handle 12: sfq perturb 10
tc qdisc add dev eth0 parent 1:13 handle 13: sfq perturb 10
tc qdisc add dev eth0 parent 1:3 handle 3: sfq perturb 10
tc qdisc add dev eth0 parent 1:4 handle 4: sfq perturb 10
# matchings
# match any ACK packets to interactive (critical traffic)
tc filter add dev eth0 parent 1: protocol ip prio 5 u32 \
match ip protocol 6 0xff \
match u8 0x05 0x0f at 0 \
match u16 0x0000 0xffc0 at 2 \
match u8 0x10 0xff at 33 \
flowid 1:4
# match ping packets to critical traffic
tc filter add dev eth0 parent 1: protocol ip prio 7 u32 \
match ip protocol 1 0xff flowid 1:4
# match SSH (not scp) to critical traffic
tc filter add dev eth0 parent 1: protocol ip prio 6 u32 \
match ip tos 0x10 0xff flowid 1:3
# match packets MARKed by iptables for individual PCs
tc filter add dev eth0 protocol ip parent 1:0 prio 10 handle 10 fw =
flowid 1:10
tc filter add dev eth0 protocol ip parent 1:0 prio 10 handle 11 fw =
flowid 1:11
tc filter add dev eth0 protocol ip parent 1:0 prio 10 handle 12 fw =
flowid 1:12
-------------------------
It works, but i'm not sure if it could be improved at all. I don't know =
much about burst/prio settings for HTB, and even less about the SFQ =
stuff i'm using with perturb 10. Also, I get some warnings about HTB's =
quantums in various log files, none of which I understand.=20
All help welcome!
many thanks,
tim
-----------------------------------=20
Tim Carr=20
Co-op Student - Unix Group=20
RIM Canada=20
(519) 888-7465 x2561=20
WATERLOO HANDMADE EMAIL PROJECT:=20
This email is made from natural Jute fibers by artisans
working at the Handmade Email Project. Your=20
correspondence revives a traditional craft and helps=20
create employment for underpriviledged co-op students
working the rural areas of Waterloo.