如何使用tcpreplay以100 MBps,500 MBps和1Gbps的速度泵送流量?

时间:2014-03-04 06:17:14

标签: network-programming wireshark tcpdump network-monitoring tcpreplay

我使用-R和-K选项,但它似乎没有工作,因为我使用tcpdump捕获泵送流量,我看到的数据包数似乎与我期望的数据包数量相匹配帧。

1 个答案:

答案 0 :(得分:2)

首先请确保您使用的是最新版本here。您将需要使用-K和--mbps(或-M)选项,例如:

# tcpreplay -i eth7 -K --mbps 1000 smallFlows.pcap 
File Cache is enabled
Actual: 14261 packets (9216531 bytes) sent in 0.073761 seconds.
Rated: 124951275.0 Bps, 999.61 Mbps, 193340.65 pps
Flows: 1209 flows, 16390.77 fps, 14243 flow packets, 18 non-flow
Statistics for network device: eth7
    Attempted packets:         14261
    Successful packets:        14261
    Failed packets:            0
    Truncated packets:         0
    Retried packets (ENOBUFS): 0
    Retried packets (EAGAIN):  0

当您尝试移动到更高的速度(例如10GigE)时,您可能需要使用--loop选项生成更大的数据块。此外,对于Tcpreplay版本4.0,还有更高级的--netmap和--unique-ip选项,它们在正确设置的系统上将实现接近线速和非常高的流/秒。有关更多信息,请访问Tcpreplay How To。这是一个例子:

# tcpreplay -i eth7 -K --mbps 9500 --loop 100 --netmap --unique-ip smallFlows.pcap 
Switching network driver for eth7 to netmap bypass mode... done!
File Cache is enabled
Actual: 1426100 packets (921653100 bytes) sent in 0.776133 seconds.
Rated: 1187493767.1 Bps, 9499.95 Mbps, 1837442.80 pps
Flows: 120900 flows, 155772.27 fps, 1424300 flow packets, 1800 non-flow
Statistics for network device: eth7
    Attempted packets:         1426100
    Successful packets:        1426100
    Failed packets:            0
    Truncated packets:         0
    Retried packets (ENOBUFS): 0
    Retried packets (EAGAIN):  0
Switching network driver for eth7 to normal mode... done!