TC脚本简单小计

 最近公司做了个***项目 发现服务器的流量啥的 还有用户猛力下载 好吧 我的任务是限制速度 技术不行 找了点资料写了如下的脚本 忘大师给我点资料 我好完善下

#!/bin/bash
tc qdisc add dev eth0 root handle 1: htb r2q 1
tc class add dev eth0 parent 1: classid 1:1 htb rate 560kbit burst 10k
tc class add dev eth0 parent 1: classid 1:2 htb rate 3000kbit burst 10k
tc filter add dev eth0 parent 1: protocol ip prio 16 u32 match ip dst 10.17.0.0/16 flowid 1:1
tc filter add dev eth0 parent 1: protocol ip prio 16 u32 match ip dst 10.18.0.0/16 flowid 1:1
tc filter add dev eth0 protocol ip parent 1:0 prio 0 u32 match ip sport 80 0xffff flowid 1:2
tc filter add dev eth0 protocol ip parent 1:0 prio 0 u32 match ip sport 21 0xffff flowid 1:2
tc filter add dev eth0 protocol ip parent 1:0 prio 0 u32 match ip sport 22 0xffff flowid 1:2
tc filter add dev eth0 protocol ip parent 1:0 prio 0 u32 match ip sport 53 0xffff flowid 1:2
tc filter add dev eth0 protocol ip parent 1:0 prio 0 u32 match ip sport 8080 0xffff flowid 1:2
~                                                                            
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章