2016年1月27日 星期三

[Linux 常見問題] How do I pump traffic using tcpreplay at 100 MBps, 500 MBps and 1Gbps speeds?

Source From Here
Question
I used the -R and -K (Preloads packets into RAM before sending.) option but it doesnt seem to be working as I captured the pumped traffic using tcpdump and the number of packets that I see there dont seem to match the number of packets that I expect in the time frame.

How-To
First of all make sure you are using the latest version, available here. You will want to use the -K and --mbps (or -M, Replay packets at a given Mbps.) options, for example:
# 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

When you attempt to move to higher speeds (e.g. 10GigE) you may need to generate a bigger block of data by using the --loop (Loop through the capture file X times.) option. Also with Tcpreplay version 4.0 there are the more advanced--netmap (Write packets directly to netmap enabled network adapter.) and --unique-ip (Modify IP addresses each loop iteration to generate unique flows. This option must appear in combination with the following options: loop.) options which on a properly set up system, will achieve near wire rate and very high flows/sec. More information available at Tcpreplay How To. Here is an example:
# 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!


沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...