From: root Date: Tue, 26 Jan 2010 10:24:35 +0000 (+0200) Subject: added tc test script X-Git-Tag: getopt_long~208 X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=8e71ead1335c334254fda5ba481fb50fe028464c;p=cs-p2p-next.git added tc test script --- diff --git a/scripts/tc.sh b/scripts/tc.sh new file mode 100755 index 0000000..557c3eb --- /dev/null +++ b/scripts/tc.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +if test $# -ne 1; then + echo "Usage: $0 u|d|f" + exit 1 +fi + +case "$1" in + "d") + tc qdisc add dev venet0 root handle 1: htb default 90 + tc class add dev venet0 parent 1: classid 1:1 htb rate 1000mbit + tc class add dev venet0 parent 1:1 classid 1:10 htb rate 128kbit ceil 128kbit + tc qdisc add dev venet0 parent 1:10 handle 10: sfq perturb 10 + tc filter add dev venet0 parent 1:0 protocol ip u32 match ip dst 172.16.10.1/32 match ip sport 80 0xffff flowid 1:10 + ;; + "u") + tc qdisc add dev eth1 root handle 1: htb default 90 + tc class add dev eth1 parent 1: classid 1:1 htb rate 1000mbit + tc class add dev eth1 parent 1:1 classid 1:10 htb rate 128kbit ceil 128kbit + tc qdisc add dev eth1 parent 1:10 handle 10: sfq perturb 10 + tc filter add dev eth1 parent 1:0 protocol ip u32 match ip dport 22 0xffff flowid 1:10 +# tc filter add dev eth1 parent 1:0 protocol ip u32 match ip src 172.16.10.1/32 flowid 1:10 + ;; + "f") + tc qdisc del dev venet0 root handle 1: + tc qdisc del dev eth1 root handle 1: + ;; + *) + echo "Usage: $0 u|d|f" + ;; +esac