-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmicrolimit.sh
More file actions
executable file
·32 lines (27 loc) · 847 Bytes
/
Copy pathmicrolimit.sh
File metadata and controls
executable file
·32 lines (27 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
set -o xtrace
IF="wlp3s0"
LIMIT="10000kbit"
BURST="100kbit"
PORT="80"
echo "resetting tc"
tc qdisc del dev ${IF} root
tc qdisc del dev ${IF} ingress
echo "setting tc"
tc qdisc add dev ${IF} handle ffff: ingress
#tc filter add dev ${IF} parent ffff: protocol ip prio 1 \
# u32 match ip dport ${PORT} 0xffff police rate ${LIMIT} \
# burst $BURST flowid :1
#tc filter add dev ${IF} parent ffff: protocol ip prio 1 \
# u32 match ip sport ${PORT} 0xffff police rate ${LIMIT} \
# burst $BURST flowid :1
tc filter add dev ${IF} parent ffff: \
protocol ip prio 1 \
u32 match ip dport ${PORT} 0xffff \
police rate ${LIMIT} burst $BURST drop \
flowid :1
tc filter add dev ${IF} parent ffff: \
protocol ip prio 1 \
u32 match ip sport ${PORT} 0xffff \
police rate ${LIMIT} burst $BURST drop \
flowid :1