tcpreplay-edit.1 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. .TH TCPREPLAY 1 2008-01-16 "(tcpreplay )" "Programmer's Manual"
  2. .\" DO NOT EDIT THIS FILE (tcpreplay-edit.1)
  3. .\"
  4. .\" It has been AutoGen-ed Wednesday January 16, 2008 at 10:09:47 PM PST
  5. .\" From the definitions tcpreplay_opts.def
  6. .\" and the template file agman1.tpl
  7. .\"
  8. .SH NAME
  9. tcpreplay \- Replay network traffic stored in pcap files
  10. .SH SYNOPSIS
  11. .B tcpreplay
  12. .\" Mixture of short (flag) options and long options
  13. .RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \--\fIopt-name\fP " [[=| ]\fIvalue\fP]]..."
  14. .br
  15. .in +8
  16. <pcap_file(s)>
  17. .PP
  18. tcpreplay is a tool for replaying network traffic from files saved with
  19. tcpdump or other tools which write pcap(3) files.
  20. .SH "DESCRIPTION"
  21. This manual page documents, briefly, the \fBtcpreplay\fP command.
  22. The basic operation of tcpreplay is to resend all packets from the
  23. input file(s) at the speed at which they were recorded, or a specified
  24. data rate, up to as fast as the hardware is capable.
  25. Optionally, the traffic can be split between two interfaces, written to
  26. files, filtered and edited in various ways, providing the means to test
  27. firewalls, NIDS and other network devices.
  28. For more details, please see the Tcpreplay Manual at:
  29. http://tcpreplay.synfin.net/trac/wiki/manual
  30. .SH OPTIONS
  31. .SS ""
  32. .TP
  33. .BR \-r " \fIstring\fP, " \--portmap "=" \fIstring\fP
  34. Rewrite TCP/UDP ports.
  35. This option may appear up to 1 times.
  36. .sp
  37. Specify a list of comma delimited port mappingings consisting of
  38. colon delimited port number pairs. Each colon delimited port pair
  39. consists of the port to match followed by the port number to rewrite.
  40. Example:
  41. .nf
  42. \--portmap=80:8000,8080:80
  43. .fi
  44. .TP
  45. .BR \-s " \fInumber\fP, " \--seed "=" \fInumber\fP
  46. Randomize src/dst IP addresses w/ given seed.
  47. This option may appear up to 1 times.
  48. This option takes an integer number as its argument.
  49. .sp
  50. Causes the source and destination IP addresses to be pseudo
  51. randomized but still maintain client/server relationships.
  52. Since the randomization is deterministic based on the seed,
  53. you can reuse the same seed value to recreate the traffic.
  54. .TP
  55. .BR \-N " \fIstring\fP, " \--pnat "=" \fIstring\fP
  56. Rewrite IP addresses using pseudo-NAT.
  57. This option may appear up to 2 times.
  58. This option must not appear in combination with any of the following options:
  59. srcipmap.
  60. .sp
  61. Takes a comma delimited series of colon delimited CIDR
  62. netblock pairs. Each netblock pair is evaluated in order against
  63. the IP addresses. If the IP address in the packet matches the
  64. first netblock, it is rewriten using the second netblock as a
  65. mask against the high order bits.
  66. Example:
  67. .nf
  68. \--pnat=192.168.0.0/16:10.77.0.0/16,172.16.0.0/12:10.1.0.0/24
  69. .fi
  70. .TP
  71. .BR \-S " \fIstring\fP, " \--srcipmap "=" \fIstring\fP
  72. Rewrite source IP addresses using pseudo-NAT.
  73. This option may appear up to 1 times.
  74. This option must not appear in combination with any of the following options:
  75. pnat.
  76. .sp
  77. Works just like the \--pnat option, but only affects the source IP
  78. addresses in the IPv4 header.
  79. .TP
  80. .BR \-D " \fIstring\fP, " \--dstipmap "=" \fIstring\fP
  81. Rewrite destination IP addresses using pseudo-NAT.
  82. This option may appear up to 1 times.
  83. This option must not appear in combination with any of the following options:
  84. pnat.
  85. .sp
  86. Works just like the \--pnat option, but only affects the destination IP
  87. addresses in the IPv4 header.
  88. .TP
  89. .BR \-e " \fIstring\fP, " \--endpoints "=" \fIstring\fP
  90. Rewrite IP addresses to be between two endpoints.
  91. This option may appear up to 1 times.
  92. This option must appear in combination with the following options:
  93. cachefile.
  94. .sp
  95. Takes a pair of colon delimited IP addresses which will be used to rewrite
  96. all traffic to appear to be between the two IP's.
  97. Example:
  98. .nf
  99. \--endpoints=172.16.0.1:172.16.0.2
  100. .fi
  101. .TP
  102. .BR \-b ", " \--skipbroadcast
  103. Skip rewriting broadcast/multicast IP's.
  104. .sp
  105. By default \--seed, \--pnat and \--endpoints will rewrite
  106. broadcast and multicast IP and MAC addresses. Setting this flag
  107. will keep broadcast/multicast IP and MAC addresses from being rewritten.
  108. .TP
  109. .BR \-C ", " \--fixcsum
  110. Force recalculation of IP/TCP/UDP checksums.
  111. .sp
  112. Causes each IP packet to have it's checksums recalcualted and
  113. fixed. Automatically enabled for packets modified with \fB--seed\fP,
  114. \fB--pnat\fP, \fB--endpoints\fP or \fB--fixlen\fP.
  115. .TP
  116. .BR \-m " \fInumber\fP, " \--mtu "=" \fInumber\fP
  117. Override default MTU length (1500 bytes).
  118. This option may appear up to 1 times.
  119. This option takes an integer number as its argument.
  120. The value of \fInumber\fP is constrained to being:
  121. .in +4
  122. .nf
  123. .na
  124. in the range 1 through MAXPACKET
  125. .fi
  126. .in -4
  127. .sp
  128. Override the default 1500 byte MTU size for determining the maximum padding length.
  129. .TP
  130. .BR \-E ", " \--efcs
  131. Remove Ethernet checksums (FCS) from end of frames.
  132. .sp
  133. Note, this option is pretty dangerous! We don't actually check to see if a FCS
  134. actually exists in the frame, we just blindly delete the last two bytes. Hence,
  135. you should only use this if you know know that your OS provides the FCS when
  136. reading raw packets.
  137. .TP
  138. .BR \-F " \fIstring\fP, " \--fixlen "=" \fIstring\fP
  139. Pad or truncate packet data to match header length.
  140. This option may appear up to 1 times.
  141. .sp
  142. Packets may be truncated during capture if the snaplen is smaller then the
  143. packet. This option allows you to modify the packet to pad the packet back
  144. out to the size stored in the IPv4 header or rewrite the IP header total length
  145. to reflect the stored packet length.
  146. .sp 1
  147. \fBpad\fP
  148. Truncated packets will be padded out so that the packet length matches the
  149. IPv4 total length
  150. .sp 1
  151. \fBtrunc\fP
  152. Truncated packets will have their IPv4 total length field rewritten to match
  153. the actual packet length
  154. .sp 1
  155. \fBdel\fP
  156. Delete the packet
  157. .TP
  158. .BR \--skipl2broadcast
  159. Skip rewriting broadcast/multicast Layer 2 addresses.
  160. .sp
  161. By default, editing Layer 2 addresses will rewrite
  162. broadcast and multicast MAC addresses. Setting this flag
  163. will keep broadcast/multicast MAC addresses from being rewritten.
  164. .TP
  165. .BR \--dlt "=\fIstring\fP"
  166. Override output DLT encapsulation.
  167. This option may appear up to 1 times.
  168. .sp
  169. By default, no DLT (data link type) conversion will be made.
  170. To change the DLT type of the output pcap, select one of the following values:
  171. .sp 1
  172. \fBenet\fP
  173. Ethernet aka DLT_EN10MB
  174. .sp 1
  175. \fBhdlc\fP
  176. Cisco HDLC aka DLT_C_HDLC
  177. .sp 1
  178. \fBuser\fP
  179. User specified Layer 2 header and DLT type
  180. .br
  181. .TP
  182. .BR \--enet-dmac "=\fIstring\fP"
  183. Override destination ethernet MAC addresses.
  184. This option may appear up to 1 times.
  185. .sp
  186. Takes a pair of comma deliminated ethernet MAC addresses which
  187. will replace the destination MAC address of outbound packets.
  188. The first MAC address will be used for the server to client traffic
  189. and the optional second MAC address will be used for the client
  190. to server traffic.
  191. Example:
  192. .nf
  193. \--enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66
  194. .fi
  195. .TP
  196. .BR \--enet-smac "=\fIstring\fP"
  197. Override source ethernet MAC addresses.
  198. This option may appear up to 1 times.
  199. .sp
  200. Takes a pair of comma deliminated ethernet MAC addresses which
  201. will replace the source MAC address of outbound packets.
  202. The first MAC address will be used for the server to client traffic
  203. and the optional second MAC address will be used for the client
  204. to server traffic.
  205. Example:
  206. .nf
  207. \--enet-smac=00:12:13:14:15:16,00:22:33:44:55:66
  208. .fi
  209. .TP
  210. .BR \--enet-vlan "=\fIstring\fP"
  211. Specify ethernet 802.1q VLAN tag mode.
  212. This option may appear up to 1 times.
  213. .sp
  214. Allows you to rewrite ethernet frames to add a 802.1q header to standard 802.3
  215. ethernet headers or remove the 802.1q VLAN tag information.
  216. .sp 1
  217. \fBadd\fP
  218. Rewrites the existing 802.3 ethernet header as an 802.1q VLAN header
  219. .sp 1
  220. \fBdel\fP
  221. Rewrites the existing 802.1q VLAN header as an 802.3 ethernet header
  222. .TP
  223. .BR \--enet-vlan-tag "=\fInumber\fP"
  224. Specify the new ethernet 802.1q VLAN tag value.
  225. This option may appear up to 1 times.
  226. This option must appear in combination with the following options:
  227. enet-vlan.
  228. This option takes an integer number as its argument.
  229. The value of \fInumber\fP is constrained to being:
  230. .in +4
  231. .nf
  232. .na
  233. in the range 0 through 4095
  234. .fi
  235. .in -4
  236. .sp
  237. .TP
  238. .BR \--enet-vlan-cfi "=\fInumber\fP"
  239. Specify the ethernet 802.1q VLAN CFI value.
  240. This option may appear up to 1 times.
  241. This option must appear in combination with the following options:
  242. enet-vlan.
  243. This option takes an integer number as its argument.
  244. The value of \fInumber\fP is constrained to being:
  245. .in +4
  246. .nf
  247. .na
  248. in the range 0 through 1
  249. .fi
  250. .in -4
  251. .sp
  252. .TP
  253. .BR \--enet-vlan-pri "=\fInumber\fP"
  254. Specify the ethernet 802.1q VLAN priority.
  255. This option may appear up to 1 times.
  256. This option must appear in combination with the following options:
  257. enet-vlan.
  258. This option takes an integer number as its argument.
  259. The value of \fInumber\fP is constrained to being:
  260. .in +4
  261. .nf
  262. .na
  263. in the range 0 through 7
  264. .fi
  265. .in -4
  266. .sp
  267. .TP
  268. .BR \--hdlc-control "=\fInumber\fP"
  269. Specify HDLC control value.
  270. This option may appear up to 1 times.
  271. This option takes an integer number as its argument.
  272. .sp
  273. The Cisco HDLC header has a 1 byte "control" field. Apparently this should
  274. always be 0, but if you can use any 1 byte value.
  275. .TP
  276. .BR \--hdlc-address "=\fInumber\fP"
  277. Specify HDLC address.
  278. This option may appear up to 1 times.
  279. This option takes an integer number as its argument.
  280. .sp
  281. The Cisco HDLC header has a 1 byte "address" field which has two valid
  282. values:
  283. .sp 1
  284. \fB0x0F\fP
  285. Unicast
  286. .sp 1
  287. \fB0xBF\fP
  288. Broadcast
  289. .br
  290. You can however specify any single byte value.
  291. .TP
  292. .BR \--user-dlt "=\fInumber\fP"
  293. Set output file DLT type.
  294. This option may appear up to 1 times.
  295. This option takes an integer number as its argument.
  296. .sp
  297. Set the DLT value of the output pcap file.
  298. .TP
  299. .BR \--user-dlink "=\fIstring\fP"
  300. Rewrite Data-Link layer with user specified data.
  301. This option may appear up to 2 times.
  302. .sp
  303. Provide a series of comma deliminated hex values which will be
  304. used to rewrite or create the Layer 2 header of the packets.
  305. The first instance of this argument will rewrite both server
  306. and client traffic, but if this argument is specified a second
  307. time, it will be used for the client traffic.
  308. Example:
  309. .nf
  310. \--user-dlink=01,02,03,04,05,06,00,1A,2B,3C,4D,5E,6F,08,00
  311. .fi
  312. .TP
  313. .BR \-d " \fInumber\fP, " \--dbug "=" \fInumber\fP
  314. Enable debugging output.
  315. This option may appear up to 1 times.
  316. This option takes an integer number as its argument.
  317. The value of \fInumber\fP is constrained to being:
  318. .in +4
  319. .nf
  320. .na
  321. in the range 0 through 5
  322. .fi
  323. .in -4
  324. The default \fInumber\fP for this option is:
  325. .ti +4
  326. 0
  327. .sp
  328. If configured with \--enable-debug, then you can specify a verbosity
  329. level for debugging output. Higher numbers increase verbosity.
  330. .TP
  331. .BR \-q ", " \--quiet
  332. Quiet mode.
  333. .sp
  334. Print nothing except the statistics at the end of the run
  335. .TP
  336. .BR \-a ", " \--accurate
  337. Enable more accurate packet timing.
  338. This option may appear up to 1 times.
  339. This option must not appear in combination with any of the following options:
  340. accurate2.
  341. .sp
  342. Enables more accurate timing between packets at the cost of higher
  343. CPU utilization by using the gettimeofday() system call. This method
  344. works better on some systems then others and may have rather non-granular
  345. resolution which makes it problematic for replaying at high rates of speed.
  346. .TP
  347. .BR \--accurate2 "=\fInumber\fP"
  348. Enable even more accurate packet timing.
  349. This option may appear up to 1 times.
  350. This option must not appear in combination with any of the following options:
  351. accurate.
  352. This option takes an integer number as its argument.
  353. .sp
  354. Enables the "even more" accurate timing at the cost of higher CPU
  355. utilization by using a tight loop which increments a counter. This method
  356. provides the most accurate timing of any option, but requires you to specify
  357. a cost for each loop. This cost value is VERY system dependent, so you will
  358. need to run \--loop-test to get this value.
  359. .TP
  360. .BR \-v ", " \--verbose
  361. Print decoded packets via tcpdump to STDOUT.
  362. This option may appear up to 1 times.
  363. .sp
  364. .TP
  365. .BR \-A " \fIstring\fP, " \--decode "=" \fIstring\fP
  366. Arguments passed to tcpdump decoder.
  367. This option may appear up to 1 times.
  368. This option must appear in combination with the following options:
  369. verbose.
  370. .sp
  371. When enabling verbose mode (\fB-v\fP) you may also specify one or more
  372. additional arguments to pass to \fBtcpdump\fP to modify the way packets
  373. are decoded. By default, \-n and \-l are used. Be sure to
  374. quote the arguments like: \-A "-axxx" so that they are not interpreted
  375. by tcpreplay. Please see the tcpdump(1) man page for a complete list of
  376. options.
  377. .TP
  378. .BR \-K ", " \--enable-file-cache
  379. Enable caching of packets to internal memory.
  380. This option must appear in combination with the following options:
  381. loop.
  382. .sp
  383. Cache pcap file(s) the first time they are cached in RAM so that subsequent
  384. loops don't incurr any disk I/O latency in order to increase performance. Make
  385. sure you have enough free RAM to store the entire pcap file(s) in memory or the
  386. system will swap and performance will suffer.
  387. .TP
  388. .BR \-c " \fIstring\fP, " \--cachefile "=" \fIstring\fP
  389. Split traffic via a tcpprep cache file.
  390. This option may appear up to 1 times.
  391. .sp
  392. .TP
  393. .BR \-i " \fIstring\fP, " \--intf1 "=" \fIstring\fP
  394. Server/primary traffic output interface.
  395. This option may appear up to 1 times.
  396. .sp
  397. .TP
  398. .BR \-I " \fIstring\fP, " \--intf2 "=" \fIstring\fP
  399. Client/secondary traffic output interface.
  400. This option may appear up to 1 times.
  401. This option must appear in combination with the following options:
  402. cachefile.
  403. .sp
  404. .TP
  405. .BR \--listnics
  406. List available network interfaces and exit.
  407. .sp
  408. .TP
  409. .BR \-l " \fInumber\fP, " \--loop "=" \fInumber\fP
  410. Loop through the capture file X times.
  411. This option may appear up to 1 times.
  412. This option takes an integer number as its argument.
  413. The value of \fInumber\fP is constrained to being:
  414. .in +4
  415. .nf
  416. .na
  417. greater than or equal to 0
  418. .fi
  419. .in -4
  420. The default \fInumber\fP for this option is:
  421. .ti +4
  422. 1
  423. .sp
  424. .TP
  425. .BR \--pktlen
  426. Override the snaplen and use the actual packet len.
  427. This option may appear up to 1 times.
  428. .sp
  429. By default, tcpreplay will send packets based on the size of the "snaplen"
  430. stored in the pcap file which is usually the correct thing to do. However,
  431. occasionally, tools will store more bytes then told to. By specifying this
  432. option, tcpreplay will ignore the snaplen field and instead try to send
  433. packets based on the original packet length. Bad things may happen if
  434. you specify this option.
  435. .TP
  436. .BR \-L " \fInumber\fP, " \--limit "=" \fInumber\fP
  437. Limit the number of packets to send.
  438. This option may appear up to 1 times.
  439. This option takes an integer number as its argument.
  440. The value of \fInumber\fP is constrained to being:
  441. .in +4
  442. .nf
  443. .na
  444. greater than or equal to 1
  445. .fi
  446. .in -4
  447. The default \fInumber\fP for this option is:
  448. .ti +4
  449. \-1
  450. .sp
  451. By default, tcpreplay will send all the packets. Alternatively, you can
  452. specify a maximum number of packets to send.
  453. .TP
  454. .BR \-x " \fIstring\fP, " \--multiplier "=" \fIstring\fP
  455. Modify replay speed to a given multiple.
  456. This option may appear up to 1 times.
  457. This option must not appear in combination with any of the following options:
  458. pps, mbps, oneatatime, topspeed.
  459. .sp
  460. Specify a floating point value to modify the packet replay speed.
  461. Examples:
  462. .nf
  463. 2.0 will replay traffic at twice the speed captured
  464. 0.7 will replay traffic at 70% the speed captured
  465. .fi
  466. .TP
  467. .BR \-p " \fInumber\fP, " \--pps "=" \fInumber\fP
  468. Replay packets at a given packets/sec.
  469. This option may appear up to 1 times.
  470. This option must not appear in combination with any of the following options:
  471. multiplier, mbps, oneatatime, topspeed.
  472. This option takes an integer number as its argument.
  473. .sp
  474. .TP
  475. .BR \-M " \fIstring\fP, " \--mbps "=" \fIstring\fP
  476. Replay packets at a given Mbps.
  477. This option may appear up to 1 times.
  478. This option must not appear in combination with any of the following options:
  479. multiplier, pps, oneatatime, topspeed.
  480. .sp
  481. Specify a floating point value for the Mbps rate that tcpreplay
  482. should send packets at.
  483. .TP
  484. .BR \-t ", " \--topspeed
  485. Replay packets as fast as possible.
  486. This option must not appear in combination with any of the following options:
  487. mbps, multiplier, pps, oneatatime.
  488. .sp
  489. .TP
  490. .BR \-o ", " \--oneatatime
  491. Replay one packet at a time for each user input.
  492. This option must not appear in combination with any of the following options:
  493. mbps, pps, multiplier, topspeed.
  494. .sp
  495. Allows you to step through one or more packets at a time.
  496. .TP
  497. .BR \-P ", " \--pid
  498. Print the PID of tcpreplay at startup.
  499. .sp
  500. .TP
  501. .BR \-V ", " \--version
  502. Print version information.
  503. .sp
  504. .TP
  505. .BR \-h ", " \--less-help
  506. Display less usage information and exit.
  507. .sp
  508. .TP
  509. .BR \-H , " \--help"
  510. Display usage information and exit.
  511. .TP
  512. .BR \-! , " \--more-help"
  513. Extended usage information passed thru pager.
  514. .TP
  515. .BR \- " [\fIrcfile\fP]," " \--save-opts" "[=\fIrcfile\fP]"
  516. Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
  517. configuration file listed in the \fBOPTION PRESETS\fP section, below.
  518. .TP
  519. .BR \- " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " \--no-load-opts"
  520. Load options from \fIrcfile\fP.
  521. The \fIno-load-opts\fP form will disable the loading
  522. of earlier RC/INI files. \fI--no-load-opts\fP is handled early,
  523. out of order.
  524. .SH OPTION PRESETS
  525. Any option that is not marked as \fInot presettable\fP may be preset
  526. by loading values from configuration ("RC" or ".INI") file(s).
  527. The \fIhomerc\fP file is "\fI$$/\fP", unless that is a directory.
  528. In that case, the file "\fI.tcpreplayrc\fP"
  529. is searched for within that directory.
  530. .SH "SIGNALS"
  531. tcpreplay understands the following signals:
  532. .sp
  533. .IR "\fBSIGUSR1\fP"
  534. Suspend tcpreplay
  535. .sp
  536. .IR "\fBSIGCONT\fP"
  537. Restart tcpreplay
  538. .br
  539. .SH "SEE ALSO"
  540. tcpreplay-edit(1), tcpdump(1), tcpprep(1), tcprewrite(1), libnet(3)
  541. .SH "BUGS"
  542. tcpreplay can only send packets as fast as your computer's interface,
  543. processor, disk and system bus will allow.
  544. Replaying captured traffic may simulate odd or broken conditions on your
  545. network and cause problems.
  546. In most cases, you can not replay traffic back to/at a server.
  547. Some operating systems by default do not allow for forging source MAC
  548. addresses. Please consult your operating system's documentation and the
  549. tcpreplay FAQ if you experiance this issue.
  550. .SH AUTHOR
  551. Copyright 2000-2007 Aaron Turner
  552. For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
  553. The latest version of this software is always available from:
  554. http://tcpreplay.synfin.net/
  555. .PP
  556. Released under the Free BSD License.
  557. .PP
  558. This manual page was \fIAutoGen\fP-erated from the \fBtcpreplay\fP
  559. option definitions.