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
~                                                                            
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章