This commit is contained in:
Christoph Wiechert
2017-04-23 13:41:29 +02:00
commit 30d6918b83
42 changed files with 2018 additions and 0 deletions

18
tmp/scripts/traffic-limit.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
# http://www.codeoriented.com/how-to-limit-network-bandwidth-for-a-specific-tcp-port-on-ubuntu-linux/
IF=$2
BAND=$1
PORT=$3
if [ -z "$3" ] ; then
echo $0 10kbps wlan0 8080
exit 1
fi
tc qdisc del root dev $IF
tc qdisc add dev $IF root handle 1:0 htb default 10
tc class add dev $IF parent 1:0 classid 1:10 htb rate $BAND prio 0
tc filter add dev $IF parent 1:0 prio 0 protocol ip u32 match ip protocol 4 0xff match ip dport $PORT 0xffff flowid 1:10
tc qdisc show dev $IF