网络(1)tc 相关

本文深入探讨了Linux中net_cls子系统的工作原理,该子系统通过为来自不同控制组(cgroup)的网络数据包标记类别标识符(classid),使流量控制器(tc)能够识别并为这些数据包分配不同的优先级。文章详细解释了classid的格式及其在net_cls.classid文件中的应用,并提供了设置示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. net_cls
    The net_cls subsystem tags network packets with a class identifier (classid) that allows the Linux traffic controller (tc) to identify packets originating from a particular cgroup. The traffic controller can be configured to assign different priorities to packets from different cgroups.
    net_cls.classid
    net_cls.classid contains a single value that indicates a traffic control handle. The value of classid read from the net_cls.classid file is presented in the decimal format while the value to be written to the file is expected in the hexadecimal format. For example, 0x100001 represents the handle conventionally written as 10:1 in the format used by the ip utility. In the net_cls.classid file, it would be represented by the number 1048577.
    The format for these handles is: 0xAAAABBBB, where AAAA is the major number in hexadecimal and BBBB is the minor number in hexadecimal. You can omit any leading zeroes; 0x10001 is the same as 0x00010001, and represents 1:1. The following is an example of setting a 10:1 handle in the net_cls.classid file:
~]# echo 0x100001 > /cgroup/net_cls/red/net_cls.classid
~]# cat /cgroup/net_cls/red/net_cls.classid
1048577

Refer to the man page for tc to learn how to configure the traffic controller to use the handles that the net_cls adds to network packets.

参考文档
redhat document

转载于:https://www.cnblogs.com/linengier/p/11105633.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值