1181834Sroberto<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2181834Sroberto<html>
3280849Scy<head>
4280849Scy<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
5280849Scy<meta name="generator" content="HTML Tidy, see www.w3.org">
6280849Scy<title>ntpdsim - Network Time Protocol (NTP) Simulator</title>
7280849Scy<link href="scripts/style.css" type="text/css" rel="stylesheet">
8280849Scy</head>
9280849Scy<body>
10280849Scy<h3><tt>ntpdsim</tt> - Network Time Protocol (NTP) Simulator</h3>
11280849Scy<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>
12280849Scy<p>All in a row.</p>
13280849Scy<p>Last update:
14280849Scy  <!-- #BeginDate format:En2m -->31-Jan-2014  06:54<!-- #EndDate -->
15280849Scy    UTC</p>
16280849Scy<br clear="left">
17280849Scy<h4>Related Links</h4>
18280849Scy<script type="text/javascript" language="javascript" src="scripts/manual.txt"></script>
19280849Scy<h4>Table of Contents</h4>
20280849Scy<ul>
21280849Scy  <li><a href="#description">Description</a></li>
22280849Scy  <li><a href="#configuration">Configuration</a></li>
23280849Scy  <li><a href="#sample">Sample Configuration File</a></li>
24280849Scy</ul>
25280849Scy<hr>
26280849Scy<h4 id="description">Description</h4>
27280849Scy<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>
28280849Scy<p>The ntpdsim program runs all the same selection, mitigation, and discipline
29280849Scy  algorithms as the actual ntpd daemon at the client. (It actually
30280849Scy  uses the same code). However, the input/output routines and servers are simulated.
31280849Scy  That is, instead of sending the client messages over the network
32280849Scy  to the actual servers, the client messages are intercepted by the ntpdsim
33280849Scy  program, which then generates the replies to those messages. The reply messages
34280849Scy  are carefully &quot;inserted&quot; into the input queue of the client at the right time
35280849Scy  according to the specified server properties (like propagation delay).</p>
36280849Scy<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>
37280849Scy<h4 id="configuration">Configuration</h4>
38280849Scy<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>
39280849Scy<p>&lt;<i>simulate_command</i>&gt; ::= <tt>simulate</tt> { &lt;<i>init_statement_list</i>&gt; &lt;<i>server_list</i>&gt; }<br>
40280849Scy  &lt;<i>init_statement_list</i>&gt; ::= &lt;init_statement_list&gt; &lt;init_statement&gt; ; | &lt;init_statement&gt; ;<br>
41280849Scy  &lt;<i>init_statement</i>&gt; ::= <tt>beep_delay</tt> = &lt;number&gt; | <tt>simulation_duration</tt> = &lt;number&gt;<br>
42280849Scy  &lt;<i>server_list</i>&gt; ::= &lt;<i>server_list</i>&gt; &lt;server&gt; | &lt;server&gt;<br>
43280849Scy  &lt;<i>server_list</i>&gt; ::= <tt>server</tt> = &lt;address&gt; { <tt>server_offset</tt> = &lt;number&gt; ; &lt;act_list&gt; }<br>
44280849Scy  &lt;<i>act_list</i>&gt; ::= &lt;<i>act_list</i>&gt; &lt;<i>act</i>&gt; | &lt;<i>act</i>&gt;<br>
45280849Scy  &lt;<i>act</i>&gt; ::= <tt>duration</tt> = &lt;number&gt; { &lt;<i>act_stmt_list</i>&gt; }<br>
46280849Scy  &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>
47280849Scy  &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>
48280849Scy<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>
49280849Scy<h4 id="sample">Sample Configuration File</h4>
50280849Scy<p>A sample ntpdsim configuration file is given below. It specifies two simulated servers, each of which has two acts.</p>
51280849Scy<pre>
52181834Sroberto    # Client configuration 
53181834Sroberto    disable kernel
54181834Sroberto    server pogo
55181834Sroberto    driftfile ./ntp.drift
56181834Sroberto    statsdir ./ntpstats/
57181834Sroberto    filegen loopstats type day enable
58181834Sroberto    filegen peerstats type day enable
59181834Sroberto
60181834Sroberto    # Simulation configuration
61181834Sroberto    simulate {
62280849Scy        simulation_duration = 86400;
63280849Scy        beep_delay = 3600;
64181834Sroberto
65181834Sroberto        # Server 1
66181834Sroberto	server = louie.udel.edu {
67280849Scy	    server_offset = 0;
68181834Sroberto            duration = 50000 {
69280849Scy		freq_offset = 400;
70280849Scy		wander = 1.0;
71280849Scy		jitter = 0.001;
72280849Scy		prop_delay = 0.001;
73280849Scy		proc_delay = 0.001;
74181834Sroberto	    }
75181834Sroberto            duration = 6400 {
76280849Scy		freq_offset = 200;
77280849Scy		wander = 1.0;
78280849Scy		jitter = 0.001;
79280849Scy		prop_delay = 0.001;
80280849Scy		proc_delay = 0.001;
81181834Sroberto	    }
82181834Sroberto	}
83181834Sroberto
84181834Sroberto        # Server 2
85181834Sroberto	server = baldwin.udel.edu {
86280849Scy	    server_offset = 0.02;
87181834Sroberto	    duration = 10000 {
88280849Scy		freq_offset = 400;
89280849Scy		wander = 1.0;
90280849Scy		jitter = 0.001;
91280849Scy		prop_delay = 0.5;
92280849Scy		proc_delay = 0.001;
93181834Sroberto	    }
94181834Sroberto	    duration = 60000 {
95280849Scy		freq_offset = 200;
96280849Scy		wander = 1.0;
97280849Scy		jitter = 0.05;
98280849Scy		prop_delay = 0.005;
99280849Scy		proc_delay = 0.001;
100181834Sroberto	    }
101181834Sroberto	}
102280849Scy }
103181834Sroberto  </pre>
104280849Scy<hr>
105280849Scy<address>
106280849Scy<a href="mailto:skamboj@udel.edu">Sachin Kamboj</a>
107280849Scy</address>
108280849Scy<script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
109280849Scy</body>
110181834Sroberto</html>
111