ham*_*dsh 1 networking linux bandwidth traffic-shaping
对于流量管理应用程序,我应该限制客户端 ip 地址的带宽,每个 ip 都有不同的限制
如何将 tc-tbf 用于特定的 IP 地址
还是有其他解决方案?
小智 6
为了限制单个IP地址的带宽,我用HTB做过TC。以下是一些有用的链接:
举一个简单的例子,为了限制存储在 CLIENT_IP shell 变量中的单个 IP 地址的带宽,限制如下:
下面的命令就足够了:
tc qdisc add dev eth0 root handle 1: htb default 10
tc class add dev eth0 parent 1: classid 1:1 htb rate 1000kbps ceil 1500kbps
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 1kbps ceil 2kbps
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 100kbps ceil 200kbps
tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip src ${CLIENT_IP} flowid 1:11
Run Code Online (Sandbox Code Playgroud)