1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <refentry id="traffic_replay.7">
6 <refentrytitle>traffic_replay</refentrytitle>
7 <manvolnum>7</manvolnum>
8 <refmiscinfo class="source">Samba</refmiscinfo>
9 <refmiscinfo class="manual">User Commands</refmiscinfo>
10 <refmiscinfo class="version">&doc.version;</refmiscinfo>
15 <refname>traffic_replay</refname>
16 <refpurpose>Samba traffic generation tool.
22 <command>traffic_replay</command>
23 <arg choice="opt">-F, --fixed-password <test-password></arg>
24 <arg choice="opt">-S, --scale-traffic <scale by factor></arg>
25 <arg choice="opt">-r, --replay-rate <scale by factor></arg>
26 <arg choice="opt">-D, --duration <seconds></arg>
27 <arg choice="opt">--traffic-summary <output file></arg>
28 <arg choice="opt">-I, --instance-id <id></arg>
29 <arg choice="opt">-K, --prefer-kerberos</arg>
30 <arg choice="opt">-B, --badpassword-frequency <frequency></arg>
31 <arg choice="opt">--dns-rate <rate></arg>
32 <arg choice="opt">-t, --timing-data <file></arg>
33 <arg choice="opt">-U, --username user</arg>
34 <arg choice="opt">--password <password></arg>
35 <arg choice="opt">-W --workgroup <workgroup></arg>
36 <arg choice="opt">--realm <realm></arg>
37 <arg choice="opt">-s, --config-file <file></arg>
38 <arg choice="opt">-k, --kerberos <kerberos></arg>
39 <arg choice="opt">--ipaddress <address></arg>
40 <arg choice="opt">-P, --machine-pass</arg>
41 <arg choice="opt">--option <option></arg>
42 <arg choice="opt">-d, --debuglevel <debug level></arg>
43 <arg choice="req">summary-file</arg>
44 <arg choice="req">dns-hostname</arg>
48 <command>traffic_replay</command>
49 <arg choice="opt">-G, --generate-users-only</arg>
50 <arg choice="opt">-F, --fixed-password <test-password></arg>
51 <arg choice="opt">-n, --number-of-users <total users></arg>
52 <arg choice="opt">--number-of-groups <total groups></arg>
53 <arg choice="opt">--average-groups-per-user <average number></arg>
54 <arg choice="opt">--group-memberships <total memberships></arg>
55 <arg choice="req">dns-hostname</arg>
59 <command>traffic_replay</command>
60 <arg choice="req">-c|--clean-up</arg>
61 <arg choice="req">dns-hostname</arg>
65 <command>traffic_replay</command>
66 <arg choice="opt">-h, --help</arg>
67 <arg choice="opt">-V, --version</arg>
72 <title>DESCRIPTION</title>
73 <para>This tool is part of the <citerefentry><refentrytitle>samba</refentrytitle>
74 <manvolnum>7</manvolnum></citerefentry> suite.</para>
75 <para>This tool generates traffic in order to measure the performance
76 of a Samba DC, and to test how well Samba will scale as a network
77 increases in size. It can simulate multiple different hosts making
78 multiple different types of requests to a DC.</para>
80 <para>This tool is intended to run against a dedicated test DC (rather
81 than a live DC that is handling real network traffic).</para>
83 <para>Note that a side-effect of running this tool is that user
84 accounts will be created on the DC, in order to test various Samba
85 operations. As creating accounts can be very time-consuming, these
86 users will remain on the DC by default. To remove these accounts, use
87 the --clean-up option.
92 <title>OPTIONS</title>
97 <term>-h|--help</term>
99 Print a summary of command line options.
104 <term>summary-file</term>
106 File containing the network traffic to replay. This should either be
107 a traffic-summary (generated by <command>traffic_summary.pl</command>)
108 or a traffic-model (generated by <command>traffic_learner</command>).
109 Based on this file, this tool will generate 'conversations' which
110 represent Samba activity between a network host and the DC.
115 <term>dns-hostname</term>
117 The full DNS hostname of the DC that's being tested. The Samba activity
118 in the summary-file will be replicated and directed at this DC. It's
119 recommended that you use a dedicated DC for testing and don't try to run
120 this tool against a DC that's processing live network traffic.
125 <term>-F|--fixed-password <test-password></term>
127 Test users are created when this tool is run, so that actual Samba
128 activity, such as authorizing users, can be mimicked. This option
129 specifies the password that will be used for any test users that are
132 <para>Note that any users created by this tool will remain on the DC
133 until you run the --clean-up option. Therefore, the fixed-password
134 option needs to be the same each time the tool is run, otherwise the
135 test users won't authenticate correctly.
140 <term>Traffic Model Options</term>
142 When the summary-file is a traffic-model (produced by
143 <command>traffic_learner</command>), use these options to alter the
144 traffic that gets generated.</para>
147 <term>-D|--duration <seconds></term>
149 Specifies the approximate duration in seconds to generate
150 traffic for. The default is 60 seconds.
155 <term>-r|--replay-rate <factor></term>
157 Replays the traffic faster by this factor. This option won't
158 affect the number of conversations (which is based on the
159 traffic model), but the rate at which the packets are sent will
165 <term>-S|--scale-traffic <factor></term>
167 Increases the number of conversations by this factor. This
168 option won't affect the rate at which packets get sent (which
169 is still based on the traffic model), but it will mean more
170 conversations get replayed.
175 <term>--traffic-summary <output-file></term>
177 Instead of replaying a traffic-model, this option generates a
178 traffic-summary file based on what traffic would be sent. Using
179 a traffic-model allows you to scale the packet rate and number
180 of packets sent. However, using a traffic-model introduces
181 some randomness into the traffic generation. So running the
182 same traffic_replay command multiple times using a model file
183 may result in some differences in the actual traffic sent.
184 However, running the same traffic_replay command multiple times
185 with a traffic-summary file will always result in the same
186 traffic being sent. </para>
188 For taking performance measurements over several test runs,
189 it's recommended to use this option and replay the traffic from
190 a traffic-summary file.
198 <term>--generate-users-only</term>
199 <listitem><para>Add extra user/groups on the DC to increase the DB
200 size. By default, this tool automatically creates test users that map
201 to the traffic conversations being generated. This option allows extra
202 users to be created on top of this. Note that these extra users may
203 not actually used for traffic generation - the traffic generation is
204 still based on the number of conversations from the model/summary file.
208 Generating a large number of users can take a long time, so it this
209 option allows this to be done only once.</para>
211 <para>Note that the users created will remain on the DC until the
212 tool is run with the --clean-up option. This means that it is best to
213 only assign group memberships once, i.e. run --clean-up before
214 assigning a different allocation of group memberships.</para>
218 <term>-n|--number-of-users <total-users></term>
220 Specifies the total number of test users to create (excluding
221 any machine accounts required for the traffic). Note that these
222 extra users simply populate the DC's DB - the actual user
223 traffic generated is still based on the summary-file.
228 <term>--number-of-groups <total-groups></term>
230 Creates the specified number of groups, for assigning the test
231 users to. Note that users are not automatically assigned to
232 groups - use either --average-groups-per-user or
233 --group-membership to do this.
238 <term>--average-groups-per-user <average-groups></term>
240 Randomly assigns the test users to the test groups created.
241 The group memberships are distributed so that the overall
242 average groups that a user is member of matches this number.
243 Some users will belong to more groups and some users will
244 belong to fewer groups. This option is incompatible with
245 the --group-membership option.
250 <term>--group-memberships <total-memberships></term>
252 Randomly assigns the test users to the test groups created.
253 The group memberships are distributed so that the total
254 groups that a user is member of, across all users, matches
255 this number. For example, with 100 users and 10 groups,
256 --group-memberships=300 would assign a user to 3 groups
257 on average. Some users will belong to more groups and some
258 users will belong to fewer groups, but the total of all
259 member linked attributes would be 300. This option is
260 incompatible with the --group-membership option.
268 <term>--clean-up</term>
270 Cleans up any users and groups that were created by previously running
271 this tool. It is recommended you always clean up after running the tool.
276 <term>-I|--instance-id <id></term>
278 Use this option to run multiple instances of the tool on the same DC at
279 the same time. This adds a prefix to the test users generated to keep
280 them separate on the DC.
285 <term>-K|--prefer-kerberos</term>
287 Use Kerberos to authenticate the test users.
292 <term>-B|--badpassword-frequency <frequency></term>
294 Use this option to simulate users trying to authenticate with an
300 <term>--dns-rate <rate></term>
302 Increase the rate at which DNS packets get sent.
307 <term>-t|--timing-data <file></term>
309 This writes extra timing data to the file specified. This is mostly
310 used for reporting options, such as generating graphs.
315 <term>Samba Common Options</term>
318 &stdarg.client.debug;
322 <term>--realm=REALM</term>
333 <term>Credential Options</term>
337 <term>--simple-bind-dn=DN</term>
339 DN to use for a simple bind
344 <term>--password=PASSWORD</term>
351 <term>-U USERNAME|--username=USERNAME</term>
358 <term>-W WORKGROUP|--workgroup=WORKGROUP</term>
367 <term>--ipaddress=IPADDRESS</term>
369 IP address of the server
382 <title>OPERATIONS</title>
385 <title>Generating a traffic-summary file</title>
386 <para>To use this tool, you need either a traffic-summary file or a
387 traffic-model file. To generate either of these files, you will need a
388 packet capture of actual Samba activity on your network.</para>
390 <para>Use Wireshark to take a packet capture on your network of the
391 traffic you want to generate. For example, if you want to simulate lots
392 of users logging on, then take a capture at 8:30am when users are
395 <para>Next, you need to convert your packet capture into a traffic
396 summary file, using <command>traffic_summary.pl</command>. Basically
397 this removes any sensitive information from the capture and summarizes
398 what type of packet was sent and when.</para>
400 <para>Refer to the <command>traffic_summary.pl --help</command> help for more
401 details, but the basic command will look something like:</para>
403 <para><command>tshark -r capture.pcapng -T pdml |
404 traffic_summary.pl > traffic-summary.txt</command></para>
408 <title>Replaying a traffic-summary file</title>
409 <para>Once you have a traffic-summary file, you can use it to generate
410 traffic. The traffic_replay tool gets passed the traffic-summary file,
411 along with the full DNS hostname of the DC being tested. You also need
412 to provide some user credentials, and possibly the Samba realm and
413 workgroup (although the realm and workgroup may be determined
414 automatically, for example from the /etc/smb.conf file, if one is
415 present). E.g.</para>
417 <para><command>traffic_replay traffic-summary.txt
418 my-dc.samdom.example.com -UAdmin%password -W samdom
419 --realm=samdom.example.com --fixed-password=blahblah123!</command>
422 <para>This simply regenerates Samba activity seen in the traffic
423 summary. The traffic is grouped into 'conversations' between a host and
424 the DC. A user and machine account is created on the DC for each
425 conversation, in order to allow logon and other operations to succeed.
426 The script generates the same types of packets as those seen in the
429 <para>Creating users can be quite a time-consuming process, especially
430 if a lot of conversations are being generated. To save time, the test
431 users remain on the DC by default. You will need to run the --clean-up
432 option to remove them, once you have finished generating traffic.
433 Because the same test users are used across multiple runs of the tool,
434 a consistent password for these users needs to be used - this is
435 specified by the --fixed-password option.
438 <para>The benefit of this tool over simply using tcprelay is that the
439 traffic generated is independent of any specific network. No setup is
440 needed beforehand on the test DC. The traffic no longer contains
441 sensitive details, so the traffic summary could be potentially shared
442 with other Samba developers.</para>
444 <para>However, replaying a traffic-summary directly is somewhat limited
445 in what you can actually do. A more flexible approach is to generate
446 the traffic using a model file.</para>
450 <title>Generating a traffic-model file</title>
451 <para>To create a traffic-model file, simply pass the traffic-summary
452 file to the <command>traffic_learner</command> script. E.g.</para>
454 <para><command>traffic_learner traffic-summary.txt
455 -o traffic-model.txt</command></para>
457 <para>This generates a model of the Samba activity in your network.
458 This model-file can now be used to generate traffic.</para>
462 <title>Replaying the traffic-model file</title>
463 <para>Packet generation using a traffic-model file uses the same
464 command as a traffic-summary file, e.g.</para>
466 <para><command>traffic_replay traffic-model.txt
467 my-dc.samdom.example.com -UAdmin%password</command>
470 <para>By default, this will generate 60 seconds worth of traffic based
471 on the model. You can specify longer using the --duration parameter.
474 <para>The traffic generated is an approximation of what was seen in
475 the network capture. The traffic generation involves some randomness,
476 so running the same command multiple times may result in slightly
477 different traffic being generated.</para>
479 <para>As well as changing how long the model runs for, you can also
480 change how many conversations get generated and how fast the traffic
481 gets replayed. To roughly double the number of conversations that get
482 replayed, use --scale-traffic=2 or to approximately halve the number
483 use --scale-traffic=0.5. To approximately double how quickly the
484 conversations get replayed, use --replay-rate=2, or to halve this use
485 --replay-rate=0.5</para>
487 <para>For example, to generate approximately 10 times the amount of
488 traffic seen over a two-minute period (based on the network capture),
491 <para><command>traffic_replay traffic-model.txt
492 my-dc.samdom.example.com -UAdmin%password --fixed-password=blahblah123!
493 --scale-traffic=10 --duration=120</command></para>
497 <title>Scaling the number of users</title>
498 <para>The performance of a Samba DC running a small subset of test
499 users will be different to a fully-populated Samba DC running in a
500 network. As the number of users increases, the size of the DB
501 increases, and a very large DB will perform worse than a smaller DB.
504 <para>To increase the size of the Samba DB, this tool can also create
505 extra users and groups. These extra users are basically 'filler' for
506 the DB. They won't actually be used to generate traffic, but they may
507 slow down authentication of the test users.</para>
509 <para>For example, to populate the DB with an extra 5000 users (note
510 this will take a while), use the command:</para>
512 <para><command>traffic_replay my-dc.samdom.example.com
513 -UAdmin%password --generate-users-only --fixed-password=blahblah123!
514 --number-of-users=5000</command></para>
516 <para>You can also create groups and assign users to groups. The users
517 can be randomly assigned to groups - this includes any extra users
518 created as well as the users that map to conversations. Use either
519 --average-groups-per-user or --group-memberships to specify how many
520 group memberships should be assigned to the test users.</para>
522 <para>For example, to assign the users in the replayed conversations
523 into 10 groups on average, use a command like:</para>
525 <para><command>traffic_replay traffic-model.txt my-dc.samdom.example.com
526 -UAdmin%password --fixed-password=blahblah123!
527 --generate-users-only --number-of-groups=25 --average-groups-per-user=10
530 <para>The users created by the test will have names like STGU-0-xyz.
531 The groups generated have names like STGG-0-xyz.</para>
537 <title>VERSION</title>
539 <para>This man page is complete for version &doc.version; of the Samba
544 <title>SEE ALSO</title>
547 <refentrytitle>traffic_learner</refentrytitle><manvolnum>7</manvolnum>
553 <title>AUTHOR</title>
555 <para>The original Samba software and related utilities
556 were created by Andrew Tridgell. Samba is now developed
557 by the Samba Team as an Open Source project similar
558 to the way the Linux kernel is developed.</para>
560 <para>The traffic_replay tool was developed by the Samba team at
561 Catalyst IT Ltd.</para>
563 <para>The traffic_replay manpage was written by Tim Beale.</para>