xref: /freebsd/contrib/ntp/html/hints/winnt.html (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
3<html>
4
5    <head>
6        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
7        <title>NTP on Windows NT</title>
8        <link href="scripts/style.css" type="text/css" rel="stylesheet">
9    </head>
10
11    <body>
12        <h1>NTP 4.x for Windows NT</h1>
13
14        <h2>Introduction</h2>
15        The NTP 4 distribution runs as service on Windows NT 4.0, Windows 2000, Windows XP,
16        Windows .NET Server 2003. It will NOT run on Windows 95, 98, ME, etc.
17        The binaries work on multi-processor systems. This port has not been tested
18        on the Alpha platform. This release now uses OpenSSL for authentication.
19        IPv6 is not implemented yet for Win32 platforms.
20        <h2>Authentication Keys</h2>
21        With this release ntp-keygen is supported. See the <a href="../keygen.html">
22        ntp keygen documentation</a> for details on how to use ntp-keygen.
23        <p>
24        ntpd can now use the generated keys in the same way as on Unix platforms. Please
25        refer to the <a href="../authopt.html">Authentication Options</a> for details
26        on how to use these.
27        <p><B>NOTE:</B> ntpd and ntp-keygen both use OpenSSL which requires a random
28        character file called .rnd by default. Both of these programs will automatically
29        generate this file if they are not found. The programs will look for an
30        environmental variable called RANDFILE and use that for the name of the
31        random character file if the variable exists. If it does not exist it will look for an environmental
32        variable called HOME and use that directory to search for a filed called .rnd
33        in that directory. Finally, if neither RANDFILE nor HOME exists it will look
34        in C:\ for a .rnd file. In each case it will search for and create the file
35        if the environmental variable exists or in the C:\ directory if it doesn't.
36        Note that ntpd normally runs as a service so that the only way that it will
37        have either RANDFILE or HOME defined is if it is a System environmental
38        variable or if the service is run under a specific account name and that
39        account has one of those variables defined. Otherwise it will use the file
40        "c:\.rnd". This was done so that OpenSSL will work normally on Win32 systems.
41        This obviates the need to ship the OpenSSL.exe file and explain how to
42        generate the .rnd file. A future version may change this behavior.
43
44        <p>Refer to <a href="#Compiling">Compiling Requirements</a> and Instructions for how to compile the program.</p>
45        <h2>Reference Clocks</h2>
46        Reference clock support under Windows NT is tricky because the IO functions are
47        so much different. Some of the clock types have been built into the ntpd executable
48        and should work but have not been tested by the ntp project. If you have a clock
49        that runs on Win32 and the driver is there but not implemented on Win32 you will have
50        make the required configuration changes in config.h and then build ntpd from source
51        and test it. The following reference clocks are known to work and are supported
52        by Windows NT:
53        <p><a href="../driver1.html">Type 1</a> Undisciplined Local Clock (LOCAL)<br>
54            <a href="../driver29.html">Type 29</a> Trimble Navigation Palisade GPS (GPS_PALISADE)</p>
55        <h2>Functions Supported</h2>
56        All NTP functions are supported with some constraints. See the <a href="#ToDo">TODO list</a> below.
57        Note that the ntptrace executable is not supported and you should use the PERL script
58        version instead.
59        <h2>Accuracy</h2>
60        Greg Brackley has implemented a fantastic interpolation scheme that improves the precision of the NTP clock using a realtime thread (is that poetic or what!) which captures a tick count from the 8253 counter after each OS tick. The count is used to interpolate the time between operating system ticks.
61        <p>On a typical 200+ MHz system NTP achieves a precision of about 5 microseconds and synchronizes the clock to +/-500 microseconds using the <a href="http://www.trimble.com/products/ntp">Trimble Palisade</a> as UTC reference. This allows distributed applications to use the 10 milliseconds ticks available to them with high confidence.</p>
62        <h2>Binaries</h2>
63        Recent InstallShield based executable versions of NTP for Windows NT (intel) are available from:
64        <ul>
65        <li><a href="http://www.trimble.com/oem/ntp">http://www.trimble.com/oem/ntp</a>
66        <li><a href="http://www.five-ten-sg.com/">http://www.five-ten-sg.com/</a>
67        </ul>
68        <a name="ToDo"><h2>ToDo</h2></a>
69        These tasks are in no particular order of priority.
70        <ul>
71            <li>Create a proper install/uninstall program
72            <li>Add sntp to the list of supported programs
73            <li>Add support for Visual C++ 7.0 or later (.NET)
74            <li>Add IPv6 support
75            <li>See if precision can be improved by using CPU cycle counter for tick interpolation.
76            <li>Make precision time available to applications using NTP_GETTIME API
77        </ul>
78        <h2>Compiling Requirements</h2>
79        <ul>
80            <li>Windows NT 4.0 Windows 2000, Windows XP, or Windows.NET Server 2003
81            <li>Microsoft Visual C++ 6.0. <B>NOTE</B>VC++ 7.0 (aka .NET) is not yet supported
82            but will probably work fine.
83            <li>Some way of uncompressing and untarring the gzipped tar file.
84            <li>OpenSSL must be built on the box before building NTP. Additional steps would
85            be required to not use OpenSSL.
86        </ul>
87        <a name="Compiling"><h2>Compiling Instructions</h2></a>
88        <ol>
89            <li>Unpack and build OpenSSL according to the OpenSSL instructions for building on
90            Windows. Currently the NTP build requires OpenSSL 0.9.7b as it looks for the path
91            to that build for the include and libeay32.lib files. If you have a different version
92            you will need to adjust both the preprocessor path and the link path to point to
93            the correct locations of the include files and the lib file respectively.
94            <li>Unpack the NTP-4.x.tar.gz using utilities such as WinZip.
95            <li>Open the .\ports\winnt\ntp.dsw Visual C workspace
96            <li>Batch build all projects
97            <li>The built binaries can be found in the port\winnt\bin\Release subdirectory
98            <li>In addition you will need to install the OpenSSL libeay32.dll
99            <li>If you are shipping binaries in a kit it is strongly recommended that you
100            ship this file (winnt.html) along with the binaries.
101        </ol>
102        <h2>Configuration File</h2>
103        The default NTP configuration file path is %SystemRoot%<tt>\system32\drivers\etc\. </tt>(%SystemRoot% is an environmental variable that can be determined by typing &quot;set&quot; at the &quot;Command Prompt&quot; or from the &quot;System&quot; icon in the &quot;Control Panel&quot;).<br>
104        Refer to your system environment and <tt>c</tt>reate your<tt> ntp.conf</tt> file in the directory corresponding to your system&nbsp; installation.<br>
105        <tt>The older &lt;WINDIR&gt;\ntp.conf </tt>is still supported but you will get a log entry reporting that the first file wasn't found.
106        <h2>Installation Instructions</h2>
107        The <tt>instsrv</tt> program in the instsrv subdirectory of the distribution can be used to install 'ntpd' as a service and start automatically at boot time. Instsrv is automatically compiled with the rest of the distribution if you followed the steps above.
108        <ol>
109            <li>Start a command prompt and enter &quot;instsrv.exe &lt;pathname_for_ntpd.exe&gt;&quot;
110            <li>Clicking on the &quot;Services&quot; icon in the &quot;Control Panel&quot; will display the list of currently installed services in a dialog box. The NetworkTimeProtocol service should show up in this list. Select it in the list and hit the &quot;Start&quot; button in the dialog box. The NTP service should start.
111            <li>You can also stop and start the service by typing net start|stop NetworkTimeProtocol at the DOS prompt.
112            <li>View the event log by clicking on the &quot;Event Viewer&quot; icon in the &quot;Administrative Tools&quot; group, there should be several successful startup messages from NTP. NTP will keep running and restart automatically when the machine is rebooted.
113        </ol>
114        You can change the start mode (automatic/manual) and other startup parameters corresponding to the NTP service in the &quot;Services&quot; dialog box if you wish.
115        <h2>Removing NTP</h2>
116        You can also use <tt>instsrv</tt> to delete the NTP service by entering: &quot;instsrv.exe remove&quot;
117        <h2>Command Line Parameters and Registry Entries</h2>
118        Unlike the Unix environment, there is no clean way to run 'ntpdate' and reset the clock before starting 'ntpd' at boot time.<br>
119        NTP will step the clock up to 1000 seconds by default. While there is no reason that the system clock should be that much off during bootup if 'ntpd' was running before, you may wish to override this default and/or pass other command line directives.
120        <p>Use the registry editor to edit the value for the ntpd executable under LocalMachine\System\CurrentControlSet\Services\NTP.</p>
121        <p>Add the -g option to the ImagePath key, behind &quot;%INSTALLDIR&gt;\ntpd.exe&quot;. This will force NTP to accept large time errors (including 1.1.1980 00:00)</p>
122        <h2>Bug Reports</h2>
123        Send questions to <a href="news://comp.protocols.time.ntp">news://comp.protocols.time.ntp</a>
124        and bug reports should be entered in <a href="http://bugzilla.ntp.org/">Bugzilla</a> on the
125        NTP Web site.
126        <h2>Change Log</h2>
127        <h3>Last revision 2 July 2003&nbsp; Version 4.2.0</h3>
128        <b>by Danny Mayer (mayer@ntp.org>)</b>
129        <h3>Significant Changes:</h3>
130        This latest release of NTP constitutes a major upgrade to its ability to build and
131        run on Windows platforms and should now build and run cleanly. More importantly it
132        is now able to support all authentication in the same way as Unix boxes. This does
133        require the usage of OpenSSL which is now a prerequisite for build on Windows.
134        ntp-keygen is now supported and builds on Win32 platforms.
135
136        <h3>Last revision 16 February 1999&nbsp; Version 4.0.99e.</h3>
137        <b>by Sven Dietrich (sven_dietrich@trimble.com)</b>
138        <p><b>Significant Changes:</b></p>
139        <ul>
140            <li>Perl 5 is no longer needed to compile NTP. The configuration script which creates version.c with the current date and time was modified by Frederick Czajka [w2k@austin.rr.com] so that Perl is no longer required.
141        </ul>
142        <h3>Last revision 15 November 1999&nbsp; Version 4.0.98f.</h3>
143        <b>by Sven Dietrich (sven_dietrich@trimble.com)</b>
144        <p><b>Significant Changes:</b></p>
145        <ul>
146            <li>Fixed I/O problem delaying packet responses which resulted in no-replys to NTPQ and others.
147            <li>The default configuration file path is <tt>&lt;WINDIR&gt;\system32\drivers\etc\ntp.conf. The old &lt;WINDIR&gt;\ntp.conf </tt>is still supported but you will get a log entry reporting that the first file wasn't found. The NTP 3.x legacy <tt>ntp.ini</tt> file is no longer supported.
148        </ul>
149        <b>Known Problems / TODO:</b>
150        <ul>
151            <li>MD5 and name resolution do not yet get along. If you define MD5, you cannot use DNS names, only IP numbers.
152        </ul>
153        <h3>Last revision 27 July 1999&nbsp; Version 4.0.95.</h3>
154        This version compiles under WINNT with Visual C 6.0.
155        <p>Greg Brackley and Sven Dietrich</p>
156        <p>Significant changes:<br>
157            -Visual Studio v6.0 support<br>
158            -Winsock 2.0 support<br>
159            -Use of I/O completion ports for sockets and comm port I/O<br>
160            -Removed the use of multimedia timers (from ntpd, others need removing)<br>
161            -Use of waitable timers (with user mode APC) and performance counters to fake getting a better time<br>
162            -Trimble Palisade NTP Reference Clock support<br>
163            -General cleanup, prototyping of functions<br>
164            -Moved receiver buffer code to a separate module (removed unused members from the recvbuff struct)<br>
165            -Moved io signal code to a separate module</p>
166        <h3>Last revision:&nbsp; 20-Oct-1996</h3>
167        This version corrects problems with building the XNTP<br>
168        version 3.5-86 distribution under Windows NT.
169        <p>The following files were modified:<br>
170            &nbsp;blddbg.bat<br>
171            &nbsp;bldrel.bat<br>
172            &nbsp;include\ntp_machine.h<br>
173            &nbsp;xntpd\ntp_unixclock.c<br>
174            &nbsp;xntpd\ntp_refclock.c<br>
175            &nbsp;scripts\wininstall\build.bat<br>
176            &nbsp;scripts\wininstall\setup.rul<br>
177            &nbsp;scripts\wininstall\readme.nt<br>
178            &nbsp;scripts\wininstall\distrib\ntpog.wri<br>
179            &nbsp;html\hints\winnt (this file)</p>
180        <p>In order to build the entire Windows NT distribution you<br>
181            need to modify the file scripts\wininstall\build.bat<br>
182            with the installation directory of the InstallShield<br>
183            software.&nbsp; Then, simply type &quot;bldrel&quot; for non-debug<br>
184            or &quot;blddbg&quot; for debug executables.</p>
185        <p>Greg Schueman<br>
186            &nbsp;&nbsp;&nbsp; &lt;schueman@acm.org&gt;</p>
187        <h3>Last revision:&nbsp; 07-May-1996</h3>
188        This set of changes fixes all known bugs, and it includes<br>
189        several major enhancements.
190        <p>Many changes have been made both to the build environment as<br>
191            well as the code.&nbsp; There is no longer an ntp.mak file, instead<br>
192            there is a buildntall.bat file that will build the entire<br>
193            release in one shot.&nbsp; The batch file requires Perl.&nbsp; Perl<br>
194            is easily available from the NT Resource Kit or on the Net.</p>
195        <p>The multiple interface support was adapted from Larry Kahn's<br>
196            work on the BIND NT port.&nbsp; I have not been able to test it<br>
197            adequately as I only have NT servers with one network<br>
198            interfaces on which to test.</p>
199        <p>Enhancements:<br>
200            * Event Logging now works correctly.<br>
201            * Version numbers now work (requires Perl during build)<br>
202            * Support for multiple network interface cards (untested)<br>
203            * NTP.CONF now default, but supports ntp.ini if not found<br>
204            * Installation procedure automated.<br>
205            * All paths now allow environment variables such as %windir%</p>
206        <p>Bug fixes:<br>
207            * INSTSRV replaced, works correctly<br>
208            * Cleaned up many warnings<br>
209            * Corrected use of an uninitialized variable in XNTPD<br>
210            * Fixed ntpdate -b option<br>
211            * Fixed ntpdate to accept names as well as IP addresses<br>
212            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Winsock WSAStartup was called after a gethostbyname())<br>
213            * Fixed problem with &quot;longjmp&quot; in xntpdc/ntpdc.c that<br>
214            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; caused a software exception on doing a Control-C in xntpdc.<br>
215            &nbsp;A Cntrl-C now terminates the program.</p>
216        <p>See below for more detail:</p>
217        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Note: SIGINT is not supported for any Win32 application including<br>
218            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Windows NT and Windows 95. When a CTRL+C interrupt occurs, Win32<br>
219            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; operating systems generate a new thread to specifically handle that<br>
220            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; interrupt. This can cause a single-thread application such as UNIX,<br>
221            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to become multithreaded, resulting in unexpected behavior.<br>
222            &nbsp;</p>
223        <p>Possible enhancements and things left to do:<br>
224            * Reference clock drivers for NT (at least Local Clock support)<br>
225            * Control Panel Applet<br>
226            * InstallShield based installation, like NT BIND has<br>
227            * Integration with NT Performance Monitor<br>
228            * SNMP integration<br>
229            * Fully test multiple interface support<br>
230            &nbsp;</p>
231        <p>Known problems:<br>
232            *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bug in ntptrace - if no Stratum 1 servers are available,<br>
233            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; such as on an IntraNet, the application crashes.</p>
234        <h3>Last revision:&nbsp; 12-Apr-1995</h3>
235        This NTPv3 distribution includes a sample configuration file and the project<br>
236        makefiles for WindowsNT 3.5 platform using Microsoft Visual C++ 2.0 compiler.<br>
237        Also included is a small routine to install the NTP daemon as a &quot;service&quot;<br>
238        on a WindowsNT box. Besides xntpd, the utilities that have been ported are<br>
239        ntpdate and xntpdc. The port to WindowsNT 3.5 has been tested using a Bancomm<br>
240        TimeServe2000 GPS receiver clock that acts as a strata 1 NTP server with no<br>
241        authentication (it has not been tested with any refclock drivers compiled in).<br>
242        Following are the known flaws in this port:<br>
243        1) currently, I do not know of a way in NT to get information about multiple<br>
244        &nbsp;&nbsp; network interface cards. The current port uses just one socket bound to<br>
245        &nbsp;&nbsp; INADDR_ANY address. Therefore when dealing with a multihomed NT time server,<br>
246        &nbsp;&nbsp; clients should point to the default address on the server (otherwise the<br>
247        &nbsp;&nbsp; reply is not guaranteed to come from the same interface to which the<br>
248        &nbsp;&nbsp; request was sent). Working with Microsoft to get this resolved.<br>
249        2) There is some problem with &quot;longjmp&quot; in xntpdc/ntpdc.c that causes a<br>
250        &nbsp;&nbsp; software exception on doing a Control-C in xntpdc. Be patient!<br>
251        3) The error messages logged by xntpd currently contain only the numerical<br>
252        &nbsp;&nbsp; error code. Corresponding error message string has to be looked up in<br>
253        &nbsp;&nbsp; &quot;Books Online&quot; on Visual C++ 2.0 under the topic &quot;Numerical List of Error<br>
254        &nbsp;&nbsp; Codes&quot;.
255        <p>Last HTML Update: November 17, 1999<br>
256            <a href="mailto://sven_dietrich@trimble.com">Sven_Dietrich@Trimble.COM</a></p>
257    </body>
258
259</html>
260