|
IP="192.168.2.144"
AvangeDownLoadSpeed="1000kbit"
MaxDownLoadSpeed="1000kbit"
AvangeUpLoadSpeed="50kbit"
MaxUpLoadSpeed="50kbit"
tc qdisc del dev br0 root
tc qdisc add dev br0 root handle 1: htb
tc class add dev br0 parent 1:0 classid 1:1 htb rate 5120kbit
tc class add dev br0 parent 1:1 classid 1:10 htb rate $AvangeDownLoadSpeed ceil $MaxDownLoadSpeed prio 2
tc filter add dev br0 parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:10
iptables -t mangle -A POSTROUTING -d $ IP -j MARK --set-mark 10
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1:0 classid 1:1 htb rate 100kbit
tc class add dev eth0 parent 1:1 classid 1:10 htb rate $AvangeUpLoadSpeed ceil $MaxUpLoadSpeed prio 2
tc filter add dev eth0 parent 1:0 prio 2 protocol ip handle 11 fw flowid 1:10
iptables -t mangle -A PREROUTING -s $IP -j MARK --set-mark 11
附上我自己写的脚本,保存为防火墙命令 |
|