雨中的雨 发表于 2005-11-28 09:58:07

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

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 10:09 编辑 ]

雨中的雨 发表于 2005-11-28 21:19:42

等了一天,没人回,自己的贴子,自己回吧。
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

# 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中的原文,应该不难理解。

zhou_qz 发表于 2005-11-29 16:27:29

faint!!

DreamCat 发表于 2005-11-29 16:59:20

police rate 1500Kbit burst 90k
rate 1500Kbit 设定 封包传输速率;
burst 90k 设定 突发速率。
相关的还有个 ceil。设定上限。

建议你阅读 LARTC 中文版~。
页: [1]
查看完整版本: linux下流量控制(TC)中的police参数的意义?!