QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 988|回复: 1

linux下流量控制(TC)中的police参数的意义?!

[复制链接]
发表于 2005-11-28 10:10:43 | 显示全部楼层 |阅读模式
tc filter add dev eth0 parent ffff: protocol ip prio 4 handle 1 fw police rate 1500Kbit burst 90k continue flowid 4:1

上面这一句是我从一个流量控制中的脚本中选出来的,对police rate 1500Kbit burst 90k 这一部分的意义不清楚,这句话是规定数据包过来进行整形满足rate 1500Kbit burst 90k,还是检测数据包流量是否超过rate 1500Kbit burst 90k?!

如果还有高人清楚flowid和TC中的另一个参数classid之间的区别以及上面代码中continue的意义也请告诉我一下

先在这谢过了。
 楼主| 发表于 2005-11-28 21:23:07 | 显示全部楼层
等了一天,没人回,自己的贴子,自己回吧。
continue
让这个过滤器不要匹配这个包,但是其它的过滤器可能会匹配它。
Police
This elemental mechanism is only used in Linux traffic control as part of a filter. A policer calls one action above and another action below the specified rate. Clever use of policers can simulate a three-color meter. See also Section 10.

Although both policing and shaping are basic elements of traffic control for limiting bandwidth usage a policer will never delay traffic. It can only perform an action based on specified criteria. See also Example 5.

Example 5. tc filter

[root@leander]# tc filter add               \
>                  dev eth0                 \
>                  parent 1:0               \
>                  protocol ip              \
>                  prio 5                   \
>                  u32                      \
>                  match ip port 22 0xffff  \
>                  match ip tos 0x10 0xff   \
>                  flowid 1:6               \
>                  police                   \
>                  rate 32000bps            \ (11)
>                  burst 10240              \ (12)
>                  mpu 0                    \ (13)
>                  action drop/continue       (14)
      



Add a filter. The verb could also be del.

Specify the device onto which we are attaching the new filter.

Specify the parent handle to which we are attaching the new filter.

This parameter is required. It's use should be obvious, although I don't know more.

The prio parameter allows a given filter to be preferred above another. The pref is a synonym.

This is a classifier, and is a required phrase in every tc filter command.

These are parameters to the classifier. In this case, packets with a type of service flag (indicating interactive usage) and matching port 22 will be selected by this statement.

The flowid specifies the handle of the target class (or qdisc) to which a matching filter should send its selected packets.

This is the policer, and is an optional phrase in every tc filter command.
(11)
The policer will perform one action above this rate, and another action below (see action parameter).
(12)
The burst is an exact analog to burst in HTB (burst is a buckets concept).
(13)
The minimum policed unit. To count all traffic, use an mpu of zero (0).
(14)
The action indicates what should be done if the rate based on the attributes of the policer. The first word specifies the action to take if the policer has been exceeded. The second word specifies action to take otherwise.
As evidenced above, the tc command line utility has an arcane and complex syntax, even for simple operations such as these examples show. It should come as no surprised to the reader that there exists an easier way to configure Linux traffic control. See the next section, Section 5.3.

上面这段英文是Traffic Control HOWTO中的原文,应该不难理解。
回复

使用道具 举报

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

本版积分规则

GMT+8, 2024-11-3 02:20 , Processed in 0.067992 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

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