tcpreplay.8 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. .\" $Id: tcpreplay.8 1132 2005-02-09 01:30:59Z aturner $
  2. .TH "TCPREPLAY" "8" "2.0.3" "Aaron Turner" "Replay Captured Network Traffic"
  3. .SH "NAME"
  4. .LP
  5. tcpreplay \- replay packets back out onto the network from pcap files
  6. .SH "SYNTAX"
  7. .LP
  8. \fBtcpreplay\fR
  9. \fB\-i\fR \fIintf\fR
  10. [ \fBoptions\fR ]
  11. [ \fI<file1> <file2> ...\fR | \- ]
  12. .SH "DESCRIPTION"
  13. .LP
  14. \fBtcpreplay\fR is a tool for replaying network traffic from files saved with
  15. \fBtcpdump\fR or other tools which write \fBpcap(3)\fR files.
  16. .LP
  17. The basic operation of \fBtcpreplay\fR is to resend all packets from the
  18. input file(s) at the speed at which they were recorded, or a specified data
  19. rate, up to as fast as the hardware is capable.
  20. .LP
  21. Optionally, the traffic can be split between two interfaces, written to files,
  22. filtered and edited in various ways, providing the means to test firewalls,
  23. NIDS and other network devices.
  24. .SH "OPTIONS"
  25. .LP
  26. .TP
  27. .B \-A or "tcpdump_args"
  28. When enabling verbose mode (\-v) you may also specify one or more
  29. additional arguments to pass to \fBtcpdump\fR to modify the way
  30. packets are decoded. By default, \-n and \-l are used. Be sure to
  31. quote the arguments like: \-A "\-axxx" so that they are not interpreted by
  32. tcpreplay. The following arguments are vaild:
  33. .br
  34. [ \-aAeNqRStuvxX ]
  35. .br
  36. [ \-E spi@ipaddr algo:secret,...]
  37. .br
  38. [ \-s snaplen ]
  39. .TP
  40. .TP
  41. .B \-c or "cachefile"
  42. Specify the \fItcpprep cache\fR to use to process packets.
  43. .TP
  44. .B \-C or "cidr"
  45. Given a list of CIDR networks, packets with a source address matching an
  46. entry in the list are sent out the primary interface. All other packets
  47. are sent via the secondary interface. CIDR lists are comma\-separated
  48. and do not contain spaces, \fI192.168.0.0/28,10.0.0.0/16\fR and
  49. \fI10.1.1.0/29\fR, for example. Overrides the \-c option.
  50. .TP
  51. .B \-D or "datadump_mode"
  52. When used in conjunction with \-w and \-W, rather then dumping the entire
  53. packets to the files, only the layer 7 data is dumped.
  54. .TP
  55. .B \-e or "endpoints"
  56. Specifies a pair of IP addresses seperated by a colon which are then used
  57. to rewrite all IP traffic to appear to be between the two IP's.
  58. .TP
  59. .B \-f
  60. Specify a file that contains configuration options.
  61. Option tokens are listed next to the corresponding command\-line flag.
  62. .TP
  63. .B \-F or "fixchecksums"
  64. Fixes IP and TCP/UDP checksums in packets. Auto\-forced with \-s, \-u, \-T \-N or \-4
  65. .TP
  66. .B \-h
  67. Prints help/usage
  68. .TP
  69. .B \-i or "intf"
  70. Specify the prmary interface in which to send packets.
  71. .TP
  72. .B \-I or "primary_mac"
  73. Specify the \fIdestination MAC\fR to use for packets being sent out the primary
  74. interface.
  75. .TP
  76. .B \-j or "second_intf"
  77. Specify the \fIsecondary interface\fR in which to send packets.
  78. .TP
  79. .B \-J or "second_mac"
  80. Specify the \fIdestination MAC\fR to use for packets being sent out the
  81. secondary interface.
  82. .TP
  83. .B \-k or "primary_smac"
  84. Specify the \fIsource MAC\fR to use for packets being sent out the primary
  85. interface.
  86. .TP
  87. .B \-K or "second_smac"
  88. Specify the \fIsource MAC\fR to use for packets being sent out the
  89. secondary interface.
  90. .TP
  91. .B \-l or "loop"
  92. Resend the capture file(s) \fIloop count\fR times. Setting this to 0 (zero)
  93. will cause tcpreplay to loop infinitely.
  94. .TP
  95. .B \-L or "limit_send"
  96. Causes tcpreplay to exit after sending the specified number of packets
  97. .TP
  98. .B \-m or "multiplier"
  99. Resend the packets at a \fImultiple\fR of the speed at which they were
  100. recorded, specified as a floating\-point number.
  101. .TP
  102. .B \-M or "no_martians"
  103. Disable sending martian packets (source networks: 0/8, 127/8, 255/8)
  104. .TP
  105. .B \-n or "not_nosy"
  106. Don't listen in promiscuous mode when sniffing with \-S
  107. .TP
  108. .B \-N or "nat"
  109. Specify the nat transation table(s) where a table is one or more pairs of
  110. CIDR's seperated by a colon and each pair is sererated by a comma:
  111. .br
  112. <FROMCIDR1>:<TOCIDR1>,<FROMCIDR2>:<TOCIDR2>
  113. .br
  114. The first instance of this argument is used for the primary interface while
  115. the second instance is used for the secondary interface. If no second
  116. instance of this argument exists, then the NAT table is used for both.
  117. .TP
  118. .B \-o or "offset"
  119. Jump to packet at the nearest specified byte offset and start replaying packets from there.
  120. .TP
  121. .B \-O or "one_output"
  122. Processes packets internally for dual interfaces/files for purposes of NAT and MAC
  123. rewriting, but only write packets to a single interface or file.
  124. .TP
  125. .B \-p or "packetrate"
  126. Specify the replay rate in packets per second. Negates all other
  127. speed options.
  128. .TP
  129. .B \-P
  130. .br
  131. Print the PID of the tcpreplay process at startup. Useful when wanting to
  132. use SIGUSR1 and SIGCONT to pause/restart.
  133. .TP
  134. .B \-r or "rate"
  135. Resend the packets at \fIrate\fR megabits per\-second, specified as a
  136. floating\-point number.
  137. .TP
  138. .B \-R or "topspeed"
  139. Resend the packets as fast as possible. Negates all other speed options.
  140. .TP
  141. .B \-s or "seed"
  142. Specify a seed value to allow rewriting the source and destination IP
  143. addresses (only in IP header) to pseudo\-random values. Will also recalculate
  144. the IP header as necessary.
  145. .TP
  146. .B \-S or "sniff_snaplen"
  147. Instead of reading from a saved tcpdump file, perform live capture.
  148. The argument is the number of bytes to capture off the wire.
  149. The name of the capture interface will be the nominal filename. Please
  150. read the FAQ for more details/warnings about this feature.
  151. .TP
  152. .B \-t or "mtu"
  153. Specify the MTU in bytes of the interface(s) being used. Default is 1500 which
  154. is standard for 10/100 Ethernet.
  155. .TP
  156. .B \-T or "truncate"
  157. If a packet is larger then the MTU of the interface, the frame will be truncated
  158. so that it can be sent. With out this, these frames are skipped. Not to be
  159. confused with \-u which pads/truncates packets which are larger then the snaplen
  160. used to capture the packet.
  161. .TP
  162. .B \-u or "untruncate"
  163. When a packet is truncated in the capture file because the snaplen was too small,
  164. this option will \fIpad\fR the end of the packet with zeros, or
  165. truncate (\fItrunc\fR) it by re\-adjusting the length in the IP header.
  166. The \fItrunc\fR option will only alter IPv4 packets, all others will be sent
  167. unmodified.
  168. .TP
  169. .B \-v or "verbose"
  170. .br
  171. Verbose mode, dump decoded packets via tcpdump to STDOUT.
  172. .TP
  173. .B \-V
  174. Print version info and exit.
  175. .TP
  176. .B \-w or "write"
  177. Specify the output file to write the primary packets to instead of the network.
  178. You still must specify the primary interface via \-i. If \-D is set before it,
  179. it will write only the layer 7 data.
  180. .TP
  181. .B \-W or "secondary_write"
  182. Specify the output file to write the secondary packets to instead of the
  183. network. You still must specify the secondary interface via \-j. If \-D is
  184. set before it, it will write only the layer 7 data.
  185. .TP
  186. .B \-x or "include"
  187. Specifies which packets from the capture file(s) to send. Can be one of:
  188. .br
  189. .br
  190. .TP
  191. .LP
  192. S:<CIDR1>,... Src IP must match specified CIDR(s)
  193. .TP
  194. .LP
  195. D:<CIDR1>,... Dst IP must match specified CIDR(s)
  196. .TP
  197. .LP
  198. B:<CIDR1>,... Both src and dst addresses must match
  199. .TP
  200. .LP
  201. E:<CIDR1>,... Either src or dst address must match
  202. .TP
  203. .LP
  204. P:<list> Must be one of the listed packets where the list corresponds to the packet number in the capture file. Ex: \-x P:1\-5,9,15 would only send packets 1 through 5, 9 and 15.
  205. .TP
  206. .LP
  207. F:"<filter>" BPF filter. See the \fBtcpdump(1)\fR man page for syntax.
  208. .TP
  209. .B \-X or "exclude"
  210. Specifies which packets from the capture file(s) to NOT send. Can be one of:
  211. .TP
  212. .LP
  213. S:<CIDR1>,... Src IP must match specified CIDR(s)
  214. .TP
  215. .LP
  216. D:<CIDR1>,... Dst IP must match specified CIDR(s)
  217. .TP
  218. .LP
  219. B:<CIDR1>,... Both src and dst addresses must match
  220. .TP
  221. .LP
  222. E:<CIDR1>,... Either src or dst address must match
  223. .TP
  224. .LP
  225. P:<list> Must be one of the listed packets where the list corresponds to the packet number in the capture file. Ex: \-X P:1\-5,9,15 would send all packets except 1 through 5, 9 and 15.
  226. .TP
  227. .B \-1 or one_at_a_time
  228. Resend one packet at a time, once for each keypress.
  229. .TP
  230. .B \-2 or l2data
  231. Specifies a string of comma seperated numbers in hex to be used instead of the
  232. Layer 2 header in the packet. Useful for converting between 802.x types or
  233. adding a header when the pcap file doesn't contain a header (as in the case of
  234. DLT_RAW). Currently this only supports the following pcap(3) types:
  235. DLT_EN10MB, DLT_LINUX_SLL, DLT_CHDLC and DLT_RAW.
  236. .TP
  237. .B \-4 or "portmap"
  238. Specify a port mapping, where the mapping looks like:
  239. .br
  240. <FROMPORT1>:<TOPORT1>,<FROMPORT2>:<TOPORT2>
  241. .br
  242. For example, if this mapping was specified:
  243. .br
  244. 80:8080
  245. .br
  246. then any packets with a source or destination port of 80 would be changed to 8080. This option can be specified multiple times to specify multiple mappings. Mappings are not transitive: each source or destination port is mapped only once.
  247. .SH "SIGNALS"
  248. .LP
  249. .I Tcpreplay
  250. understands the following signals:
  251. .TP
  252. .B SIGUSR1
  253. Suspend tcpreplay.
  254. .TP
  255. .B SIGCONT
  256. Restart tcpreplay after it has been suspended.
  257. .SH "SEE ALSO"
  258. .LP
  259. tcpdump(1), tcpprep(1), capinfo(1), editcap(1)
  260. .SH "AUTHORS"
  261. .LP
  262. Aaron Turner
  263. .br
  264. Matt Undy, Anzen Computing.
  265. .br
  266. Matt Bing
  267. .br
  268. .SH "AVAILABILITY"
  269. .LP
  270. The current version is available via HTTP:
  271. .LP
  272. .RS
  273. .I http://www.sourceforge.net/projects/tcpreplay/
  274. .RE
  275. .SH "LIMITATIONS"
  276. .LP
  277. Please see the tcpreplay FAQ for a list of limitations and any possible
  278. work\-arounds:
  279. .I http://tcpreplay.sourceforge.net/