Linux RTNETLINK 回答:没有此类文件或目录错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9513981/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 04:55:43  来源:igfitidea点击:

RTNETLINK answers :No such file or directory error

linux

提问by kalpan bhargav

1. ETH=
2. LATENCY=
3. LOSS=
4. JITTER=
5. BW=
6. sudo /sbin/tc qdisc del dev eth0 root
7. sudo /sbin/tc qdisc add dev eth0 root handle 1: netem delay $LATENCY $JITTER 
8. sudo /sbin/tc qdisc add dev eth0 parent 1:1 handle 10: netem loss $LOSS
9. sudo /sbin/tc qdisc add dev eth0 parent 10:1 handle 20: htb default 1
10.sudo /sbin/tc class add dev eth0 parent 20: classid 0:1 htb rate $BW ceil $BW
11.sudo /sbin/tc qdisc show

The above code results in:

上面的代码导致:

RTNETLINK answers :No such file or directory

error on line 8,9,10 upon execution.

执行时第 8、9、10 行出现错误。

回答by Kimvais

Your handles and parent handles don't match. e.g change to:

您的句柄和父句柄不匹配。例如更改为:

7. sudo /sbin/tc qdisc add dev eth0 root handle 1:1 netem delay $LATENCY $JITTER 
8. sudo /sbin/tc qdisc add dev eth0 parent 1:1 handle 10:1 netem loss $LOSS
9. sudo /sbin/tc qdisc add dev eth0 parent 10:1 handle 20:1 htb default 1
10.sudo /sbin/tc class add dev eth0 parent 20:1 classid 0:1 htb rate $BW ceil $BW

and it should work.

它应该工作。

回答by David Dombrowsky

The problem is with missing kernel modules and/or kernel support. Make sure you can run

问题在于缺少内核模块和/或内核支持。确保你可以运行

modprobe sch_netem

I also had to rebuild the kernel after I enabled because there's something built-in that is enabled after you enable network emulation.

我还必须在启用后重建内核,因为启用网络仿真后会启用一些内置功能。

See also http://forums.fedoraforum.org/showthread.php?t=285408and http://www.linuxfoundation.org/collaborate/workgroups/networking/netem

另见http://forums.fedoraforum.org/showthread.php?t=285408http://www.linuxfoundation.org/collaborate/workgroups/networking/netem

回答by rashok

RTNETLINK answers :No such file or directorycomes for 2 reason.

RTNETLINK answers :No such file or directory有两个原因。

  • Executing tc qdiscwith wrong options
  • Or Kernel module sch_netemis missing
  • 执行tc qdisc错误的选项
  • 或者sch_netem缺少内核模块

So check first sch_netemis installed in your machine by using command lsmod -l. If it is missing install using command modprobe sch_netem.

因此,首先sch_netem使用命令检查是否已安装在您的机器上lsmod -l。如果缺少使用命令安装modprobe sch_netem

Even after installing sch_netem, if you get this same error means you are executing with wrong option. For example you can add a impairment on a network interface using ip qdisc add dev .... Similarly for removing this you can do ip qdisc delete dev.... If you are trying to delete an impairment without any prior add means, then also you get this error. And also for wrong options also you get this error.

即使在安装 sch_netem 之后,如果您遇到同样的错误,也意味着您正在使用错误的选项执行。例如,您可以使用 对网络接口添加损伤ip qdisc add dev ...。同样,您可以删除它ip qdisc delete dev...。如果您在没有任何事先添加方法的情况下尝试删除损伤,那么您也会收到此错误。而且对于错误的选项,您也会收到此错误。

回答by user1928764

I am running Fedora Core 27. In order to get the module installed, I had to use

我正在运行 Fedora Core 27。为了安装模块,我不得不使用

sudo dnf install install kernel-modules-extra

That's not intuitively obvious.

这在直觉上并不明显。