Last active
January 16, 2017 12:32
-
-
Save Pierozi/4bd87e60bd9651ac026e13c4f95ba5ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| RATE=5 | |
| CEIL=1 | |
| echo -e "Clean rules" | |
| /sbin/tc qdisc del dev eth0 root | |
| echo -e "Turn on queueing discipline" | |
| /sbin/tc qdisc add dev eth0 root handle 1: htb default 15 | |
| echo -e "Rule class trafic shapping" | |
| /sbin/tc class add dev eth0 parent 1: classid 1:1 htb rate ${CEIL}mbit ceil ${CEIL}mbit | |
| /sbin/tc class add dev eth0 parent 1:1 classid 1:10 htb rate ${RATE}mbit ceil ${CEIL}mbit prio 0 | |
| echo -e "Attach class mark to protocol" | |
| /sbin/iptables -A OUTPUT -t mangle -p tcp -d 172.31.16.0/20 --sport 80 -j MARK --set-mark 10 | |
| echo -e "Apply limit" | |
| tc filter add dev eth0 parent 1:0 prio 0 protocol ip handle 10 fw flowid 1:10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment