tcpprep.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. <!-- Creator : groff version 1.18.1 -->
  2. <!-- CreationDate: Wed Dec 22 15:16:41 2004 -->
  3. <html>
  4. <head>
  5. <meta name="generator" content="groff -Thtml, see www.gnu.org">
  6. <meta name="Content-Style" content="text/css">
  7. <title>TCPPREP</title>
  8. </head>
  9. <body>
  10. <h1 align=center>TCPPREP</h1>
  11. <a href="#NAME">NAME</a><br>
  12. <a href="#SYNOPSIS">SYNOPSIS</a><br>
  13. <a href="#DESCRIPTION">DESCRIPTION</a><br>
  14. <a href="#OPTIONS">OPTIONS</a><br>
  15. <a href="#SEE ALSO">SEE ALSO</a><br>
  16. <a href="#AUTHOR">AUTHOR</a><br>
  17. <a href="#BUGS">BUGS</a><br>
  18. <hr>
  19. <a name="NAME"></a>
  20. <h2>NAME</h2>
  21. <!-- INDENTATION -->
  22. <table width="100%" border=0 rules="none" frame="void"
  23. cols="2" cellspacing="0" cellpadding="0">
  24. <tr valign="top" align="left">
  25. <td width="10%"></td>
  26. <td width="89%">
  27. <p>tcpprep &minus; create a tcpreplay cache file from a
  28. saved capture file</p>
  29. </td>
  30. </table>
  31. <a name="SYNOPSIS"></a>
  32. <h2>SYNOPSIS</h2>
  33. <!-- INDENTATION -->
  34. <table width="100%" border=0 rules="none" frame="void"
  35. cols="2" cellspacing="0" cellpadding="0">
  36. <tr valign="top" align="left">
  37. <td width="10%"></td>
  38. <td width="89%">
  39. <p><b>tcpprep</b> [ <b>&minus;a &minus;n</b> [ <i>bridge</i>
  40. | <i>router</i> | <i>client</i> | <i>server</i> ] |
  41. <b>&minus;c</b> <i>CIDR,...</i> | <b>&minus;r</b>
  42. <i>regex</i> | <b>&minus;p</b> ] [ <b>&minus;h</b> |
  43. <b>&minus;V</b> ] [ <b>&minus;i</b> <i>pcapfile</i> ] [
  44. <b>&minus;v</b> ] [ <b>&minus;m</b> <i>minmask</i> ] [
  45. <b>&minus;M</b> <i>maxmask</i> ] [ <b>&minus;N</b>
  46. <i>client</i> | <i>server</i> ] [ <b>&minus;R</b>
  47. <i>ratio</i> ] [ <b>&minus;x</b> <i>include</i> |
  48. <b>&minus;X</b> <i>exclude</i> ] [ <b>&minus;C</b>
  49. <i>comment</i> ] <b>&minus;o</b> | <b>&minus;P</b>
  50. <i>cachefile</i></p>
  51. </td>
  52. </table>
  53. <a name="DESCRIPTION"></a>
  54. <h2>DESCRIPTION</h2>
  55. <!-- INDENTATION -->
  56. <table width="100%" border=0 rules="none" frame="void"
  57. cols="2" cellspacing="0" cellpadding="0">
  58. <tr valign="top" align="left">
  59. <td width="10%"></td>
  60. <td width="89%">
  61. <p><i>Tcpprep</i> is a program for creating a cache file for
  62. later use with <i>tcpreplay(8)</i>. By using tcpprep to
  63. pre-process a pcap, tcpreplay in dual-nic mode can match the
  64. performance of the traditional tcpreplay single-nic
  65. mode.</p>
  66. <!-- INDENTATION -->
  67. <p>The basic operation of <i>tcpprep</i> is to compare each
  68. packet from it&rsquo;s <i>input file</i> and compare it to
  69. either a <i>regular expression</i> or against a list of
  70. <i>CIDR</i>&rsquo;s. It then writes the result of this
  71. comparison to the <i>cache file</i> for later use with
  72. <i>tcpreplay</i>. This <i>cache file</i> is a string of
  73. characters, with each bit representing a single packet. This
  74. provides an efficent and portable means of storing the
  75. necessary data.</p>
  76. </td>
  77. </table>
  78. <a name="OPTIONS"></a>
  79. <h2>OPTIONS</h2>
  80. <!-- TABS -->
  81. <table width="100%" border=0 rules="none" frame="void"
  82. cols="4" cellspacing="0" cellpadding="0">
  83. <tr valign="top" align="left">
  84. <td width="11%"></td>
  85. <td width="7%">
  86. <p><b>&minus;a</b></p>
  87. </td>
  88. <td width="2%"></td>
  89. <td width="77%">
  90. <p>Auto mode. Tcpprep will try to learn the roles of
  91. systems on the network, and split traffic between the two
  92. interfaces based upon whether a system is classified as a
  93. &quot;server&quot; or &quot;client&quot;. Servers are sent
  94. out the primary interface, clients out the secondary.
  95. Requires the use of -n and excludes the use of -c, -p and
  96. -r.</p>
  97. </td>
  98. <tr valign="top" align="left">
  99. <td width="11%"></td>
  100. <td width="7%">
  101. <p><b>&minus;c</b></p>
  102. </td>
  103. <td width="2%"></td>
  104. <td width="77%">
  105. <p>CIDR mode. Specify a list of CIDR&rsquo;s
  106. (network1/masklen1,network2/masklen2,...) to match against
  107. the source IP of each packet. Packets matching any of the
  108. CIDR&rsquo;s are sent out the primary interface; remaining
  109. packets are sent out the secondary interface. Can&rsquo;t be
  110. used with -r or -a.</p>
  111. </td>
  112. <tr valign="top" align="left">
  113. <td width="11%"></td>
  114. <td width="7%">
  115. <p><b>&minus;C</b></p>
  116. </td>
  117. <td width="2%"></td>
  118. <td width="77%">
  119. <p>Imbed a comment in the tcpprep cache file which can be
  120. later viewed via -P.</p>
  121. </td>
  122. <tr valign="top" align="left">
  123. <td width="11%"></td>
  124. <td width="7%">
  125. <p><b>&minus;h</b></p>
  126. </td>
  127. <td width="2%"></td>
  128. <td width="77%">
  129. <p>Help.</p>
  130. </td>
  131. <tr valign="top" align="left">
  132. <td width="11%"></td>
  133. <td width="7%">
  134. <p><b>&minus;i</b></p>
  135. </td>
  136. <td width="2%"></td>
  137. <td width="77%">
  138. <p>Input file (pcap format)</p>
  139. </td>
  140. <tr valign="top" align="left">
  141. <td width="11%"></td>
  142. <td width="7%">
  143. <p><b>&minus;m</b></p>
  144. </td>
  145. <td width="2%"></td>
  146. <td width="77%">
  147. <p>Minimum mask length. Used in auto/router mode to set the
  148. minimum valid network size. Defaults to 30 (bits).</p>
  149. </td>
  150. <tr valign="top" align="left">
  151. <td width="11%"></td>
  152. <td width="7%">
  153. <p><b>&minus;M</b></p>
  154. </td>
  155. <td width="2%"></td>
  156. <td width="77%">
  157. <p>Maximum mask length. Used in auto/router mode to set the
  158. maximum valid network size. Defaults to 8 (bits).</p>
  159. </td>
  160. <tr valign="top" align="left">
  161. <td width="11%"></td>
  162. <td width="7%">
  163. <p><b>&minus;n</b></p>
  164. </td>
  165. <td width="2%"></td>
  166. <td width="77%">
  167. <p>Network type. Used to specify the network type in auto
  168. mode as either bridge, client, server or router. Required
  169. with -a.</p>
  170. </td>
  171. </table>
  172. <!-- INDENTATION -->
  173. <table width="100%" border=0 rules="none" frame="void"
  174. cols="2" cellspacing="0" cellpadding="0">
  175. <tr valign="top" align="left">
  176. <td width="10%"></td>
  177. <td width="89%">
  178. <p>Bridge mode processes each packet to try to determine if
  179. the sender is a client or server. Once all the packets are
  180. processed, the results are weighed according to the
  181. server/client ratio (-R) and systems are assigned an
  182. interface. If tcpprep is unable to determine what role a
  183. system plays, tcpprep will abort.</p>
  184. <!-- INDENTATION -->
  185. <p>Client mode works just like bridge mode, except that
  186. unclassified systems are treated as clients.</p>
  187. <!-- INDENTATION -->
  188. <p>Server mode works just like bridge mode, except that
  189. unclassified systems are treated as servers.</p>
  190. <!-- INDENTATION -->
  191. <p>Router mode works just like bridge mode, except that
  192. after weighing is done, systems which are undetermined are
  193. considered a server if they fall inside a network known to
  194. contain other servers. Router mode will never abort on
  195. systems which can&rsquo;t be determined.</p>
  196. <!-- INDENTATION -->
  197. <p>Router mode trys to build a list of networks containing
  198. only servers and unknown IP&rsquo;s. It starts out with very
  199. large networks (8 bit netmask by default, change with -M)
  200. and works it&rsquo;s way down to the minimum mask len (-m).
  201. If tcpprep is unable to determine one or more networks which
  202. only contains servers and unknowns, tcpprep will abort.</p>
  203. <!-- INDENTATION -->
  204. <p>Port mode looks at the source/destination port of the TCP
  205. or UDP packet. Client traffic goes out the primary
  206. interface, and server traffic out the secondary interface.
  207. Non-TCP and UDP traffic goes out the same interface as
  208. non-IP traffic does. Note that this mode does not track IP
  209. addresses; so an IP may appear to jump between interfaces
  210. depending on if it is the client or server.</p>
  211. <!-- INDENTATION -->
  212. <p>In all cases, servers are sent out the primary interface,
  213. and clients out the secondary.</p>
  214. </td>
  215. </table>
  216. <!-- TABS -->
  217. <table width="100%" border=0 rules="none" frame="void"
  218. cols="4" cellspacing="0" cellpadding="0">
  219. <tr valign="top" align="left">
  220. <td width="11%"></td>
  221. <td width="4%">
  222. <p><b>&minus;N</b></p>
  223. </td>
  224. <td width="5%"></td>
  225. <td width="77%">
  226. <p>Non-IP packet classification. Non-IP datagrams (such as
  227. arp) currently aren&rsquo;t handled by tcpprep. This option
  228. allows you to define an interface to send them out. Default
  229. is client.</p>
  230. </td>
  231. <tr valign="top" align="left">
  232. <td width="11%"></td>
  233. <td width="4%">
  234. <p><b>&minus;o</b></p>
  235. </td>
  236. <td width="5%"></td>
  237. <td width="77%">
  238. <p>Output file (tcpreplay cache file)</p>
  239. </td>
  240. <tr valign="top" align="left">
  241. <td width="11%"></td>
  242. <td width="4%">
  243. <p><b>&minus;p</b></p>
  244. </td>
  245. <td width="5%"></td>
  246. <td width="77%">
  247. <p>Port mode. Split TCP/UDP traffic based on the
  248. destination port.</p>
  249. </td>
  250. <tr valign="top" align="left">
  251. <td width="11%"></td>
  252. <td width="4%">
  253. <p><b>-P</b></p>
  254. </td>
  255. <td width="5%"></td>
  256. <td width="77%">
  257. <p>Print the embeded tcpprep cache file comment.</p>
  258. </td>
  259. <tr valign="top" align="left">
  260. <td width="11%"></td>
  261. <td width="4%">
  262. <p><b>&minus;r</b></p>
  263. </td>
  264. <td width="5%"></td>
  265. <td width="77%">
  266. <p>Regex mode. Specifies a regular expression to match
  267. against the source ip of each packet. Packets matching are
  268. sent out the primary interface; remaining packets are sent
  269. out the secondary interface. Can&rsquo;t be used with -a or
  270. -c.</p>
  271. </td>
  272. <tr valign="top" align="left">
  273. <td width="11%"></td>
  274. <td width="4%">
  275. <p><b>&minus;R</b></p>
  276. </td>
  277. <td width="5%"></td>
  278. <td width="77%">
  279. <p>The ratio of server connections to client connections
  280. necessary to be classified as a server in auto mode. A
  281. system is classified as a server if [# server connections]
  282. &gt;= ([# client connections] * [ratio]). Default is:
  283. 2.0</p>
  284. </td>
  285. <tr valign="top" align="left">
  286. <td width="11%"></td>
  287. <td width="4%">
  288. <p><b>&minus;x</b></p>
  289. </td>
  290. <td width="5%"></td>
  291. <td width="77%">
  292. <p>Specifies which packets from the capture file(s) to
  293. send. Can be one of:</p>
  294. </td>
  295. </table>
  296. <!-- INDENTATION -->
  297. <table width="100%" border=0 rules="none" frame="void"
  298. cols="2" cellspacing="0" cellpadding="0">
  299. <tr valign="top" align="left">
  300. <td width="21%"></td>
  301. <td width="77%">
  302. <p>S:&lt;CIDR1&gt;,... - Src IP must match specified
  303. CIDR(s)<br>
  304. D:&lt;CIDR1&gt;,... - Dst IP must match specified
  305. CIDR(s)<br>
  306. B:&lt;CIDR1&gt;,... - Both src and dst addresses must
  307. match<br>
  308. E:&lt;CIDR1&gt;,... - Either src or dst address must
  309. match<br>
  310. P:&lt;list&gt; - Must be one of the listed packets where the
  311. list corresponds to the packet number in the capture file.
  312. Ex: -x P:1-5,9,15 would only send packets 1 through 5, 9 and
  313. 15.<br>
  314. F:&quot;&lt;filter&gt;&quot; - BPF filter. See the
  315. tcpdump(8) man page for syntax.</p>
  316. </td>
  317. </table>
  318. <!-- TABS -->
  319. <table width="100%" border=0 rules="none" frame="void"
  320. cols="4" cellspacing="0" cellpadding="0">
  321. <tr valign="top" align="left">
  322. <td width="11%"></td>
  323. <td width="2%">
  324. <p><b>&minus;X</b></p>
  325. </td>
  326. <td width="7%"></td>
  327. <td width="77%">
  328. <p>Specifies which packets from the capture file(s) to NOT
  329. send. Can be one of:</p>
  330. </td>
  331. </table>
  332. <!-- INDENTATION -->
  333. <table width="100%" border=0 rules="none" frame="void"
  334. cols="2" cellspacing="0" cellpadding="0">
  335. <tr valign="top" align="left">
  336. <td width="21%"></td>
  337. <td width="77%">
  338. <p>S:&lt;CIDR1&gt;,... - Src IP must match specified
  339. CIDR(s)<br>
  340. D:&lt;CIDR1&gt;,... - Dst IP must match specified
  341. CIDR(s)<br>
  342. B:&lt;CIDR1&gt;,... - Both src and dst addresses must
  343. match<br>
  344. E:&lt;CIDR1&gt;,... - Either src or dst address must
  345. match<br>
  346. P:&lt;list&gt; - Must be one of the listed packets where the
  347. list corresponds to the packet number in the capture file.
  348. Ex: -X P:1-5,9,15 would send all packets except 1 through 5,
  349. 9 and 15.</p>
  350. </td>
  351. </table>
  352. <!-- TABS -->
  353. <table width="100%" border=0 rules="none" frame="void"
  354. cols="4" cellspacing="0" cellpadding="0">
  355. <tr valign="top" align="left">
  356. <td width="11%"></td>
  357. <td width="2%">
  358. <p><b>&minus;v</b></p>
  359. </td>
  360. <td width="7%"></td>
  361. <td width="77%">
  362. <p>Enable verbose status printing to stderr. (Probably only
  363. interesting for large input files.)</p>
  364. </td>
  365. <tr valign="top" align="left">
  366. <td width="11%"></td>
  367. <td width="2%">
  368. <p><b>&minus;V</b></p>
  369. </td>
  370. <td width="7%"></td>
  371. <td width="77%">
  372. <p>Print version info and exit.</p>
  373. </td>
  374. </table>
  375. <a name="SEE ALSO"></a>
  376. <h2>SEE ALSO</h2>
  377. <!-- INDENTATION -->
  378. <table width="100%" border=0 rules="none" frame="void"
  379. cols="2" cellspacing="0" cellpadding="0">
  380. <tr valign="top" align="left">
  381. <td width="10%"></td>
  382. <td width="89%">
  383. <p>tcpdump(8), tcpreplay(8), capinfo(1), editcap(1)</p>
  384. </td>
  385. </table>
  386. <a name="AUTHOR"></a>
  387. <h2>AUTHOR</h2>
  388. <!-- INDENTATION -->
  389. <table width="100%" border=0 rules="none" frame="void"
  390. cols="2" cellspacing="0" cellpadding="0">
  391. <tr valign="top" align="left">
  392. <td width="10%"></td>
  393. <td width="89%">
  394. <p>Aaron Turner &lt;aturner@pobox.com&gt;</p>
  395. <!-- INDENTATION -->
  396. <p>The current version is packaged with tcpreplay which is
  397. available via HTTP:</p>
  398. </td>
  399. </table>
  400. <!-- INDENTATION -->
  401. <table width="100%" border=0 rules="none" frame="void"
  402. cols="2" cellspacing="0" cellpadding="0">
  403. <tr valign="top" align="left">
  404. <td width="20%"></td>
  405. <td width="79%">
  406. <p><i>http://www.sourceforge.net/projects/tcpreplay/</i></p></td>
  407. </table>
  408. <a name="BUGS"></a>
  409. <h2>BUGS</h2>
  410. <!-- INDENTATION -->
  411. <table width="100%" border=0 rules="none" frame="void"
  412. cols="2" cellspacing="0" cellpadding="0">
  413. <tr valign="top" align="left">
  414. <td width="10%"></td>
  415. <td width="89%">
  416. <p>There may be a memory leak in the auto mode portion of
  417. the code. I&rsquo;m seeing tcpprep growing to almost 15MB on
  418. a 900MB input file.</p>
  419. <!-- INDENTATION -->
  420. <p>Accuracy in auto modes and handling of non-IP datagrams
  421. could be improved by various means.</p>
  422. <!-- INDENTATION -->
  423. <p>It would be nice to support compressed files and other
  424. file formats than just libpcap.</p>
  425. <!-- INDENTATION -->
  426. <p>Please send bug reports to aturner@pobox.com.</p>
  427. </td>
  428. </table>
  429. <hr>
  430. </body>
  431. </html>