--Boundary-00=_mNy1+gBh629MdgS
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi, guys.
I have tried emailing Bert with these updates, but he never got back to me,
and I think this would be a genuinely useful addition to it's current feature
set. :-)
The featured improvements include:
1) Lowest priority traffic is bounded to it's bandwidth (currently set at
80%), so it cannot borrow more bandwidth from it's sibling classes. This
seems to help greatly with higher priority services getting through much
faster, without greatly taking away from the bandwidth available for the
lowest priority traffic.
2) It now works for multiple interfaces. The settings are in the format of 1
config file per interface, typically named by the interface (although this is
not too important, any name will do). These files should typically live in
/etc/sysconfig/wshaper by default. The format is the usual shell variable
assignment format, i.e. variable=value. Value names/values are the same as
those at the top of the old Wonder Shaper script. Each interface is set and
checked to the specified values when the usual stop/status/start commands are
issued.
3) Note: I have commended out all the ingress shaping, because I run a 2.2.x
kernel which doesn't support ingress policing properly. To enable this,
simply uncomment the relevant lines in the wshaper script.
The new wshaper script as well as a sample config file are both attached.
Regards.
Gordan
--Boundary-00=_mNy1+gBh629MdgS
Content-Type: application/x-shellscript;
name="wshaper"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="wshaper"
#!/bin/bash
# Wonder Shaper
# please read the README before filling out these values
#
# Configuration files are in /etc/sysconfig/wshaper/
#########################################################
if [ "$1" = "status" ]
then
for IF in `ls /etc/sysconfig/wshaper/`
do
. /etc/sysconfig/wshaper/$IF
tc -s qdisc ls dev $DEV
tc -s class ls dev $DEV
done
exit
fi
# clean existing down- and uplink qdiscs, hide errors
for IF in `ls /etc/sysconfig/wshaper/`
do
. /etc/sysconfig/wshaper/$IF
tc qdisc del dev $DEV root 2> /dev/null > /dev/null
#tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
done
if [ "$1" = "stop" ]
then
exit
fi
for IF in `ls /etc/sysconfig/wshaper/`
do
. /etc/sysconfig/wshaper/$IF
###### uplink
# install root CBQ
tc qdisc add \
dev $DEV \
root handle 1: cbq \
avpkt 1024 \
bandwidth 10mbit
# shape everything at $UPLINK speed - this prevents huge queues in your
# DSL modem which destroy latency:
# main class
tc class add \
dev $DEV \
parent 1: \
classid 1:1 \
cbq rate ${UPLINK}kbit \
allot 1500 \
prio 5 \
bounded \
isolated
# high prio class 1:10:
tc class add \
dev $DEV \
parent 1:1 \
classid 1:10 cbq \
rate ${UPLINK}kbit \
allot 1600 \
prio 1 \
avpkt 1024
# bulk and default class 1:20 - gets slightly less traffic,
# and a lower priority:
tc class add \
dev $DEV \
parent 1:1 \
classid 1:20 cbq \
rate $[90*$UPLINK/100]kbit \
allot 1600 \
prio 2 \
avpkt 1024
# 'traffic we hate'
tc class add \
dev $DEV \
parent 1:1 \
classid 1:30 cbq \
rate $[80*$UPLINK/100]kbit \
allot 1600 \
prio 3 \
avpkt 1024 \
bounded
# all get Stochastic Fairness:
tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
# start filters
# TOS Minimum Delay (ssh, NOT scp) in 1:10:
tc filter add \
dev $DEV \
parent 1:0 \
protocol ip \
prio 10 \
u32 match ip \
tos 0x10 0xff \
flowid 1:10
# ICMP (ip protocol 1) in the interactive class 1:10 so we
# can do measurements & impress our friends:
tc filter add \
dev $DEV \
parent 1:0 \
protocol ip \
prio 11 \
u32 match ip \
protocol 1 0xff \
flowid 1:10
# prioritize small packets (<64 bytes)
tc filter add \
dev $DEV \
parent 1: \
protocol ip \
prio 12 \
u32 match ip \
protocol 6 0xff \
match u8 0x05 0x0f at 0 \
match u16 0x0000 0xffc0 at 2 \
flowid 1:10
# some traffic however suffers a worse fate
for a in $NOPRIOPORTDST
do
tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \
match ip dport $a 0xffff flowid 1:30
done
for a in $NOPRIOPORTSRC
do
tc filter add dev $DEV parent 1: protocol ip prio 15 u32 \
match ip sport $a 0xffff flowid 1:30
done
for a in $NOPRIOHOSTSRC
do
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 \
match ip src $a flowid 1:30
done
for a in $NOPRIOHOSTDST
do
tc filter add dev $DEV parent 1: protocol ip prio 17 u32 \
match ip dst $a flowid 1:30
done
# rest is 'non-interactive' ie 'bulk' and ends up in 1:20
tc filter add \
dev $DEV \
parent 1: \
protocol ip \
prio 18 \
u32 match ip \
dst 0.0.0.0/0 \
flowid 1:20
########## downlink #############
# slow downloads down to somewhat less than the real speed to prevent
# queuing at our ISP. Tune to see how high you can set it.
# ISPs tend to have *huge* queues to make sure big downloads are fast
#
# attach ingress policer:
#tc qdisc add dev $DEV handle ffff: ingress
# filter *everything* to it (0.0.0.0/0), drop everything that's
# coming in too fast:
#tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
# 0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1
done
--Boundary-00=_mNy1+gBh629MdgS
Content-Type: text/plain;
charset="us-ascii";
name="eth1"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="eth1"
DEV=eth1
DOWNLINK=977
UPLINK=250
NOPRIOHOSTSRC=
NOPRIOHOSTDST=
NOPRIOPORTSRC=80
NOPRIOPORTDST=
--Boundary-00=_mNy1+gBh629MdgS--
On Friday 30 May 2003 11:24, Gordan Bobic wrote: > Hi, guys. > > I have tried emailing Bert with these updates, but he never got back to me, > and I think this would be a genuinely useful addition to it's current > feature set. :-) > > The featured improvements include: > > 1) Lowest priority traffic is bounded to it's bandwidth (currently set at > 80%), so it cannot borrow more bandwidth from it's sibling classes. This > seems to help greatly with higher priority services getting through much > faster, without greatly taking away from the bandwidth available for the > lowest priority traffic. > > 2) It now works for multiple interfaces. The settings are in the format of > 1 config file per interface, typically named by the interface (although > this is not too important, any name will do). These files should typically > live in /etc/sysconfig/wshaper by default. The format is the usual shell > variable assignment format, i.e. variable=value. Value names/values are the > same as those at the top of the old Wonder Shaper script. Each interface is > set and checked to the specified values when the usual stop/status/start > commands are issued. > > 3) Note: I have commended out all the ingress shaping, because I run a > 2.2.x kernel which doesn't support ingress policing properly. To enable > this, simply uncomment the relevant lines in the wshaper script. > > The new wshaper script as well as a sample config file are both attached. I have some remarks on the wshaper. - The bandwidth parameter should reflect your real link bandwidth parameter. So it's 100mbit if the NIC is connected with 100Mbit to the router/switch/modem. Its _NOT_ the modem bandwidth. - The isolated parameter is not working and it can even disturb a cbq setup. So you better remove it from all cbq classes. - I miss the weight paramter. It's better to provide one if you add a class. Take weitht = rate / 10. Stef -- stef.coene@docum.org "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net
On Friday 30 May 2003 12:28 pm, Stef Coene wrote: > On Friday 30 May 2003 11:24, Gordan Bobic wrote: > > Hi, guys. > > > > I have tried emailing Bert with these updates, but he never got back to > > me, and I think this would be a genuinely useful addition to it's current > > feature set. :-) > > > > The featured improvements include: > > > > 1) Lowest priority traffic is bounded to it's bandwidth (currently set at > > 80%), so it cannot borrow more bandwidth from it's sibling classes. This > > seems to help greatly with higher priority services getting through much > > faster, without greatly taking away from the bandwidth available for the > > lowest priority traffic. > > > > 2) It now works for multiple interfaces. The settings are in the format > > of 1 config file per interface, typically named by the interface > > (although this is not too important, any name will do). These files > > should typically live in /etc/sysconfig/wshaper by default. The format is > > the usual shell variable assignment format, i.e. variable=value. Value > > names/values are the same as those at the top of the old Wonder Shaper > > script. Each interface is set and checked to the specified values when > > the usual stop/status/start commands are issued. > > > > 3) Note: I have commended out all the ingress shaping, because I run a > > 2.2.x kernel which doesn't support ingress policing properly. To enable > > this, simply uncomment the relevant lines in the wshaper script. > > > > The new wshaper script as well as a sample config file are both attached. > > I have some remarks on the wshaper. > - The bandwidth parameter should reflect your real link bandwidth > parameter. So it's 100mbit if the NIC is connected with 100Mbit to the > router/switch/modem. Its _NOT_ the modem bandwidth. huh? I thought rule 1 of traffic shaping was to take control of the traffic buffer. If you belch traffic at the modem and it cues there instead of your Linux box, how are you going to prioritize anything? > - The isolated parameter is not working and it can even disturb a cbq > setup. So you better remove it from all cbq classes. > - I miss the weight paramter. It's better to provide one if you add a > class. Take weitht = rate / 10. > > Stef
> > I have some remarks on the wshaper. > > - The bandwidth parameter should reflect your real link bandwidth > > parameter. So it's 100mbit if the NIC is connected with 100Mbit to the > > router/switch/modem. Its _NOT_ the modem bandwidth. > > huh? I thought rule 1 of traffic shaping was to take control of the > traffic buffer. If you belch traffic at the modem and it cues there > instead of your Linux box, how are you going to prioritize anything? The bandwidth parameter is used to calculate the idle time of the link. So sending 1mbit on a 10mbit link means 90% idle time. It has nothing to do with maximum of traffic you can send. Cbq needs also a valid allot and avpkt parameter for the same reason : to calculate the link idle time of the NIC. Limiting the total traffic is done with the bounded 1:1 class attached to the root qdisc. Stef -- stef.coene@docum.org "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net