对LINUX服务器网卡进行带宽限制的办法:

对LINUX服务器网卡进行带宽限制的办法:

1、安装iproute
yum -y install iproute

2、限制eth0网卡的带宽为100kbit:
/sbin/tc qdisc add dev eth0 root tbf rate 500kbit latency 50ms burst 15kb

  3、解除eth0网卡的带宽限制:
/sbin/tc qdisc del dev eth0 root tbf

      4、列出已有的策略:

tc -s qdisc ls dev eth0

  5、启动时自动加载带宽限制策略:

vim /etc/rc.local

加入: /sbin/tc qdisc add dev eth0 root tbf rate 500kbit latency 50ms burst 15kb

 参考资料:http://www.cyberciti.biz/faq/linux-traffic-shaping-using-tc-to-control-http-traffic/

PS:转载请注明出处,谢谢!

Leave a Reply

Your email address will not be published.