tcpreplay man手册翻译

TCPREPLAY(1)                                         Programmer's Manual                                        TCPREPLAY(1)


NAME

  tcpreplay - 重发保存在pcap文件中的网络流量


SYNOPSIS

       tcpreplay [-flag [value]]... [--opt-name [[=| ]value]]...   <pcap_file(s)>

  tcpreplay 可以获取 tcpdump 或者其他工具保存的 pcap 文件中的流量,将这些流量重新发送。

DESCRIPTION

  该手册简要描述了 tcpreplay 命令。tcpreplay 的基础操作是以任意不大于硬件支持的速率重发保存在某pcap文件中的报文。

  我们可以通过编辑流量后重新发送的方式来测试防火墙、入侵检测系统或者其他网络设备。

  更多细节,请访问 https://tcpreplay.appneta.com/


OPTIONS

       -d number, --dbug=number

    使能 debug 输出。

    该选项最多只能出现一次,number为 0-5 之间的整数,默认值为 0。
    如果编译时候配置(./configure)了 --enable-debug,可以通过该选项设置 debug 输出,数字越大则输出的内容越详细。

       -q, --quiet
              安静模式。
    只输出结束运行后的统计信息。

       -T string, --timer=string

    选择发送报文时的时间延迟函数:select、ioport、 rdtsc、 gtod、 nano、 abstime,默认选项为gtod。该选项只能出现一次。

    可选的时间方法如下:
              nano - Use nanosleep() API
              select - Use select() API
              ioport - Write to the i386 IO Port 0x80
              rdtsc - Use the x86/x86_64/PPC RDTSC
              gtod [default] - Use a gettimeofday() loop
              abstime - Use OS X's AbsoluteTime API

       --sleep-accel=number

    减少实际睡眠时间,单位为微秒。该选项参数为整数,默认值为 0。
    减少两个报文发送之间的实际睡眠时间,单位为微秒。该选项提供了一个模糊因子来补偿非实时操作系统中其他进程占用CPU的时间,默认不使能。

       --rdtsc-clicks=number

    设置RDTSC(每微秒多少个click),该选项只能出现一次。该选项参数为整型,默认值为 0。

    该选项参数为整形,默认数值为0 。

    使用用户制定的而不是程序计算出来的值,该选项指定 --timer=rdtsc 选项时候有效。

       -v, --verbose
    通过 tcpdump 打印解码后的报文到 STDOUT。该选项最多只能出现一次。    


       -A string, --decode=string

    给 tcpdump 解码器传递的参数。该选项只能出现一次。该选项只能跟选项 “verbose” 联合使用。
    当使能 verbose(-v) 模式时,你可能需要指定附加选项给 tcpdump 去改变报文解码方式。默认情况下, 使用-n、-l 选项。

    确保在引号内这样参数才不会被tcpreplay解析,如:-A "-axxx"。可以从 tcpdump(1) man 手册中查找到完整的选项列表。

    
       -K, --enable-file-cache

    使能报文缓存。

    该选项必须跟 loop 选项联合使用。

    第一次操作时缓存 pcap 文件到内存中,这样接下来的操作就不能发现任何磁盘 IO,从而提高性能。确保你设备有足够多的内存,否则会发生swap导致性能受损。

       --preload-pcap

    发送前预加载报文到内存中。
    该选项为了提高性能在开始发送报文前加载特pcap文件到内存中。


       -c string, --cachefile=string

    通过 tcpprep 缓存文件分割流量,该参数只能出现一次。

       -i string, --intf1=string

    流量出接口,该选项只能出现一次。

       -I string, --intf2=string

    客户端/第二个流量输出接口,该选项只能出现一次。该选项只能跟选项 cachefile 联合使用。

       --listnics

    列出可用的网络接口并退出。

       -l number, --loop=number

    循环发送捕捉到的文件 number 次。该选项只能出现一次。该选项为大于0的整型变量,默认值为 1。

       --pktlen

    发送报文时候不考虑pcap文件中的”snaplen“选项, 用实际的报文长度,该选项只出现一次。
    默认情况下,tcpreplay 会基于存在pcap文件中的 ”snaplen“ 长度发送报文,这样操作在大多数情况下是正确的。

    指定该选项之后,tcpreplay 会忽略 snaplen 域然后发送实际的报文长度。

       -L number, --limit=number

    限制报文发送数量。该选项只能出现一次。该选项参数为大于1 的整数,默认值为 -1。
    默认情况下,tcpreplay 会发送所有报文。可以通过该选项指定发送报文最大个数。

       -x string, --multiplier=string

    通过给定的倍数改变发送速率。该选项只能出现一次。该选项不能跟下边的选项混合使用:pps, mbps, oneatatime, topspeed。
    制定一个浮点型值取改变报文发送速率。例如:

      2.0 将报文以接收速度的 2 倍发送出去

      0.7 将报文以接收速度的 70% 发送出去

       -p number, --pps=number

    指定发送报文速率 个/秒。该选项只能出现一次,该选项以整数作为参数。该选项不能跟下列参数混合使用:multiplier, mbps, oneatatime, topspeed。

       -M string, --mbps=string

    以指定 Mbps 发送报文,参数为一个浮点型。该选项只能出现一次。该选项 不能与以下选项联合使用:multiplier, pps, oneatatime, topspeed。

       -t, --topspeed

    尽量快的发送报文。

    该选项不能与这些选项联合使用:mbps, multiplier, pps, oneatatime。

       -o, --oneatatime

    单次发送用户要求的固定个数的报文(类似于gdb单步调试)。该选项不能跟如下选项混合使用:mbps, pps, multiplier, topspeed。
    允许单次发送一个或多个报文。

       --pps-multi=number

    在 pps 选项设置的基础上增加报文发送倍数,该选项为参数为大于等于 1 的整型, 默认值为 1。该选项必须要跟 pps 选项联合使用。

       -P, --pid

    启动时打印 tcpreplay 进程号

       --stats=number

    每几秒打印当前统计值。该选项参数为大于等于 1 的整型。

       -V, --version
              打印版本号

       -h, --less-help

    显示简要用法并退出

       -H, --help
              显示用法并退出

       -!, --more-help
              还是显示用法。

       --save-opts[=rcfile]

    保存配置状态到rcfile中。该选项的默认值可以参见下边的 OPTION PRESETS 章节。

       --load-opts=rcfile, --no-load-opts

    通过rcfile中加载配置。

OPTION PRESETS

  通过代码看到的现象是,当没设置 --save-opts 选项的值时,程序会根据homerc("$$/")查找环境变量,找到一个目录,然后在目录中创建 .tcpreplayrc 保存。

SIGNALS

       tcpreplay 捕获以下信号:

       SIGUSR1 挂起
       SIGCONT 重新启动

SEE ALSO

       tcpreplay-edit(1), tcpdump(1), tcpprep(1), tcprewrite(1), libnet(3)

BUGS

       tcpreplay can only send packets as fast as your computer's interface, processor, disk and system bus will allow.

       Packet timing at high speeds is a black art and very OS/CPU dependent.

       Replaying captured traffic may simulate odd or broken conditions on your network and cause all sorts of problems.

       In most cases, you can not replay traffic back to/at a server.

       Some operating systems by default do not allow for forging source MAC addresses.  Please consult your operating sys‐
       tem's documentation and the tcpreplay FAQ if you experience this issue.

AUTHOR

       Copyright 2000-2010 Aaron Turner

       For support please use the tcpreplay-users@lists.sourceforge.net mailing list.

       The latest version of this software is always available from: http://tcpreplay.synfin.net/

       Released under the Free BSD License.

       This manual page was AutoGen-erated from the tcpreplay option definitions.

(tcpreplay )                                             2010-04-04                                             TCPREPLAY(1)

 

something to know

  • 关于指定 --save-opts 选项的默认值,homerc代码中为 papzHomeList, 说明可能不只一个 homerc,可以在哪里设置?
  • tcpreplay-4.3.0版本,修改源码之后为什么需要make clean之后才能生效?
  • sudo 获取环境变量 https://www.jb51.net/LINUXjishu/547327.html
  • 环境变量,putenv作用,只在程序中有效
  • 为什么可以通过 man tcpreplay > note 方式将tcpreplay man手册放到 note 中?

posted on 2019-06-05 15:28  rivsidn  阅读(493)  评论(0编辑  收藏  举报

导航