tcpreplay.1 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. .de1 NOP
  2. . it 1 an-trap
  3. . if \\n[.$] \,\\$*\/
  4. ..
  5. .ie t \
  6. .ds B-Font [CB]
  7. .ds I-Font [CI]
  8. .ds R-Font [CR]
  9. .el \
  10. .ds B-Font B
  11. .ds I-Font I
  12. .ds R-Font R
  13. .TH tcpreplay 1 "14 Jun 2020" "tcpreplay" "User Commands"
  14. .\"
  15. .\" DO NOT EDIT THIS FILE (in-mem file)
  16. .\"
  17. .\" It has been AutoGen-ed
  18. .\" From the definitions tcpreplay_opts.def
  19. .\" and the template file agman-cmd.tpl
  20. .SH NAME
  21. \f\*[B-Font]tcpreplay\fP
  22. \- Replay network traffic stored in pcap files
  23. .SH SYNOPSIS
  24. \f\*[B-Font]tcpreplay\fP
  25. .\" Mixture of short (flag) options and long options
  26. [\f\*[B-Font]\-flags\f[]]
  27. [\f\*[B-Font]\-flag\f[] [\f\*[I-Font]value\f[]]]
  28. [\f\*[B-Font]\-\-option-name\f[][[=| ]\f\*[I-Font]value\f[]]]
  29. <pcap_file(s)>
  30. .sp \n(Ppu
  31. .ne 2
  32. tcpreplay is a tool for replaying network traffic from files saved with
  33. tcpdump or other tools which write pcap(3) files.
  34. .SH "DESCRIPTION"
  35. The basic operation of tcpreplay is to resend all packets from the
  36. input file(s) at the speed at which they were recorded, or a specified
  37. data rate, up to as fast as the hardware is capable.
  38. .sp
  39. Optionally, the traffic can be split between two interfaces, written to
  40. files, filtered and edited in various ways, providing the means to test
  41. firewalls, NIDS and other network devices.
  42. .sp
  43. For more details, please see the Tcpreplay Manual at:
  44. http://tcpreplay.appneta.com
  45. .SH "OPTIONS"
  46. .TP
  47. .NOP \f\*[B-Font]\-d\f[] \f\*[I-Font]number\f[], \f\*[B-Font]\-\-dbug\f[]=\f\*[I-Font]number\f[]
  48. Enable debugging output.
  49. This option may appear up to 1 times.
  50. This option takes an integer number as its argument.
  51. The value of
  52. \f\*[I-Font]number\f[]
  53. is constrained to being:
  54. .in +4
  55. .nf
  56. .na
  57. in the range 0 through 5
  58. .fi
  59. .in -4
  60. The default
  61. \f\*[I-Font]number\f[]
  62. for this option is:
  63. .ti +4
  64. 0
  65. .sp
  66. If configured with \--enable-debug, then you can specify a verbosity
  67. level for debugging output. Higher numbers increase verbosity.
  68. .TP
  69. .NOP \f\*[B-Font]\-q\f[], \f\*[B-Font]\-\-quiet\f[]
  70. Quiet mode.
  71. .sp
  72. Print nothing except the statistics at the end of the run
  73. .TP
  74. .NOP \f\*[B-Font]\-T\f[] \f\*[I-Font]string\f[], \f\*[B-Font]\-\-timer\f[]=\f\*[I-Font]string\f[]
  75. Select packet timing mode: select, ioport, gtod, nano.
  76. This option may appear up to 1 times.
  77. The default
  78. \f\*[I-Font]string\f[]
  79. for this option is:
  80. .ti +4
  81. gtod
  82. .sp
  83. Allows you to select the packet timing method to use:
  84. .sp
  85. .IR "nano"
  86. - Use nanosleep() API
  87. .sp
  88. .IR "select"
  89. - Use select() API
  90. .sp
  91. .IR "ioport"
  92. - Write to the i386 IO Port 0x80
  93. .sp
  94. .IR "gtod [default]"
  95. - Use a gettimeofday() loop
  96. .br
  97. .TP
  98. .NOP \f\*[B-Font]\-\-maxsleep\f[]=\f\*[I-Font]number\f[]
  99. Sleep for no more then X milliseconds between packets.
  100. This option takes an integer number as its argument.
  101. The default
  102. \f\*[I-Font]number\f[]
  103. for this option is:
  104. .ti +4
  105. 0
  106. .sp
  107. Set a limit for the maximum number of milliseconds that tcpreplay will sleep
  108. between packets. Effectively prevents long delays between packets without
  109. effecting the majority of packets. Default is disabled.
  110. .TP
  111. .NOP \f\*[B-Font]\-v\f[], \f\*[B-Font]\-\-verbose\f[]
  112. Print decoded packets via tcpdump to STDOUT.
  113. This option may appear up to 1 times.
  114. .sp
  115. .TP
  116. .NOP \f\*[B-Font]\-A\f[] \f\*[I-Font]string\f[], \f\*[B-Font]\-\-decode\f[]=\f\*[I-Font]string\f[]
  117. Arguments passed to tcpdump decoder.
  118. This option may appear up to 1 times.
  119. This option must appear in combination with the following options:
  120. verbose.
  121. .sp
  122. When enabling verbose mode (\fB-v\fP) you may also specify one or more
  123. additional arguments to pass to \fBtcpdump\fP to modify the way packets
  124. are decoded. By default, \-n and \-l are used. Be sure to
  125. quote the arguments like: \-A "-axxx" so that they are not interpreted
  126. by tcpreplay. Please see the tcpdump(1) man page for a complete list of
  127. options.
  128. .TP
  129. .NOP \f\*[B-Font]\-K\f[], \f\*[B-Font]\-\-preload\-pcap\f[]
  130. Preloads packets into RAM before sending.
  131. .sp
  132. This option loads the specified pcap(s) into RAM before starting to send in order
  133. to improve replay performance while introducing a startup performance hit.
  134. Preloading can be used with or without \fB--loop\fP. This option also suppresses
  135. flow statistics collection for every iteration, which can significantly reduce
  136. memory usage. Flow statistics are predicted based on options supplied and
  137. statistics collected from the first loop iteration.
  138. .TP
  139. .NOP \f\*[B-Font]\-c\f[] \f\*[I-Font]string\f[], \f\*[B-Font]\-\-cachefile\f[]=\f\*[I-Font]string\f[]
  140. Split traffic via a tcpprep cache file.
  141. This option may appear up to 1 times.
  142. This option must appear in combination with the following options:
  143. intf2.
  144. This option must not appear in combination with any of the following options:
  145. dualfile.
  146. .sp
  147. If you have a pcap file you would like to use to send bi-directional
  148. traffic through a device (firewall, router, IDS, etc) then using tcpprep
  149. you can create a cachefile which tcpreplay will use to split the traffic
  150. across two network interfaces.
  151. .TP
  152. .NOP \f\*[B-Font]\-2\f[], \f\*[B-Font]\-\-dualfile\f[]
  153. Replay two files at a time from a network tap.
  154. This option may appear up to 1 times.
  155. This option must appear in combination with the following options:
  156. intf2.
  157. This option must not appear in combination with any of the following options:
  158. cachefile.
  159. .sp
  160. If you captured network traffic using a network tap, then you can end up with
  161. two pcap files- one for each direction. This option will replay these two
  162. files at the same time, one on each interface and inter-mix them using the
  163. timestamps in each.
  164. .TP
  165. .NOP \f\*[B-Font]\-i\f[] \f\*[I-Font]string\f[], \f\*[B-Font]\-\-intf1\f[]=\f\*[I-Font]string\f[]
  166. Client to server/RX/primary traffic output interface.
  167. This option may appear up to 1 times.
  168. .sp
  169. Required network interface used to send either all traffic or traffic which is
  170. marked as 'primary' via tcpprep. Primary traffic is usually client-to-server
  171. or inbound (RX) on khial virtual interfaces.
  172. .TP
  173. .NOP \f\*[B-Font]\-I\f[] \f\*[I-Font]string\f[], \f\*[B-Font]\-\-intf2\f[]=\f\*[I-Font]string\f[]
  174. Server to client/TX/secondary traffic output interface.
  175. This option may appear up to 1 times.
  176. .sp
  177. Optional network interface used to send traffic which is marked as 'secondary'
  178. via tcpprep. Secondary traffic is usually server-to-client or outbound
  179. (TX) on khial virtual interfaces. Generally, it only makes sense to use this
  180. option with \--cachefile.
  181. .TP
  182. .NOP \f\*[B-Font]\-\-listnics\f[]
  183. List available network interfaces and exit.
  184. .sp
  185. .TP
  186. .NOP \f\*[B-Font]\-l\f[] \f\*[I-Font]number\f[], \f\*[B-Font]\-\-loop\f[]=\f\*[I-Font]number\f[]
  187. Loop through the capture file X times.
  188. This option may appear up to 1 times.
  189. This option takes an integer number as its argument.
  190. The value of
  191. \f\*[I-Font]number\f[]
  192. is constrained to being:
  193. .in +4
  194. .nf
  195. .na
  196. greater than or equal to 0
  197. .fi
  198. .in -4
  199. The default
  200. \f\*[I-Font]number\f[]
  201. for this option is:
  202. .ti +4
  203. 1
  204. .sp
  205. .TP
  206. .NOP \f\*[B-Font]\-\-loopdelay\-ms\f[]=\f\*[I-Font]number\f[]
  207. Delay between loops in milliseconds.
  208. This option must appear in combination with the following options:
  209. loop.
  210. This option takes an integer number as its argument.
  211. The value of
  212. \f\*[I-Font]number\f[]
  213. is constrained to being:
  214. .in +4
  215. .nf
  216. .na
  217. greater than or equal to 0
  218. .fi
  219. .in -4
  220. The default
  221. \f\*[I-Font]number\f[]
  222. for this option is:
  223. .ti +4
  224. 0
  225. .sp
  226. .TP
  227. .NOP \f\*[B-Font]\-\-pktlen\f[]
  228. Override the snaplen and use the actual packet len.
  229. This option may appear up to 1 times.
  230. .sp
  231. By default, tcpreplay will send packets based on the size of the "snaplen"
  232. stored in the pcap file which is usually the correct thing to do. However,
  233. occasionally, tools will store more bytes then told to. By specifying this
  234. option, tcpreplay will ignore the snaplen field and instead try to send
  235. packets based on the original packet length. Bad things may happen if
  236. you specify this option.
  237. .TP
  238. .NOP \f\*[B-Font]\-L\f[] \f\*[I-Font]number\f[], \f\*[B-Font]\-\-limit\f[]=\f\*[I-Font]number\f[]
  239. Limit the number of packets to send.
  240. This option may appear up to 1 times.
  241. This option takes an integer number as its argument.
  242. The value of
  243. \f\*[I-Font]number\f[]
  244. is constrained to being:
  245. .in +4
  246. .nf
  247. .na
  248. greater than or equal to 1
  249. .fi
  250. .in -4
  251. The default
  252. \f\*[I-Font]number\f[]
  253. for this option is:
  254. .ti +4
  255. \-1
  256. .sp
  257. By default, tcpreplay will send all the packets. Alternatively, you can
  258. specify a maximum number of packets to send.
  259. .TP
  260. .NOP \f\*[B-Font]\-\-duration\f[]=\f\*[I-Font]number\f[]
  261. Limit the number of seconds to send.
  262. This option may appear up to 1 times.
  263. This option takes an integer number as its argument.
  264. The value of
  265. \f\*[I-Font]number\f[]
  266. is constrained to being:
  267. .in +4
  268. .nf
  269. .na
  270. greater than or equal to 1
  271. .fi
  272. .in -4
  273. The default
  274. \f\*[I-Font]number\f[]
  275. for this option is:
  276. .ti +4
  277. \-1
  278. .sp
  279. By default, tcpreplay will send all the packets. Alternatively, you can
  280. specify a maximum number of seconds to transmit.
  281. .TP
  282. .NOP \f\*[B-Font]\-x\f[] \f\*[I-Font]string\f[], \f\*[B-Font]\-\-multiplier\f[]=\f\*[I-Font]string\f[]
  283. Modify replay speed to a given multiple.
  284. This option may appear up to 1 times.
  285. This option must not appear in combination with any of the following options:
  286. pps, mbps, oneatatime, topspeed.
  287. .sp
  288. Specify a value to modify the packet replay speed.
  289. Examples:
  290. .nf
  291. 2.0 will replay traffic at twice the speed captured
  292. 0.7 will replay traffic at 70% the speed captured
  293. .fi
  294. .TP
  295. .NOP \f\*[B-Font]\-p\f[] \f\*[I-Font]string\f[], \f\*[B-Font]\-\-pps\f[]=\f\*[I-Font]string\f[]
  296. Replay packets at a given packets/sec.
  297. This option may appear up to 1 times.
  298. This option must not appear in combination with any of the following options:
  299. multiplier, mbps, oneatatime, topspeed.
  300. .sp
  301. Specify a value to regulate the packet replay to a specific packet-per-second rate.
  302. Examples:
  303. .nf
  304. 200 will replay traffic at 200 packets per second
  305. 0.25 will replay traffic at 15 packets per minute
  306. .fi
  307. .TP
  308. .NOP \f\*[B-Font]\-M\f[] \f\*[I-Font]string\f[], \f\*[B-Font]\-\-mbps\f[]=\f\*[I-Font]string\f[]
  309. Replay packets at a given Mbps.
  310. This option may appear up to 1 times.
  311. This option must not appear in combination with any of the following options:
  312. multiplier, pps, oneatatime, topspeed.
  313. .sp
  314. Specify a floating point value for the Mbps rate that tcpreplay
  315. should send packets at.
  316. .TP
  317. .NOP \f\*[B-Font]\-t\f[], \f\*[B-Font]\-\-topspeed\f[]
  318. Replay packets as fast as possible.
  319. This option must not appear in combination with any of the following options:
  320. mbps, multiplier, pps, oneatatime.
  321. .sp
  322. .TP
  323. .NOP \f\*[B-Font]\-o\f[], \f\*[B-Font]\-\-oneatatime\f[]
  324. Replay one packet at a time for each user input.
  325. This option must not appear in combination with any of the following options:
  326. mbps, pps, multiplier, topspeed.
  327. .sp
  328. Allows you to step through one or more packets at a time.
  329. .TP
  330. .NOP \f\*[B-Font]\-\-pps\-multi\f[]=\f\*[I-Font]number\f[]
  331. Number of packets to send for each time interval.
  332. This option must appear in combination with the following options:
  333. pps.
  334. This option takes an integer number as its argument.
  335. The value of
  336. \f\*[I-Font]number\f[]
  337. is constrained to being:
  338. .in +4
  339. .nf
  340. .na
  341. greater than or equal to 1
  342. .fi
  343. .in -4
  344. The default
  345. \f\*[I-Font]number\f[]
  346. for this option is:
  347. .ti +4
  348. 1
  349. .sp
  350. When trying to send packets at very high rates, the time between each packet
  351. can be so short that it is impossible to accurately sleep for the required
  352. period of time. This option allows you to send multiple packets at a time,
  353. thus allowing for longer sleep times which can be more accurately implemented.
  354. .TP
  355. .NOP \f\*[B-Font]\-\-unique\-ip\f[]
  356. Modify IP addresses each loop iteration to generate unique flows.
  357. This option must appear in combination with the following options:
  358. loop.
  359. .sp
  360. Ensure IPv4 and IPv6 packets will be unique for each \fB--loop\fP iteration.
  361. This is done in a way that will not alter packet CRC, and therefore will genrally
  362. not affect performance. This option will significantly increase the flows/sec over
  363. generated over multiple loop iterations.
  364. .TP
  365. .NOP \f\*[B-Font]\-\-unique\-ip\-loops\f[]=\f\*[I-Font]string\f[]
  366. Number of times to loop before assigning new unique ip.
  367. This option may appear up to 1 times.
  368. This option must appear in combination with the following options:
  369. unique-ip.
  370. .sp
  371. Number of \fB--loop\fP iterations before a new unique IP is assigned. Default
  372. is 1. Assumes both \fB--loop\fP and \fB--unique-ip\fP.
  373. .TP
  374. .NOP \f\*[B-Font]\-\-netmap\f[]
  375. Write packets directly to netmap enabled network adapter.
  376. .sp
  377. This feature will detect netmap capable network drivers on Linux and BSD
  378. systems. If detected, the network driver is bypassed for the execution
  379. duration, and network buffers will be written to directly. This will allow
  380. you to achieve full line rates on commodity network adapters, similar to rates
  381. achieved by commercial network traffic generators. Note that bypassing the network
  382. driver will disrupt other applications connected through the test interface. See
  383. INSTALL for more information.
  384. .sp
  385. This feature can also be enabled by specifying an interface as 'netmap:<intf>'
  386. or 'vale:<intf>. For example 'netmap:eth0' specifies netmap over interface eth0.
  387. .TP
  388. .NOP \f\*[B-Font]\-\-nm\-delay\f[]=\f\*[I-Font]number\f[]
  389. Netmap startup delay.
  390. This option takes an integer number as its argument.
  391. The default
  392. \f\*[I-Font]number\f[]
  393. for this option is:
  394. .ti +4
  395. 10
  396. .sp
  397. Number of seconds to delay after netmap is loaded. Required to ensure interfaces
  398. are fully up before netmap transmit. Requires netmap option. Default is 10 seconds.
  399. .TP
  400. .NOP \f\*[B-Font]\-\-no\-flow\-stats\f[]
  401. Suppress printing and tracking flow count, rates and expirations.
  402. .sp
  403. Suppress the collection and printing of flow statistics. This option may
  404. improve performance when not using \fB--preload-pcap\fP option, otherwise
  405. its only function is to suppress printing.
  406. .sp
  407. The flow feature will track and print statistics of the flows being sent.
  408. A flow is loosely defined as a unique combination of a 5-tuple, i.e.
  409. source IP, destination IP, source port, destination port and protocol.
  410. .sp
  411. If \fB--loop\fP is specified, the flows from one iteration to the next
  412. will not be unique, unless the packets are altered. Use \fB--unique-ip\fP
  413. or \fBtcpreplay-edit\fP to alter packets between iterations.
  414. .TP
  415. .NOP \f\*[B-Font]\-\-flow\-expiry\f[]=\f\*[I-Font]number\f[]
  416. Number of inactive seconds before a flow is considered expired.
  417. This option must not appear in combination with any of the following options:
  418. no-flow-stats.
  419. This option takes an integer number as its argument.
  420. The value of
  421. \f\*[I-Font]number\f[]
  422. is constrained to being:
  423. .in +4
  424. .nf
  425. .na
  426. greater than or equal to 0
  427. .fi
  428. .in -4
  429. The default
  430. \f\*[I-Font]number\f[]
  431. for this option is:
  432. .ti +4
  433. 0
  434. .sp
  435. This option will track and report flow expirations based on the flow idle
  436. times. The timestamps within the pcap file are used to determine the expiry,
  437. not the actual timestamp of the packets are replayed. For example, a value of
  438. 30 suggests that if no traffic is seen on a flow for 30 seconds, any
  439. subsequent traffic would be considered a new flow, and thereby will increment
  440. the flows and flows per second (fps) statistics.
  441. .sp
  442. This option can be used to optimize flow timeout settings for flow products.
  443. Setting the timeout low may lead to flows being dropped when in fact the flow
  444. is simply slow to respond. Configuring your flow timeouts too high may
  445. increase resources required by your flow product.
  446. .sp
  447. Note that using this option while replaying at higher than original speeds
  448. can lead to inflated flows and fps counts.
  449. .sp
  450. Default is 0 (no expiry) and a typical value is 30-120 seconds.
  451. .TP
  452. .NOP \f\*[B-Font]\-P\f[], \f\*[B-Font]\-\-pid\f[]
  453. Print the PID of tcpreplay at startup.
  454. .sp
  455. .TP
  456. .NOP \f\*[B-Font]\-\-stats\f[]=\f\*[I-Font]number\f[]
  457. Print statistics every X seconds, or every loop if '0'.
  458. This option takes an integer number as its argument.
  459. The value of
  460. \f\*[I-Font]number\f[]
  461. is constrained to being:
  462. .in +4
  463. .nf
  464. .na
  465. greater than or equal to 0
  466. .fi
  467. .in -4
  468. .sp
  469. Note that timed delays are a "best effort" and long delays between
  470. sending packets may cause equally long delays between printing statistics.
  471. .TP
  472. .NOP \f\*[B-Font]\-V\f[], \f\*[B-Font]\-\-version\f[]
  473. Print version information.
  474. .sp
  475. .TP
  476. .NOP \f\*[B-Font]\-h\f[], \f\*[B-Font]\-\-less\-help\f[]
  477. Display less usage information and exit.
  478. .sp
  479. .TP
  480. .NOP \f\*[B-Font]\-H\f[], \f\*[B-Font]\-\-help\f[]
  481. Display usage information and exit.
  482. .TP
  483. .NOP \f\*[B-Font]\-\&!\f[], \f\*[B-Font]\-\-more-help\f[]
  484. Pass the extended usage information through a pager.
  485. .TP
  486. .NOP \f\*[B-Font]\-\-save-opts\f[] [=\f\*[I-Font]cfgfile\f[]]
  487. Save the option state to \fIcfgfile\fP. The default is the \fIlast\fP
  488. configuration file listed in the \fBOPTION PRESETS\fP section, below.
  489. The command will exit after updating the config file.
  490. .TP
  491. .NOP \f\*[B-Font]\-\-load-opts\f[]=\f\*[I-Font]cfgfile\f[], \f\*[B-Font]\-\-no-load-opts\f[]
  492. Load options from \fIcfgfile\fP.
  493. The \fIno-load-opts\fP form will disable the loading
  494. of earlier config/rc/ini files. \fI\-\-no-load-opts\fP is handled early,
  495. out of order.
  496. .PP
  497. .SH "OPTION PRESETS"
  498. Any option that is not marked as \fInot presettable\fP may be preset
  499. by loading values from configuration ("RC" or ".INI") file(s).
  500. The \fIhomerc\fP file is "\fI$$/\fP", unless that is a directory.
  501. In that case, the file "\fI.tcpreplayrc\fP"
  502. is searched for within that directory.
  503. .SH "FILES"
  504. See \fBOPTION PRESETS\fP for configuration files.
  505. .SH "EXIT STATUS"
  506. One of the following exit values will be returned:
  507. .TP
  508. .NOP 0 " (EXIT_SUCCESS)"
  509. Successful program execution.
  510. .TP
  511. .NOP 1 " (EXIT_FAILURE)"
  512. The operation failed or the command syntax was not valid.
  513. .TP
  514. .NOP 66 " (EX_NOINPUT)"
  515. A specified configuration file could not be loaded.
  516. .TP
  517. .NOP 70 " (EX_SOFTWARE)"
  518. libopts had an internal operational error. Please report
  519. it to autogen-users@lists.sourceforge.net. Thank you.
  520. .PP
  521. .SH "AUTHORS"
  522. Copyright 2013-2018 Fred Klassen \- AppNeta
  523. Copyright 2000-2012 Aaron Turner
  524. For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
  525. The latest version of this software is always available from:
  526. http://tcpreplay.appneta.com/
  527. .SH "COPYRIGHT"
  528. Copyright (C) 2000-2018 Aaron Turner and Fred Klassen all rights reserved.
  529. This program is released under the terms of the GNU General Public License, version 3 or later.
  530. .SH "BUGS"
  531. Please send bug reports to: tcpreplay-users@lists.sourceforge.net
  532. .SH "NOTES"
  533. This manual page was \fIAutoGen\fP-erated from the \fBtcpreplay\fP
  534. option definitions.