我想在 Ubuntu Server 上启用并使用 pktgen 模块。我已通过在 /etc/modules 文件中添加包含“pktgen”的行来启用该模块。重新启动后,似乎模块已成功加载,因为目录 /proc/net/pktgen 存在。
然而,当尝试运行第一个样本我收到这些错误:
root@ubuntu:~# bash ./pktgen.conf-1-1
Removing all devices
Adding eth4
Setting max_before_softirq 10000
Configuring /proc/net/pktgen/eth4
./pktgen.conf-1-1: line 9: /proc/net/pktgen/eth4: No such file or directory
cat: /proc/net/pktgen/eth4: No such file or directory
cat: /proc/net/pktgen/eth4: No such file or directory
./pktgen.conf-1-1: line 9: /proc/net/pktgen/eth4: No such file or directory
cat: /proc/net/pktgen/eth4: No such file or directory
cat: /proc/net/pktgen/eth4: No such file or directory
./pktgen.conf-1-1: line 9: /proc/net/pktgen/eth4: No such file or directory
cat: /proc/net/pktgen/eth4: No such file or directory
cat: /proc/net/pktgen/eth4: No such file or directory
./pktgen.conf-1-1: line 9: /proc/net/pktgen/eth4: No such file or directory
cat: /proc/net/pktgen/eth4: No such file or directory
cat: /proc/net/pktgen/eth4: No such file or directory
./pktgen.conf-1-1: line 9: /proc/net/pktgen/eth4: No such file or directory
cat: /proc/net/pktgen/eth4: No such file or directory
cat: /proc/net/pktgen/eth4: No such file or directory
./pktgen.conf-1-1: line 9: /proc/net/pktgen/eth4: No such file or directory
cat: /proc/net/pktgen/eth4: No such file or directory
cat: /proc/net/pktgen/eth4: No such file or directory
Running... ctrl^C to stop
Done
事实证明,该脚本根本无法将文件写入 /proc/net/pktgen 目录。当我手动尝试时,它也会失败:
root@ubuntu:~# cd /proc/net/pktgen/
root@ubuntu:/proc/net/pktgen# touch eth4
touch: cannot touch `eth4': No such file or directory
有人能帮助我让它工作吗?
我正在使用的 Ubuntu 版本:2.6.32-21-server。
固定的
我很抱歉没有及时更新这篇文章。我已经修复了它。如果我没记错的话,错误原因是 eth4 不存在,或者没有“在线”状态。
无论如何,现在已经修复。
答案1
eth4 存在吗?pktgen 不会创建接口。
答案2
执行 sudo bash ./pktgen.conf-1-1