tcpprep.1 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. .\" yo there.
  2. .TH TCPPREP 1 "22 April 2004"
  3. .SH NAME
  4. tcpprep \- create a tcpreplay cache file from a saved capture file
  5. .SH SYNOPSIS
  6. .na
  7. .B tcpprep
  8. [
  9. .B \-a
  10. .B \-n
  11. [
  12. .I bridge
  13. |
  14. .I router
  15. |
  16. .I client
  17. |
  18. .I server
  19. ] |
  20. .B \-c
  21. .I CIDR,...
  22. |
  23. .B \-r
  24. .I regex
  25. |
  26. .B \-p
  27. ] [
  28. .B \-h
  29. |
  30. .B \-V
  31. ] [
  32. .B \-i
  33. .I pcapfile
  34. ] [
  35. .B \-v
  36. ] [
  37. .B \-m
  38. .I minmask
  39. ] [
  40. .B \-M
  41. .I maxmask
  42. ] [
  43. .B \-N
  44. .I client
  45. |
  46. .I server
  47. ] [
  48. .B \-R
  49. .I ratio
  50. ] [
  51. .B \-x
  52. .I include
  53. |
  54. .B \-X
  55. .I exclude
  56. ] [
  57. .B \-C
  58. .I comment
  59. ]
  60. .B \-o
  61. |
  62. .B \-P
  63. .I cachefile
  64. .br
  65. .ad
  66. .SH DESCRIPTION
  67. .LP
  68. .I Tcpprep
  69. is a program for creating a cache file for later use with \fItcpreplay(8)\fP. By
  70. using tcpprep to pre-process a pcap, tcpreplay in dual-nic mode can
  71. match the performance of the traditional tcpreplay single-nic mode.
  72. .LP
  73. The basic operation of
  74. .I tcpprep
  75. is to compare each packet from it's \fIinput file\fP and compare it to either
  76. a \fIregular expression\fP or against a list of \fICIDR\fP's. It then writes the
  77. result of this comparison to the \fIcache file\fP for later use with \fItcpreplay\fP.
  78. This \fIcache file\fP is a string of characters, with each bit representing
  79. a single packet. This provides an efficent and portable means of storing the
  80. necessary data.
  81. .SH OPTIONS
  82. .LP
  83. .TP
  84. .B \-a
  85. Auto mode. Tcpprep will try to learn the roles of systems on the
  86. network, and split traffic between the two interfaces based upon whether a
  87. system is classified as a "server" or "client". Servers are sent out the
  88. primary interface, clients out the secondary. Requires the use of -n and
  89. excludes the use of -c, -p and -r.
  90. .TP
  91. .B \-c
  92. CIDR mode. Specify a list of CIDR's (network1/masklen1,network2/masklen2,...)
  93. to match against the source IP of each packet. Packets matching any of the
  94. CIDR's are sent out the primary interface; remaining packets are sent out
  95. the secondary interface. Can't be used with -r or -a.
  96. .TP
  97. .B \-C
  98. Imbed a comment in the tcpprep cache file which can be later viewed via -P.
  99. .TP
  100. .B \-h
  101. Help.
  102. .TP
  103. .B \-i
  104. Input file (pcap format)
  105. .TP
  106. .B \-m
  107. Minimum mask length. Used in auto/router mode to set the minimum valid
  108. network size. Defaults to 30 (bits).
  109. .TP
  110. .B \-M
  111. Maximum mask length. Used in auto/router mode to set the maximum valid
  112. network size. Defaults to 8 (bits).
  113. .TP
  114. .B \-n
  115. Network type. Used to specify the network type in auto mode as either bridge,
  116. client, server or router. Required with -a.
  117. Bridge mode processes each packet to try to determine if the sender is a
  118. client or server. Once all the packets are processed, the results are weighed
  119. according to the server/client ratio (-R) and systems are assigned an
  120. interface. If tcpprep is unable to determine what role a system plays, tcpprep
  121. will abort.
  122. Client mode works just like bridge mode, except that unclassified systems are
  123. treated as clients.
  124. Server mode works just like bridge mode, except that unclassified systems are
  125. treated as servers.
  126. Router mode works just like bridge mode, except that after weighing is done,
  127. systems which are undetermined are considered a server if they fall inside a
  128. network known to contain other servers. Router mode will never abort on
  129. systems which can't be determined.
  130. Router mode trys to build a list of networks containing only servers
  131. and unknown IP's. It starts out with very large networks (8 bit netmask by
  132. default, change with -M) and works it's way down to the minimum mask len (-m).
  133. If tcpprep is unable to determine one or more networks which only contains
  134. servers and unknowns, tcpprep will abort.
  135. Port mode looks at the source/destination port of the TCP or UDP packet.
  136. Client traffic goes out the primary interface, and server traffic out the
  137. secondary interface. Non-TCP and UDP traffic goes out the same interface
  138. as non-IP traffic does. Note that this mode does not track IP addresses;
  139. so an IP may appear to jump between interfaces depending on if it is the
  140. client or server.
  141. In all cases, servers are sent out the primary interface, and clients out the
  142. secondary.
  143. .TP
  144. .B \-N
  145. Non-IP packet classification. Non-IP datagrams (such as arp) currently aren't
  146. handled by tcpprep. This option allows you to define an interface to send them
  147. out. Default is client.
  148. .TP
  149. .B \-o
  150. Output file (tcpreplay cache file)
  151. .TP
  152. .B \-p
  153. Port mode. Split TCP/UDP traffic based on the destination port.
  154. .TP
  155. .B -P
  156. Print the embeded tcpprep cache file comment.
  157. .TP
  158. .B \-r
  159. Regex mode. Specifies a regular expression to match against the source ip
  160. of each packet. Packets matching are sent out the primary interface;
  161. remaining packets are sent out the secondary interface. Can't be used
  162. with -a or -c.
  163. .TP
  164. .B \-R
  165. The ratio of server connections to client connections necessary to be
  166. classified as a server in auto mode. A system is classified as a server if
  167. [# server connections] >= ([# client connections] * [ratio]). Default is:
  168. 2.0
  169. .TP
  170. .B \-x
  171. Specifies which packets from the capture file(s) to send. Can be one of:
  172. .br
  173. .br
  174. S:<CIDR1>,... - Src IP must match specified CIDR(s)
  175. .br
  176. D:<CIDR1>,... - Dst IP must match specified CIDR(s)
  177. .br
  178. B:<CIDR1>,... - Both src and dst addresses must match
  179. .br
  180. E:<CIDR1>,... - Either src or dst address must match
  181. .br
  182. P:<list> - Must be one of the listed packets where the list corresponds to the
  183. packet number in the capture file. Ex: -x P:1-5,9,15 would only send packets 1
  184. through 5, 9 and 15.
  185. .br
  186. F:"<filter>" - BPF filter. See the tcpdump(8) man page for syntax.
  187. .TP
  188. .B \-X
  189. Specifies which packets from the capture file(s) to NOT send. Can be one of:
  190. .br
  191. S:<CIDR1>,... - Src IP must match specified CIDR(s)
  192. .br
  193. D:<CIDR1>,... - Dst IP must match specified CIDR(s)
  194. .br
  195. B:<CIDR1>,... - Both src and dst addresses must match
  196. .br
  197. E:<CIDR1>,... - Either src or dst address must match
  198. .br
  199. P:<list> - Must be one of the listed packets where the list corresponds to the
  200. packet number in the capture file. Ex: -X P:1-5,9,15 would send all packets except 1
  201. through 5, 9 and 15.
  202. .TP
  203. .B \-v
  204. Enable verbose status printing to stderr. (Probably only interesting
  205. for large input files.)
  206. .TP
  207. .B \-V
  208. Print version info and exit.
  209. .SH "SEE ALSO"
  210. tcpdump(8), tcpreplay(8), capinfo(1), editcap(1)
  211. .SH AUTHOR
  212. Aaron Turner
  213. .LP
  214. The current version is packaged with tcpreplay which is available via HTTP:
  215. .LP
  216. .RS
  217. .I http://www.sourceforge.net/projects/tcpreplay/
  218. .RE
  219. .SH BUGS
  220. There may be a memory leak in the auto mode portion of the code. I'm seeing
  221. tcpprep growing to almost 15MB on a 900MB input file.
  222. .LP
  223. Accuracy in auto modes and handling of non-IP datagrams could be improved by
  224. various means.
  225. .LP
  226. It would be nice to support compressed files and other file formats than just libpcap.
  227. .LP
  228. Please send bug reports to aturner@pobox.com.