node6.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <!--Converted with LaTeX2HTML 2002-2-1 (1.70)
  3. original version by: Nikos Drakos, CBLU, University of Leeds
  4. * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
  5. * with significant contributions from:
  6. Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
  7. <HTML>
  8. <HEAD>
  9. <TITLE>5 Common Questions from Users</TITLE>
  10. <META NAME="description" CONTENT="5 Common Questions from Users">
  11. <META NAME="keywords" CONTENT="FAQ">
  12. <META NAME="resource-type" CONTENT="document">
  13. <META NAME="distribution" CONTENT="global">
  14. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
  15. <META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
  16. <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
  17. <LINK REL="STYLESHEET" HREF="FAQ.css">
  18. <LINK REL="next" HREF="node7.html">
  19. <LINK REL="previous" HREF="node5.html">
  20. <LINK REL="up" HREF="FAQ.html">
  21. <LINK REL="next" HREF="node7.html">
  22. </HEAD>
  23. <BODY >
  24. <DIV CLASS="navigation"><!--Navigation Panel-->
  25. <A NAME="tex2html212"
  26. HREF="node7.html">
  27. <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
  28. <A NAME="tex2html208"
  29. HREF="FAQ.html">
  30. <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
  31. <A NAME="tex2html202"
  32. HREF="node5.html">
  33. <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
  34. <A NAME="tex2html210"
  35. HREF="node1.html">
  36. <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
  37. <BR>
  38. <B> Next:</B> <A NAME="tex2html213"
  39. HREF="node7.html">6 Required Libraries and</A>
  40. <B> Up:</B> <A NAME="tex2html209"
  41. HREF="FAQ.html">Tcpreplay 3.x FAQ</A>
  42. <B> Previous:</B> <A NAME="tex2html203"
  43. HREF="node5.html">4 Common Error and</A>
  44. &nbsp; <B> <A NAME="tex2html211"
  45. HREF="node1.html">Contents</A></B>
  46. <BR>
  47. <BR></DIV>
  48. <!--End of Navigation Panel-->
  49. <!--Table of Child-Links-->
  50. <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
  51. <UL CLASS="ChildLinks">
  52. <LI><A NAME="tex2html214"
  53. HREF="node6.html#SECTION00061000000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">1</SPAN> Why is tcpreplay not sending all the packets?</A>
  54. <LI><A NAME="tex2html215"
  55. HREF="node6.html#SECTION00062000000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">2</SPAN> Can tcpreplay read gzip/bzip2 compressed files?</A>
  56. <LI><A NAME="tex2html216"
  57. HREF="node6.html#SECTION00063000000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">3</SPAN> How fast can tcpreplay send packets?</A>
  58. </UL>
  59. <!--End of Table of Child-Links-->
  60. <HR>
  61. <H1><A NAME="SECTION00060000000000000000">
  62. <SPAN CLASS="arabic">5</SPAN> Common Questions from Users</A>
  63. </H1>
  64. <P>
  65. <H2><A NAME="SECTION00061000000000000000">
  66. <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">1</SPAN> Why is tcpreplay not sending all the packets?</A>
  67. </H2>
  68. <P>
  69. Every now and then, someone emails the tcpreplay-users list, asking
  70. if there is a bug in tcpreplay which causes it not to send all the
  71. packets. This usually happens when the user uses the -t flag or is
  72. replaying a high-speed pcap file (&gt; 50Mbps, although this number is
  73. dependant on the hardware in use).
  74. <P>
  75. The short version of the answer is: no, we are not aware of any bugs
  76. which might cause a few packets to not be sent.
  77. <P>
  78. The longer version goes something like this:
  79. <P>
  80. If you are running tcpreplay multiple times and are using tcpdump
  81. or other packet sniffer to count the number packets sent and are getting
  82. different numbers, it's not tcpreplay's fault. The problem lies in
  83. one of two places:
  84. <P>
  85. <OL>
  86. <LI>It is well known that tcpdump and other sniffers have a problem keeping
  87. up with high-speed traffic. Furthermore, the OS in many cases <SPAN CLASS="textit">lies</SPAN>
  88. about how many packets were dropped. Tcpdump will repeat this lie
  89. to you. In other words, tcpdump isn't seeing all the packets. Usually
  90. this is a problem with the network card, driver or OS kernel which
  91. may or may not be fixable. Try another network card/driver.
  92. </LI>
  93. <LI>When tcpreplay sends a packet, it actually gets copied to a send buffer
  94. in the kernel. If this buffer is full, the kernel is supposed to tell
  95. tcpreplay that it didn't copy the packet to this buffer. If the kernel
  96. has a bug which squelches this error, tcpreplay will not keep trying
  97. to send the packet and will move on to the next one. Currently I am
  98. not aware of any OS kernels with this bug, but it is possible that
  99. it exists. If you find out that your OS has this problem, please let
  100. me know so I can list it here.
  101. </LI>
  102. </OL>
  103. If for some reason, you still think its a bug in tcpreplay, by all
  104. means read the code and tell me how stupid I am. The do_packets()
  105. function in do_packets.c is where tcpreplay processes the pcap file
  106. and sends all of the packets.
  107. <P>
  108. <H2><A NAME="SECTION00062000000000000000">
  109. <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">2</SPAN> Can tcpreplay read gzip/bzip2 compressed files?</A>
  110. </H2>
  111. <P>
  112. Yes, but not directly. Since tcpreplay can read data via STDIN, you
  113. can decompress the file on the fly like this:
  114. <P>
  115. <SPAN CLASS="textit">gzcat myfile.pcap.gz | tcpreplay -i eth0 -</SPAN>
  116. <P>
  117. Note that decompressing on the fly will require additional CPU time
  118. and will likely reduce the overall performance of tcpreplay.
  119. <P>
  120. <H2><A NAME="SECTION00063000000000000000">
  121. <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">3</SPAN> How fast can tcpreplay send packets?</A>
  122. </H2>
  123. <P>
  124. First, if performance is important to you, then upgrading to tcpreplay
  125. 3.x is worthwhile since it is more optimized then the 2.x series.
  126. After that, there are a number of variables which effect performance,
  127. including on how you measure it (packets/sec or bytes/sec). 100Mbps
  128. and 120K pps are quite doable. Generally speaking here are some points
  129. to consider:
  130. <P>
  131. <UL>
  132. <LI>Profiling tcpreplay has shown that a significant amount of time is
  133. spent writing packets to the network. Hence, your OS kernel implimentation
  134. of writing to raw sockets is one of the most important aspects since
  135. that is where tcpreplay spends most of it's time.
  136. </LI>
  137. <LI>Like most network based I/O, it is faster to send the same amount
  138. of data in a few large packets then many small packets.
  139. </LI>
  140. <LI>Most operating systems will cache disk reads in RAM; hence making
  141. subsequent access to the file faster the second time.
  142. </LI>
  143. <LI>Re-opening small files repeatly will reduce performance. Consider
  144. using mergecap to generate a single large file.
  145. </LI>
  146. <LI>Network cards and drivers, disk speed (RPM is more important then
  147. seek), amount of RAM and system bus speed are all important.
  148. </LI>
  149. </UL>
  150. <P>
  151. <DIV CLASS="navigation"><HR>
  152. <!--Navigation Panel-->
  153. <A NAME="tex2html212"
  154. HREF="node7.html">
  155. <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
  156. <A NAME="tex2html208"
  157. HREF="FAQ.html">
  158. <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
  159. <A NAME="tex2html202"
  160. HREF="node5.html">
  161. <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
  162. <A NAME="tex2html210"
  163. HREF="node1.html">
  164. <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
  165. <BR>
  166. <B> Next:</B> <A NAME="tex2html213"
  167. HREF="node7.html">6 Required Libraries and</A>
  168. <B> Up:</B> <A NAME="tex2html209"
  169. HREF="FAQ.html">Tcpreplay 3.x FAQ</A>
  170. <B> Previous:</B> <A NAME="tex2html203"
  171. HREF="node5.html">4 Common Error and</A>
  172. &nbsp; <B> <A NAME="tex2html211"
  173. HREF="node1.html">Contents</A></B> </DIV>
  174. <!--End of Navigation Panel-->
  175. <ADDRESS>
  176. Aaron Turner
  177. 2005-08-07
  178. </ADDRESS>
  179. </BODY>
  180. </HTML>