LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1108|回复: 1

如何将带宽限制到64kbps?

[复制链接]
发表于 2006-5-15 14:12:44 | 显示全部楼层 |阅读模式
在网上找了一个脚本,可以正确的限制带宽,但是当将其限制到64kbps时就出问题,错误提示:
  1. HTB: quantum of class 10001 is small.Consider r2q change.<4>HTB:quantum of class 10010 is small.Consider r2q change.<4>HTB:quantum of class 10020 is small.
复制代码

是不是限制的太小了?如果是这样,那么最小可以限制到多少呢?
大虾帮忙,谢谢
脚本代码:
  1. #!/bin/bash
  2. # The Ultimate Setup For Your Internet Connection At Home
  3. #
  4. #
  5. # Set the following values to somewhat less than your actual download
  6. # and uplink speed. In kilobits
  7. DOWNLINK=512
  8. UPLINK=512
  9. DEV=eth0
  10. # clean existing down- and uplink qdiscs, hide errors
  11. tc qdisc del dev $DEV root 2> /dev/null > /dev/null
  12. tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
  13. ###### uplink
  14. # install root HTB, point default traffic to 1:20:
  15. tc qdisc add dev $DEV root handle 1: htb default 20
  16. # shape everything at $UPLINK speed - this prevents huge queues in your
  17. # DSL modem which destroy latency:
  18. tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k
  19. # high prio class 1:10:
  20. tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \
  21. burst 6k prio 1
  22. # bulk & default class 1:20 - gets slightly less traffic,
  23. # and a lower priority:
  24. tc class add dev $DEV parent 1:1 classid 1:20 htb rate ${UPLINK}kbit \
  25. burst 6k prio 2
  26. # both get Stochastic Fairness:
  27. tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
  28. tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
  29. # TOS Minimum Delay (ssh, NOT scp) in 1:10:
  30. tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
  31. match ip tos 0x10 0xff flowid 1:10
  32. # ICMP (ip protocol 1) in the interactive class 1:10 so we
  33. # can do measurements & impress our friends:
  34. tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
  35. match ip protocol 1 0xff flowid 1:10
  36. # To speed up downloads while an upload is going on, put ACK packets in
  37. # the interactive class:

  38. tc filter add dev $DEV parent 1: protocol ip prio 10 u32 \
  39. match ip protocol 6 0xff \
  40. match u8 0x05 0x0f at 0 \
  41. match u16 0x0000 0xffc0 at 2 \
  42. match u8 0x10 0xff at 33 \
  43. flowid 1:10
  44. # rest is 'non-interactive' ie 'bulk' and ends up in 1:20
  45. ########## downlink #############
  46. # slow downloads down to somewhat less than the real speed to prevent
  47. # queuing at our ISP. Tune to see how high you can set it.
  48. # ISPs tend to have *huge* queues to make sure big downloads are fast
  49. #
  50. # attach ingress policer:
  51. tc qdisc add dev $DEV handle ffff: ingress
  52. # filter *everything* to it (0.0.0.0/0), drop everything that's
  53. # coming in too fast:
  54. tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
  55. 0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1
复制代码
 楼主| 发表于 2006-5-15 15:22:29 | 显示全部楼层
好像只是警告,不是错误
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表