Advertisement
teknoraver

uid shaper

Dec 23rd, 2014
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.45 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. user=debian-transmission
  4. rate=200kbit
  5. mark=128
  6. dev=$(ip r |awk '/^default/{print$5}')
  7.  
  8. iptables -F
  9. tc qdisc del dev $dev root 2>/dev/null
  10.  
  11. [ "$1" = stop ] && exit 0
  12.  
  13. iptables -A OUTPUT -m owner --uid-owner $user -j MARK --set-mark $mark
  14.  
  15. tc qdisc add dev $dev root handle 1:0 htb default 1
  16. tc class add dev $dev parent 1:0 classid 1:10 htb rate $rate burst 5kb prio 0
  17. tc filter add dev $dev parent 1:0 prio 0 handle $mark fw flowid 1:10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement