Created
April 4, 2012 19:03
-
-
Save Sen/2304789 to your computer and use it in GitHub Desktop.
dd-wrt qos script
This file contains 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
iptables -t mangle -F | |
iptables -t mangle -X | |
#download | |
tc qdisc del dev br0 root | |
tc qdisc add dev br0 root handle 1: htb default 20 | |
# download | |
# level 1 | |
tc class add dev br0 parent 1: classid 1:1 htb rate 1600kbit # max download speed | |
# level 2 | |
tc class add dev br0 parent 1:1 classid 1:10 htb rate 400kbit ceil 1600kbit prio 0 | |
tc class add dev br0 parent 1:1 classid 1:20 htb rate 400kbit ceil 1200kbit prio 1 | |
tc class add dev br0 parent 1:1 classid 1:30 htb rate 100kbit ceil 800kbit prio 2 | |
tc qdisc add dev br0 parent 1:10 handle 10: sfq perturb 10 | |
tc qdisc add dev br0 parent 1:20 handle 20: sfq perturb 10 | |
tc qdisc add dev br0 parent 1:30 handle 30: sfq perturb 10 | |
tc filter add dev br0 parent 1:10 prio 0 protocol ip handle 10 fw flowid 1:10 | |
tc filter add dev br0 parent 1:20 prio 1 protocol ip handle 20 fw flowid 1:20 | |
tc filter add dev br0 parent 1:30 prio 2 protocol ip handle 30 fw flowid 1:30 | |
iptables -t mangle -A POSTROUTING -p tcp -m tcp --sport 80 -j MARK --set-mark 10 | |
iptables -t mangle -A POSTROUTING -p tcp -m tcp --sport 80 -j RETURN | |
iptables -t mangle -A POSTROUTING -m layer7 --l7proto ssh -j mark --set-mark 10 | |
iptables -t mangle -A POSTROUTING -m layer7 --l7proto ssh -j RETURN | |
iptables -t mangle -A POSTROUTING -d 192.168.1.146 -j MARK --set-mark 30 | |
iptables -t mangle -A POSTROUTING -d 192.168.1.146 -j RETURN | |
#upload | |
tc qdisc del dev ppp0 root | |
tc qdisc add dev ppp0 root handle 1: htb default 20 | |
# level 1 | |
tc class add dev ppp0 parent 1: classid 1:1 htb rate 512kbps | |
# level 2 | |
tc class add dev ppp0 parent 1:1 classid 1:10 htb rate 300kbps ceil 40kbps prio 0 | |
tc class add dev ppp0 parent 1:1 classid 1:20 htb rate 150kbps ceil 270kbps prio 1 | |
tc class add dev ppp0 parent 1:1 classid 1:30 htb rate 30kbps ceil 120kbps prio 2 | |
tc qdisc add dev ppp0 parent 1:10 handle 10: sfq perturb 10 | |
tc qdisc add dev ppp0 parent 1:20 handle 20: sfq perturb 10 | |
tc qdisc add dev ppp0 parent 1:30 handle 30: sfq perturb 10 | |
tc filter add dev ppp0 parent 1:0 prio 0 protocol ip handle 10 fw flowid 1:10 | |
tc filter add dev ppp0 parent 1:0 prio 0 protocol ip handle 20 fw flowid 1:20 | |
tc filter add dev ppp0 parent 1:0 prio 0 protocol ip handle 30 fw flowid 1:30 | |
iptables -t mangle -A PREROUTING -p tcp -m tcp --dport 80 -j MARK --set-mark 10 | |
iptables -t mangle -A PREROUTING -p tcp -m tcp --dport 80 -j RETURN | |
iptables -t mangle -A PREROUTING -m layer7 --l7proto ssh -j mark --set-mark 10 | |
iptables -t mangle -A PREROUTING -m layer7 --l7proto ssh -j RETURN | |
iptables -t mangle -A PREROUTING -s 192.168.1.146 -j MARK --set-mark 30 | |
iptables -t mangle -A PREROUTING -s 192.168.1.146 -j RETURN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment