Documentation/cgroups/net_cls

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值