pktgen使用文档文档格式.docx

上传人:b****3 文档编号:8117082 上传时间:2023-05-10 格式:DOCX 页数:22 大小:34.90KB
下载 相关 举报
pktgen使用文档文档格式.docx_第1页
第1页 / 共22页
pktgen使用文档文档格式.docx_第2页
第2页 / 共22页
pktgen使用文档文档格式.docx_第3页
第3页 / 共22页
pktgen使用文档文档格式.docx_第4页
第4页 / 共22页
pktgen使用文档文档格式.docx_第5页
第5页 / 共22页
pktgen使用文档文档格式.docx_第6页
第6页 / 共22页
pktgen使用文档文档格式.docx_第7页
第7页 / 共22页
pktgen使用文档文档格式.docx_第8页
第8页 / 共22页
pktgen使用文档文档格式.docx_第9页
第9页 / 共22页
pktgen使用文档文档格式.docx_第10页
第10页 / 共22页
pktgen使用文档文档格式.docx_第11页
第11页 / 共22页
pktgen使用文档文档格式.docx_第12页
第12页 / 共22页
pktgen使用文档文档格式.docx_第13页
第13页 / 共22页
pktgen使用文档文档格式.docx_第14页
第14页 / 共22页
pktgen使用文档文档格式.docx_第15页
第15页 / 共22页
pktgen使用文档文档格式.docx_第16页
第16页 / 共22页
pktgen使用文档文档格式.docx_第17页
第17页 / 共22页
pktgen使用文档文档格式.docx_第18页
第18页 / 共22页
pktgen使用文档文档格式.docx_第19页
第19页 / 共22页
pktgen使用文档文档格式.docx_第20页
第20页 / 共22页
亲,该文档总共22页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

pktgen使用文档文档格式.docx

《pktgen使用文档文档格式.docx》由会员分享,可在线阅读,更多相关《pktgen使用文档文档格式.docx(22页珍藏版)》请在冰点文库上搜索。

pktgen使用文档文档格式.docx

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

[root@localhostpktgen]#ifconfigeth1

eth5Linkencap:

EthernetHWaddr00:

0C:

29:

97:

9B:

B4

inetaddr:

192.168.1.95Bcast:

192.168.1.255Mask:

255.255.255.0

inet6addr:

fe80:

:

20c:

29ff:

fe97:

9bb4/64Scope:

Link

UPBROADCASTRUNNINGMULTICASTMTU:

1500Metric:

RXpackets:

15044140errors:

0dropped:

0overruns:

0frame:

TXpackets:

14210498errors:

0carrier:

collisions:

0txqueuelen:

1000

RXbytes:

903846363(861.9MiB)TXbytes:

852636332(813.1MiB)

[root@localhostpktgen]# 

ifconfigeth2

eth6Linkencap:

BE

192.168.1.96Bcast:

9bbe/64Scope:

14256340errors:

14998657errors:

856589260(816.9MiB)TXbytes:

899925597(858.2MiB)

ethtooleth1

Settings 

foreth5:

Supportedports:

[TP]

Supportedlinkmodes:

10baseT/Half10baseT/Full

100baseT/Half100baseT/Full

1000baseT/Full

Supportsauto-negotiation:

Yes

Advertisedlinkmodes:

1000baseT/Full

Advertisedpauseframeuse:

No

Advertisedauto-negotiation:

Speed:

1000Mb/s

Duplex:

Full

Port:

TwistedPair

PHYAD:

Transceiver:

internal

Auto-negotiation:

on

MDI-X:

Unknown

SupportsWake-on:

d

Wake-on:

Currentmessagelevel:

0x00000007(7)

Linkdetected:

yes

ethtooleth2

foreth6:

[root@localhostpktgen]#

步骤2)查看两个网口的中断号,并把eth1/eth2做亲和性绑定到特定的cpu.

注意:

先关闭系统的irqbalance服务

[root@localhost~]# 

cat/proc/interrupts|grepeth

16:

258654013515884172554IO-APIC-fasteoiEnsoniqAudioPCI,eth1

19:

51171949714609806040IO-APIC-fasteoieth4,eth2

#说明:

16和19表示的是eth1和eth2的中断号

/etc/init.d/irqbalancestop 

Stoppingirqbalance:

[OK]

#使用上面的命令停止irqbalance服务后,下面的语句就是绑定特定的cpu了:

cpu的值对应关系如下:

BinaryHex

CPU0000000011

CPU1000000102

CPU2000001004

CPU3000010008

例如:

如果我想把IRQ绑定到CPU2上就是00000100=4:

echo4>

/proc/irq/19/smp_affinity

[root@localhost~]#echo8>

/proc/irq/16/smp_affinity

[root@localhost~]#cat/proc/irq/19/smp_affinity

04

[root@localhost~]#cat/proc/irq/16/smp_affinity

08

步骤3)在PC机上运行pktgen测试脚本:

脚本1:

2个网口(eth1/eth2))双向对发脚本.(即GWN7000的LAN1和LAN5之间双向对发数据测试)

#!

/bin/sh

#FileName:

pktgen-eth1-eth2.conf

#modprobepktgen

pgset(){

localresult

echo$1>

$PGDEV

result=`cat$PGDEV|fgrep"

Result:

OK:

"

`

if["

$result"

="

];

then

cat$PGDEV|fgrepResult:

fi

}

pg(){

echoinject>

cat$PGDEV

#ConfigStartHere-----------------------------------------------------------

#threadconfig

#EachCPUhasownthread.TwoCPUexammple.Weaddeth1,eth2respectivly.

PGDEV=/proc/net/pktgen/kpktgend_2

echo"

Removingalldevices"

pgset"

rem_device_all"

Addingeth1"

add_deviceeth1"

PGDEV=/proc/net/pktgen/kpktgend_3

Addingeth2"

add_deviceeth2"

#deviceconfig

#delay0meansmaximumspeed.

CLONE_SKB="

clone_skb1000000"

#NICadds4bytesCRC

PKT_SIZE="

pkt_size60"

#COUNT0meansforever

#COUNT="

count0"

COUNT="

DELAY="

delay0"

PGDEV=/proc/net/pktgen/eth1

Configuring$PGDEV"

$COUNT"

$CLONE_SKB"

$PKT_SIZE"

$DELAY"

dst192.168.12.166"

dst_mac2c:

53:

4a:

01:

13:

19"

PGDEV=/proc/net/pktgen/eth2

dst192.168.12.165"

18"

#Timetorun

PGDEV=/proc/net/pktgen/pgctrl

Running...ctrl^Ctostop"

start"

Done"

#Resultcanbevievedin/proc/net/pktgen/eth[1,2]

脚本2:

2个网口之间单向发送测试脚本.(即GWN7000的LAN1向LAN5发数据测试)

PGDEV=/proc/net/pktgen/kpktgend_0

dst192.168.1.166"

步骤4)执行pktgen测试脚本的同时,查看发/收数据.

将脚本保存到文件pktgen-eth1-eth2.sh中.

[root@localhostpktgen]#./pktgen-eth1-eth2.sh

Removingalldevices

Addingeth

Addingeth6

Configuring/proc/net/pktgen/eth5

Configuring/proc/net/pktgen/eth6

Running...ctrl^Ctostop

另开一个终端,执行mpstat命令查看cpu占用率,看网卡中断的处理是否正常:

mpstat-P2,31

Linux2.6.38.8(localhost.localdomain)01/15/2012_x86_64_(4CPU)

09:

16AMCPU%usr%nice%sys%iowait%irq%soft%steal%guest%idle

17AM20.000.0086.870.000.0013.130.000.000.00

17AM30.000.0074.230.000.0025.770.000.000.00

18AM20.000.0087.630.000.0012.370.000.000.00

18AM30.000.0076.530.000.0023.470.000.000.00

19AM20.000.0085.710.000.0014.290.000.000.00

19AM30.000.0075.510.000.0024.490.000.000.00

20AM20.000.0086.600.000.0013.400.000.000.00

20AM30.000.0070.100.000.0029.900.000.000.00

^C

sar-nDEV2

[root@localhost~]#

执行一段时间后看统计数据:

[root@localhostpktgen]#cat/proc/net/pktgen/eth5

Params:

count0min_pkt_size:

60max_pkt_size:

60

frags:

0delay:

0clone_skb:

1000000ifname:

eth5

flows:

0flowlen:

queue_map_min:

0queue_map_max:

dst_min:

192.168.1.96dst_max:

src_min:

src_max:

src_mac:

00:

0c:

9b:

b4dst_mac:

be

udp_src_min:

9udp_src_max:

9udp_dst_min:

9udp_dst_max:

9

src_mac_count:

0dst_mac_count:

Flags:

Current:

pkts-sofar:

4405203errors:

started:

2423250036usstopped:

2570673239usidle:

61432us

seq_num:

4405204cur_dst_mac_offset:

0cur_src_mac_offset:

cur_saddr:

0x5f01a8c0cur_daddr:

0x6001a8c0

cur_udp_dst:

9cur_udp_src:

cur_queue_map:

147423202(c147361769+d61432)usec,4405203(60byte,0frags)

29881pps14Mb/sec(14342880bps)errors:

cat/proc/net/pktgen/eth6

eth6

192.168.1.95dst_max:

bedst_mac:

b4

2846965errors:

2423223982usstopped:

2570673243usidle:

45963us

2846966cur_dst_mac_offset:

0x6001a8c0cur

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 农林牧渔 > 林学

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2