Chinese translated version of Documentation/cgroups/net_cls
If you have any comment or update to the content, please contact the
original document maintainer directly. However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help. Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.
Chinese maintainer:Hu Feijun <935620544@qq.com>
---------------------------------------------------------------------
Documentation/cgroups/net_cls 的中文翻译
如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。
中文版维护者: 胡飞军 Hu Feijun <935620544@qq.com>
中文版翻译者: 胡飞军 Hu Feijun <935620544@qq.com>
中文版校译者: 胡飞军 Hu Feijun <935620544@qq.com>
以下为正文
Network classifier cgroup
-------------------------
网络分类器控制组
-------------------------
The Network classifier cgroup provides an interface to
tag network packets with a class identifier (classid).
网络分类器控制组提供了一个接口,通过这个接口可以给网络
数据包贴上类标识符(classid)。
The Traffic Controller (tc) can be used to assign
different priorities to packets from different cgroups.
流量控制器可以给来自不同控制组的数据包分配不同的优先权。
Creating a net_cls cgroups instance creates a net_cls.classid file.
This net_cls.classid value is initialized to 0.
创建net_cls cgroups实例后自动创建net_cls.classid文件。net_cls.classid的
初始值为0.
You can write hexadecimal values to net_cls.classid; the format for these
values is 0xAAAABBBB; AAAA is the major handle number and BBBB
is the minor handle number.
Reading net_cls.classid yields a decimal result.
你可以向net_cls.classid中写入十六进制的值,形式为 0xAAAABBBB;AAAA是主要
处理数据,BBBB是次要处理数据。
读net_cls.classid将产生一个十进制的结果。
Example:
mkdir /sys/fs/cgroup/net_cls
mount -t cgroup -onet_cls net_cls /sys/fs/cgroup/net_cls
mkdir /sys/fs/cgroup/net_cls/0
echo 0x100001 > /sys/fs/cgroup/net_cls/0/net_cls.classid
- setting a 10:1 handle.
cat /sys/fs/cgroup/net_cls/0/net_cls.classid
1048577
configuring tc:
tc qdisc add dev eth0 root handle 10: htb
tc class add dev eth0 parent 10: classid 10:1 htb rate 40mbit
- creating traffic class 10:1
tc filter add dev eth0 parent 10: protocol ip prio 10 handle 1: cgroup
例:
mkdir /sys/fs/cgroup/net_cls
mount -t cgroup -onet_cls net_cls /sys/fs/cgroup/net_cls
mkdir /sys/fs/cgroup/net_cls/0
echo 0x100001 > /sys/fs/cgroup/net_cls/0/net_cls.classid
- setting a 10:1 handle.
cat /sys/fs/cgroup/net_cls/0/net_cls.classid
1048577
配置 tc:
tc qdisc add dev eth0 root handle 10: htb
tc class add dev eth0 parent 10: classid 10:1 htb rate 40mbit
- creating traffic class 10:1
tc filter add dev eth0 parent 10: protocol ip prio 10 handle 1: cgroup