一个tc流控的问题

最近在使用tc进行流量控制时遇到了一个问题,如下所示:


root@localhost:~# tc qdisc add dev eth0 root tbf rate 2000kbit latency 20ms buffer 1540
RTNETLINK answers: No such file or directory

    不知道如何解决;在网上搜索,有的说是要加上sch_netem模块,有的说要加上cls_u32模块;于是把这sch_netem编进内核,测试发现没有有改善;编译cls_u32时,发生编译错误!

     又在网上搜索,发现http://svana.org/kleptog/Packet-Shaping-HOWTO.txt这个连接不错,上面说:

'tc' can be a fairly hard to use program. The user space generally does a 
  little bit of syntax checking and then sends it to the kernel. The kernel
  sends only a single integer back indicating success or failure. So unless you
  made a spelling mistake, your errors will generally be of the form:

  RTNETLINK answers: No such file or directory
  RTNETLINK answers: File exists
  RTNETLINK answers: Invalid argument

  The first generally means you referenced a handle that does not exist. The second
  generally means to tried to add something where the handle was already in use.
  The last is the catch-all error that generally means "Something went wrong".
  There is usually no indication of what and generally only much re-reading of
  help and trial-and-error will help you here. Part of the reason for writing
  this document is to save you such agony.

这里面的 The first generally means you referenced a handle that does not exist.当时也没有让我产生什么想法;

在编辑sched的makefile时忽然发现了下面这样

  obj-$(CONFIG_NET_SCH_TBF)      += sch_tbf.o

马上联系联想到了tc命令行中的 tbf,于是将上面一行改为

  obj-y     += sch_tbf.o

编译后,更新到设备,再次测试,发现tc命令执行成功!

这时又想起前面连接中的那句话:

 The first generally means you referenced a handle that does not exist.

到这里才恍然大悟,执行:tc qdisc add dev rmnet0 root tbf rate 2000kbit latency 20ms buffer 1540
报错:RTNETLINK answers: No such file or directory

的原因是tbf模块模块没有加载,就这么简单;tc返回的错误提示过于简单,其实完全可以提示tbf为找到。

所以以后在排查问题时,要把输入的参数和输出的错误信息结合起来,单靠出错信息是不够的;

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值