其他分享
首页 > 其他分享> > tc qos 限速上传/下载

tc qos 限速上传/下载

作者:互联网

 1 #!/bin/sh
 2 
 3 qos_stop() {
 4     tc qdisc del dev ifb0 ingress
 5     tc qdisc del dev ifb0 root
 6     tc qdisc del dev br-lan ingress
 7     tc qdisc del dev br-lan root
 8 }
 9 
10 qos_start() {
11     #init
12     ifconfig ifb0 up
13     tc qdisc add dev br-lan root handle 1: htb r2q 1
14     tc qdisc add dev br-lan ingress
15     tc filter add dev br-lan parent ffff: protocol ip u32 match u32 0 0 action mirred egress redirect dev ifb0
16     tc qdisc add dev ifb0 root handle 1: htb r2q 1
17 
18     # 限速 下载500K, id 1:1
19     tc class add dev br-lan parent 1: classid 1:1 htb rate 4000kbit ceil 4000kbit prio 2
20     tc filter add dev br-lan parent 1: protocol ip u32 match ip dst 192.168.2.176 flowid 1:1
21 
22     # 限速 上传500K, id 1:4
23     tc class add dev ifb0 parent 1:1 classid 1:4 htb rate 4000kbit
24     tc filter add dev ifb0 protocol ip parent 1:0 prio 2 u32 match ip src 192.168.2.176 flowid 1:4
25 }

 

标签:lan,qos,ifb0,限速,dev,add,br,tc
来源: https://www.cnblogs.com/listenerln/p/16131717.html