tcpreplay-edit提供了可对包进行修改的高级用法:

      --unique-ip
Modify IP addresses each loop iteration to generate unique flows. This option must appear in combination with the following options: loop. This option must not appear
in combination with any of the following options: seed, fuzz-seed. Ensure IPv4 and IPv6 packets will be unique for each --loop iteration. This is done in a way that will not alter packet CRC, and therefore will genrally not affect per‐
formance. This option will significantly increase the flows/sec over generated over multiple loop iterations. --unique-ip-loops=string
Number of times to loop before assigning new unique ip. This option may appear up to times. This option must appear in combination with the following options: unique-
ip. Number of --loop iterations before a new unique IP is assigned. Default is . Assumes both --loop and --unique-ip.

原包如下:

┬─[tong@T7:~/Data]─[:: AM]
╰─>$ sudo tcpreplay-edit -i replay-br0 -t baidu.pcap

收包如下:

[root@dpdk ~]# tcpdump -i eth1 -nn "tcp[tcpflags] & (tcp-syn) != 0 and tcp[tcpflags] & (tcp-ack) == 0"
::17.125017 IP 192.168.10.56. > 202.89.233.103.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::17.125093 IP 192.168.10.56. > 203.208.39.205.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::17.125124 IP 192.168.10.56. > 120.25.241.229.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::17.125133 IP 192.168.10.56. > 114.55.49.182.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length

使用,--uique-ip 参数可以在保证flow关系的前提下修改IP,修改策略是,源IP地址加一,目的IP地址减一

发包如下:

┬─[tong@T7:~/Data]─[:: AM]
╰─>$ sudo tcpreplay-edit -i replay-br0 -t --unique-ip -l3 baidu.pcap

收包如下:

[root@dpdk ~]# tcpdump -i eth1 -nn "tcp[tcpflags] & (tcp-syn) != 0 and tcp[tcpflags] & (tcp-ack) == 0"   

::31.745157 IP 192.168.10.56. > 202.89.233.103.: Flags [S], seq , win , options [mss ,sackOK,TS val  ecr ,nop,wscale ], length
::31.745175 IP 192.168.10.56. > 203.208.39.205.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::31.745183 IP 192.168.10.56. > 120.25.241.229.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::31.745186 IP 192.168.10.56. > 114.55.49.182.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::31.745213 IP 192.168.10.55. > 202.89.233.104.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::31.745249 IP 192.168.10.55. > 203.208.39.206.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::31.745278 IP 192.168.10.57. > 120.25.241.228.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::31.745292 IP 192.168.10.57. > 114.55.49.181.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::31.745360 IP 192.168.10.54. > 202.89.233.105.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::31.745395 IP 192.168.10.54. > 203.208.39.207.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::31.745404 IP 192.168.10.58. > 120.25.241.227.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::31.745406 IP 192.168.10.58. > 114.55.49.180.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length

再增加 --unique-ip-loops=3 参数,可以增加策略复杂性,效果就是,第2次loop和第3次loop的包,与第一次loop重复,例子如下:

发包:

┬─[tong@T7:~/Data]─[:: AM]
╰─>$ sudo tcpreplay-edit -i replay-br0 -t --unique-ip --unique-ip-loops= -l9 baidu.pcap

收包:

┬─[tong@T7:~/Data]─[:: AM]
╰─>$ sudo tcpreplay-edit -i replay-br0 -t --unique-ip --unique-ip-loops= -l9 baidu.pcap ::16.886335 IP 192.168.10.56. > 202.89.233.103.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.886981 IP 192.168.10.56. > 203.208.39.205.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.887154 IP 192.168.10.56. > 120.25.241.229.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.887209 IP 192.168.10.56. > 114.55.49.182.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.888984 IP 192.168.10.56. > 202.89.233.103.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.889845 IP 192.168.10.56. > 203.208.39.205.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.889931 IP 192.168.10.56. > 120.25.241.229.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.889944 IP 192.168.10.56. > 114.55.49.182.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.890927 IP 192.168.10.56. > 202.89.233.103.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.891194 IP 192.168.10.56. > 203.208.39.205.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.891251 IP 192.168.10.56. > 120.25.241.229.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.891261 IP 192.168.10.56. > 114.55.49.182.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.891299 IP 192.168.10.55. > 202.89.233.104.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.891473 IP 192.168.10.55. > 203.208.39.206.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.892247 IP 192.168.10.57. > 120.25.241.228.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.892283 IP 192.168.10.57. > 114.55.49.181.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.892333 IP 192.168.10.56. > 202.89.233.103.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.892378 IP 192.168.10.56. > 203.208.39.205.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.892419 IP 192.168.10.56. > 120.25.241.229.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.893655 IP 192.168.10.56. > 114.55.49.182.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.893749 IP 192.168.10.56. > 202.89.233.103.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.893793 IP 192.168.10.56. > 203.208.39.205.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.893831 IP 192.168.10.56. > 120.25.241.229.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.893841 IP 192.168.10.56. > 114.55.49.182.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.893887 IP 192.168.10.54. > 202.89.233.105.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.893938 IP 192.168.10.54. > 203.208.39.207.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.893979 IP 192.168.10.58. > 120.25.241.227.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.893990 IP 192.168.10.58. > 114.55.49.180.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.894044 IP 192.168.10.56. > 202.89.233.103.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.894094 IP 192.168.10.56. > 203.208.39.205.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.894135 IP 192.168.10.56. > 120.25.241.229.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.894284 IP 192.168.10.56. > 114.55.49.182.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.894342 IP 192.168.10.56. > 202.89.233.103.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.894394 IP 192.168.10.56. > 203.208.39.205.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.894439 IP 192.168.10.56. > 120.25.241.229.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length
::16.894450 IP 192.168.10.56. > 114.55.49.182.: Flags [S], seq , win , options [mss ,sackOK,TS val ecr ,nop,wscale ], length

[tcpreplay] tcpreplay高级用法--使用tcpreplay-edit进行循环动态发包的更多相关文章

  1. [iOS]C语言技术视频-15-指针变量高级用法练习一(函数指针完成动态排序)

    下载地址: 链接: http://pan.baidu.com/s/1o6MOzX4 密码: xzxn

  2. Autofac高级用法之动态代理

    前言 Autofac的DynamicProxy来自老牌的Castle项目.DynamicProxy(以下称为动态代理)起作用主要是为我们的类生成一个代理类,这个代理类可以在我们调用原本类的方法之前,调 ...

  3. 【转】Autofac高级用法之动态代理

    原文:http://www.cnblogs.com/stulzq/p/8547839.html 前言 Autofac的DynamicProxy来自老牌的Castle项目.DynamicProxy(以下 ...

  4. Visual Studio 宏的高级用法

    因为自 Visual Studio 2012 开始,微软已经取消了对宏的支持,所以本篇文章所述内容只适用于 Visual Studio 2010 或更早期版本的 VS. 在上一篇中,我已经介绍了如何编 ...

  5. Bash 脚本编程的一些高级用法

    概述 偶然间发现 man bash 上其实详细讲解了 shell 编程的语法,包括一些很少用却很实用的高级语法.就像发现了宝藏的孩子,兴奋莫名.于是参考man bash,结合自己的理解,整理出了这篇文 ...

  6. SolrNet高级用法(分页、Facet查询、任意分组)

    前言 如果你在系统中用到了Solr的话,那么肯定会碰到从Solr中反推数据的需求,基于数据库数据生产索引后,那么Solr索引的数据相对准确,在电商需求中经常会碰到菜单.导航分类(比如电脑.PC的话会有 ...

  7. sqlalchemy(二)高级用法

    sqlalchemy(二)高级用法 本文将介绍sqlalchemy的高级用法. 外键以及relationship 首先创建数据库,在这里一个user对应多个address,因此需要在address上增 ...

  8. Solr学习总结(六)SolrNet的高级用法(复杂查询,分页,高亮,Facet查询)

    上一篇,讲到了SolrNet的基本用法及CURD,这个算是SolrNet 的入门知识介绍吧,昨天写完之后,有朋友评论说,这些感觉都被写烂了.没错,这些基本的用法,在网上百度,资料肯定一大堆,有一些写的 ...

  9. 再谈Newtonsoft.Json高级用法

    上一篇Newtonsoft.Json高级用法发布以后收到挺多回复的,本篇将分享几点挺有用的知识点和最近项目中用到的一个新点进行说明,做为对上篇文章的补充. 阅读目录 动态改变属性序列化名称 枚举值序列 ...

随机推荐

  1. mxnet:基础知识和一个简单的示例

    NDArray与NumPy的多维数组类似,但NDArray提供了更多的功能:GPU和CPU的异步计算:自动求导.这使得NDArray能更好地支持机器学习. 初始化 from mxnet import ...

  2. Openlayers离线载入天地图

    概述: 经过一个春节的休整,今天最终開始了! 任何时候.都不要忘记学习.学习是一辈子的事情!今天,我来说说怎样实现天地图的离线以及Openlayers载入离线数据实现天地图数据的展示. 实现: 1.获 ...

  3. MAC OS查看端口占用情况及杀死进程

    终端命令 sudo lsof -i :9000 COMMAND   PID    USER   FD      TYPE             DEVICE                     ...

  4. HttpWebRequest - Asynchronous Programming Model/Task.Factory.FromAsyc

    Posted by Shiv Kumar on 23rd February, 2011 The Asynchronous Programming Model (or APM) has been aro ...

  5. js实现滑动的弹性导航

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  6. css文件的MIME错误引发的Jquery Mobile绘制错误

    静态文件serve设置的MIME不对,引起的浏览器警告 Resource interpreted as Stylesheet but transferred with MIME type applic ...

  7. 自windows8以后,所有版本(专业版、企业版、旗舰版)都支持从 vhd 启动

    而在windows 7 中,只有:企业版.旗舰版: 支持 从 vhd 启动!

  8. duilib进阶教程 -- Label控件的bug (8)

    上个教程说到了TreeView的文字不能垂直居中的问题,而我们用LabelUI其实是可以垂直居中的,为什么不说是TreeView的bug,而说是Label控件的bug呢?因为影响TreeView垂直居 ...

  9. [Node.js] 07 - Html and Http

    前言 一.原本的计划 Node.js 路由 Node.js GET/POST请求 到此,有必要复习下http章节 Node.js Web 模块 Node.js Express 框架 Node.js R ...

  10. SpringBoot Docker入门,SpringBoot Docker安装

    SpringBoot Docker入门,SpringBoot Docker安装 ================================ ©Copyright 蕃薯耀 2018年4月8日 ht ...