当前位置: 技术问答>linux和unix
请教一Linux內核自帶的網絡发包工具: pktgen 的問題
来源: 互联网 发布时间:2016-02-25
本文导语: 主題: 使用Linux內核自帶的網絡发包工具:pktgen 时,發現以下問題: SuSE9:/bin # ./ipg FATAL: Module pg3 not found. ./ipg: line 8: /proc/net/pg: No such file or directory cat: /proc/net/pg: No such file or directory cat: /proc/net/pg: No s...
主題: 使用Linux內核自帶的網絡发包工具:pktgen 时,發現以下問題:
SuSE9:/bin # ./ipg
FATAL: Module pg3 not found.
./ipg: line 8: /proc/net/pg: No such file or directory
cat: /proc/net/pg: No such file or directory
cat: /proc/net/pg: No such file or directory
./ipg: line 8: /proc/net/pg: No such file or directory
cat: /proc/net/pg: No such file or directory
cat: /proc/net/pg: No such file or directory
查了下,由於/proc目錄是被保護目錄,即使root对它有write權限,也不能write。
問題:请问高手,遇到以上問題该如何處理?
SuSE9:/bin # ./ipg
FATAL: Module pg3 not found.
./ipg: line 8: /proc/net/pg: No such file or directory
cat: /proc/net/pg: No such file or directory
cat: /proc/net/pg: No such file or directory
./ipg: line 8: /proc/net/pg: No such file or directory
cat: /proc/net/pg: No such file or directory
cat: /proc/net/pg: No such file or directory
查了下,由於/proc目錄是被保護目錄,即使root对它有write權限,也不能write。
問題:请问高手,遇到以上問題该如何處理?
|
net/core/pktgen.c内核数据包生成器及其说明文档
How to use the Linux packet generator module.
1. Enable CONFIG_NET_PKTGEN to compile and build pktgen.o, install it
in the place where insmod may find it.
2. Cut script "ipg" (see below).
3. Edit script to set preferred device and destination IP address.
4. Run in shell: ". ipg"
5. After this two commands are defined:
A. "pg" to start generator and to get results.
B. "pgset" to change generator parameters. F.e.
pgset "multiskb 1" use multiple SKBs for packet generation
pgset "multiskb 0" use single SKB for all transmits
pgset "pkt_size 9014" sets packet size to 9014
pgset "frags 5" packet will consist of 5 fragments
pgset "count 200000" sets number of packets to send
pgset "ipg 5000" sets artificial gap inserted between packets
to 5000 nanoseconds
pgset "dst 10.0.0.1" sets IP destination address
(BEWARE! This generator is very aggressive!)
pgset "dstmac 00:00:00:00:00:00" sets MAC destination address
pgset stop aborts injection
Also, ^C aborts generator.
---- cut here
#! /bin/sh
modprobe pktgen.o
function pgset() {
local result
echo $1 > /proc/net/pg
result=`cat /proc/net/pg | fgrep "Result: OK:"`
if [ "$result" = "" ]; then
cat /proc/net/pg | fgrep Result:
fi
}
function pg() {
echo inject > /proc/net/pg
cat /proc/net/pg
}
pgset "odev eth0"
pgset "dst 0.0.0.0"
---- cut here
=========================================================
把CONFIG_NET_PKTGEN加到内核里试试看..
How to use the Linux packet generator module.
1. Enable CONFIG_NET_PKTGEN to compile and build pktgen.o, install it
in the place where insmod may find it.
2. Cut script "ipg" (see below).
3. Edit script to set preferred device and destination IP address.
4. Run in shell: ". ipg"
5. After this two commands are defined:
A. "pg" to start generator and to get results.
B. "pgset" to change generator parameters. F.e.
pgset "multiskb 1" use multiple SKBs for packet generation
pgset "multiskb 0" use single SKB for all transmits
pgset "pkt_size 9014" sets packet size to 9014
pgset "frags 5" packet will consist of 5 fragments
pgset "count 200000" sets number of packets to send
pgset "ipg 5000" sets artificial gap inserted between packets
to 5000 nanoseconds
pgset "dst 10.0.0.1" sets IP destination address
(BEWARE! This generator is very aggressive!)
pgset "dstmac 00:00:00:00:00:00" sets MAC destination address
pgset stop aborts injection
Also, ^C aborts generator.
---- cut here
#! /bin/sh
modprobe pktgen.o
function pgset() {
local result
echo $1 > /proc/net/pg
result=`cat /proc/net/pg | fgrep "Result: OK:"`
if [ "$result" = "" ]; then
cat /proc/net/pg | fgrep Result:
fi
}
function pg() {
echo inject > /proc/net/pg
cat /proc/net/pg
}
pgset "odev eth0"
pgset "dst 0.0.0.0"
---- cut here
=========================================================
把CONFIG_NET_PKTGEN加到内核里试试看..