xref: /freebsd/contrib/ntp/html/ntpdsim_new.html (revision 416ba5c74546f32a993436a99516d35008e9f384)
1ea906c41SOllivier Robert<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2ea906c41SOllivier Robert<html>
3ea906c41SOllivier Robert<head>
4ea906c41SOllivier Robert<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
5ea906c41SOllivier Robert<meta name="generator" content="HTML Tidy, see www.w3.org">
6*2b15cb3dSCy Schubert<title>ntpdsim - Network Time Protocol (NTP) Simulator</title>
7ea906c41SOllivier Robert<link href="scripts/style.css" type="text/css" rel="stylesheet">
8ea906c41SOllivier Robert</head>
9ea906c41SOllivier Robert<body>
10*2b15cb3dSCy Schubert<h3><tt>ntpdsim</tt> - Network Time Protocol (NTP) Simulator</h3>
11*2b15cb3dSCy Schubert<img src="pic/oz2.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/%7emills/pictures.html">from <i>The Wizard of Oz</i>, L. Frank Baum</a>
12*2b15cb3dSCy Schubert<p>All in a row.</p>
13*2b15cb3dSCy Schubert<p>Last update:
14*2b15cb3dSCy Schubert  <!-- #BeginDate format:En2m -->31-Jan-2014  06:54<!-- #EndDate -->
15*2b15cb3dSCy Schubert    UTC</p>
16ea906c41SOllivier Robert<br clear="left">
17ea906c41SOllivier Robert<h4>Related Links</h4>
18*2b15cb3dSCy Schubert<script type="text/javascript" language="javascript" src="scripts/manual.txt"></script>
19ea906c41SOllivier Robert<h4>Table of Contents</h4>
20ea906c41SOllivier Robert<ul>
21*2b15cb3dSCy Schubert  <li><a href="#description">Description</a></li>
22*2b15cb3dSCy Schubert  <li><a href="#configuration">Configuration</a></li>
23*2b15cb3dSCy Schubert  <li><a href="#sample">Sample Configuration File</a></li>
24ea906c41SOllivier Robert</ul>
25*2b15cb3dSCy Schubert<hr>
26ea906c41SOllivier Robert<h4 id="description">Description</h4>
27ea906c41SOllivier Robert<p>The ntpdsim program is used to simulate and study the behavior of an NTP daemon that derives its time from a number of different simulated time sources (servers). Each simulated server can be configured to have a different time offset, frequency offset, propagation delay, processing delay, network jitter and oscillator wander.</p>
28*2b15cb3dSCy Schubert<p>The ntpdsim program runs all the same selection, mitigation, and discipline
29*2b15cb3dSCy Schubert  algorithms as the actual ntpd daemon at the client. (It actually
30*2b15cb3dSCy Schubert  uses the same code). However, the input/output routines and servers are simulated.
31*2b15cb3dSCy Schubert  That is, instead of sending the client messages over the network
32*2b15cb3dSCy Schubert  to the actual servers, the client messages are intercepted by the ntpdsim
33*2b15cb3dSCy Schubert  program, which then generates the replies to those messages. The reply messages
34*2b15cb3dSCy Schubert  are carefully &quot;inserted&quot; into the input queue of the client at the right time
35*2b15cb3dSCy Schubert  according to the specified server properties (like propagation delay).</p>
36ea906c41SOllivier Robert<p>Each simulated server runs according to a specified script that describes the server properties at a particular time. Each script consists of a series of consecutive acts. Each act runs for a particular duration and specifies the frequency offset, propagation delay, processing delay, network jitter and oscillator wander of the server for that duration. Once the duration of an act expires, the simulated server reconfigures itself according to the properties specified in the next act.</p>
37ea906c41SOllivier Robert<h4 id="configuration">Configuration</h4>
38ea906c41SOllivier Robert<p>The ntpdsim program is configured by providing a configuration file at startup. The crux of the simulator configuration is specified using a <tt>simulate</tt> command, the syntax of which is given below. Note that all time quantities are in seconds and all frequency quantities are in parts per million (PPM):</p>
39ea906c41SOllivier Robert<p>&lt;<i>simulate_command</i>&gt; ::= <tt>simulate</tt> { &lt;<i>init_statement_list</i>&gt; &lt;<i>server_list</i>&gt; }<br>
40*2b15cb3dSCy Schubert  &lt;<i>init_statement_list</i>&gt; ::= &lt;init_statement_list&gt; &lt;init_statement&gt; ; | &lt;init_statement&gt; ;<br>
41ea906c41SOllivier Robert  &lt;<i>init_statement</i>&gt; ::= <tt>beep_delay</tt> = &lt;number&gt; | <tt>simulation_duration</tt> = &lt;number&gt;<br>
42ea906c41SOllivier Robert  &lt;<i>server_list</i>&gt; ::= &lt;<i>server_list</i>&gt; &lt;server&gt; | &lt;server&gt;<br>
43*2b15cb3dSCy Schubert  &lt;<i>server_list</i>&gt; ::= <tt>server</tt> = &lt;address&gt; { <tt>server_offset</tt> = &lt;number&gt; ; &lt;act_list&gt; }<br>
44ea906c41SOllivier Robert  &lt;<i>act_list</i>&gt; ::= &lt;<i>act_list</i>&gt; &lt;<i>act</i>&gt; | &lt;<i>act</i>&gt;<br>
45ea906c41SOllivier Robert  &lt;<i>act</i>&gt; ::= <tt>duration</tt> = &lt;number&gt; { &lt;<i>act_stmt_list</i>&gt; }<br>
46*2b15cb3dSCy Schubert  &lt;<i>act_stmt_list</i>&gt; ::= &lt;<i>act_stmt_list</i>&gt; &lt;<i>act_stmt</i>&gt; ; | &lt;<i>act_stmt</i>&gt; ;<br>
47ea906c41SOllivier Robert  &lt;<i>act_stmt</i>&gt; ::= <tt>freq_offset</tt> = &lt;number&gt; | <tt>wander</tt> = &lt;number&gt; | <tt>jitter</tt> = &lt;number&gt; | <tt>prop_delay</tt> = &lt;number&gt; | <tt>proc_delay</tt> = &lt;number&gt;</p>
48*2b15cb3dSCy Schubert<p>In addition to the <tt>simulate</tt> command, other standard NTP configuration commands can be specified. These commands have the same meaning as in the ntpd configuration. Note that newlines are <b>not</b> significant within the <tt>simulate</tt> command even though they are used to mark the end of a normal NTP configuration command.  While a newline is an "end of command" terminator for other configuration commands, in the <tt>simulate</tt> stanza <tt>;</tt> (the semicolon) is the "end of command" terminator.</p>
49ea906c41SOllivier Robert<h4 id="sample">Sample Configuration File</h4>
50ea906c41SOllivier Robert<p>A sample ntpdsim configuration file is given below. It specifies two simulated servers, each of which has two acts.</p>
51ea906c41SOllivier Robert<pre>
52ea906c41SOllivier Robert    # Client configuration
53ea906c41SOllivier Robert    disable kernel
54ea906c41SOllivier Robert    server pogo
55ea906c41SOllivier Robert    driftfile ./ntp.drift
56ea906c41SOllivier Robert    statsdir ./ntpstats/
57ea906c41SOllivier Robert    filegen loopstats type day enable
58ea906c41SOllivier Robert    filegen peerstats type day enable
59ea906c41SOllivier Robert
60ea906c41SOllivier Robert    # Simulation configuration
61ea906c41SOllivier Robert    simulate {
62*2b15cb3dSCy Schubert        simulation_duration = 86400;
63*2b15cb3dSCy Schubert        beep_delay = 3600;
64ea906c41SOllivier Robert
65ea906c41SOllivier Robert        # Server 1
66ea906c41SOllivier Robert	server = louie.udel.edu {
67*2b15cb3dSCy Schubert	    server_offset = 0;
68ea906c41SOllivier Robert            duration = 50000 {
69*2b15cb3dSCy Schubert		freq_offset = 400;
70*2b15cb3dSCy Schubert		wander = 1.0;
71*2b15cb3dSCy Schubert		jitter = 0.001;
72*2b15cb3dSCy Schubert		prop_delay = 0.001;
73*2b15cb3dSCy Schubert		proc_delay = 0.001;
74ea906c41SOllivier Robert	    }
75ea906c41SOllivier Robert            duration = 6400 {
76*2b15cb3dSCy Schubert		freq_offset = 200;
77*2b15cb3dSCy Schubert		wander = 1.0;
78*2b15cb3dSCy Schubert		jitter = 0.001;
79*2b15cb3dSCy Schubert		prop_delay = 0.001;
80*2b15cb3dSCy Schubert		proc_delay = 0.001;
81ea906c41SOllivier Robert	    }
82ea906c41SOllivier Robert	}
83ea906c41SOllivier Robert
84ea906c41SOllivier Robert        # Server 2
85ea906c41SOllivier Robert	server = baldwin.udel.edu {
86*2b15cb3dSCy Schubert	    server_offset = 0.02;
87ea906c41SOllivier Robert	    duration = 10000 {
88*2b15cb3dSCy Schubert		freq_offset = 400;
89*2b15cb3dSCy Schubert		wander = 1.0;
90*2b15cb3dSCy Schubert		jitter = 0.001;
91*2b15cb3dSCy Schubert		prop_delay = 0.5;
92*2b15cb3dSCy Schubert		proc_delay = 0.001;
93ea906c41SOllivier Robert	    }
94ea906c41SOllivier Robert	    duration = 60000 {
95*2b15cb3dSCy Schubert		freq_offset = 200;
96*2b15cb3dSCy Schubert		wander = 1.0;
97*2b15cb3dSCy Schubert		jitter = 0.05;
98*2b15cb3dSCy Schubert		prop_delay = 0.005;
99*2b15cb3dSCy Schubert		proc_delay = 0.001;
100ea906c41SOllivier Robert	    }
101ea906c41SOllivier Robert	}
102ea906c41SOllivier Robert }
103ea906c41SOllivier Robert  </pre>
104ea906c41SOllivier Robert<hr>
105*2b15cb3dSCy Schubert<address>
106*2b15cb3dSCy Schubert<a href="mailto:skamboj@udel.edu">Sachin Kamboj</a>
107*2b15cb3dSCy Schubert</address>
108ea906c41SOllivier Robert<script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
109ea906c41SOllivier Robert</body>
110ea906c41SOllivier Robert</html>
111