Installing
Home Page Up Using NTP Installing Performance Events Cable modem notes Monitoring with MRTG GPS18 + FreeBSD GPS18 + Windows NTP 4.2.4 vs. 4.2.5 Vista & Windows-7 Timestamp issues After reboot

 

Installing NTP on Windows

It's very helpful that Meinberg have provided a port of the highly-respected and high-accurate NTP software for Windows users - my thanks to them.  This Web page provides a quick guide to installing NTP on Windows XP, Vista, or Windows-7, using the standard out-of-the-box settings to sync your PC to the Internet, and then checking that you have a working installation.  These notes show why you would want to use NTP as opposed to other timekeeping software.

Installing

Download the setup file from the Meinberg site, and save it to your hard disk.  As of October 2009, the current version was named:  ntp-4.2.4p7@copenhagen-o-win32-setup.exe  I suggest right-clicking the downloaded file, select Properties, and pressing the Unblock button if it present.  Run the setup file by double-clicking.  On Vista or Windows-7 you may need to allow the file to run by answering the UAC (User Authorisation Control) question.  You don't have to disable UAC to run NTP.

Assuming you agree to the terms, press I Agree.  Select a location for the files.  I suggest creating a directory called C:\Tools\ if you don't already have one, and putting the NTP software into C:\Tools\NTP\.  I suggest this as the installation includes user-editable files, and C:\Program Files\ isn't the best location for such data.

Choose your directory and press Next to continue.

Leave all the components selected, and press Next to continue.  NTP can create an initial configuration for you using servers from the NTP Pool based on your geographic location.  I suggest you allow it to do this, so select your nearest country or region from the drop-down list.  In the example below, I have selected United Kingdom.  NTP will then choose servers in your region to try and provide the nearest connection for best performance.  Leave the other settings as the installer suggests.

Once you have selected your region, press Next.  Most users will not need to edit the file which the installer creates, so press No to continue.

NTP can create an account to run the software.  NTP will run even while you are not logged into the computer ensuring even better timekeeping.  The next dialog recommends that the installer will create an account for you, and that is the appropriate setting.  Leave the other options as suggested.

Press Next and choose a password for the account.  You should make a note of this password in case you need it in the future, but as the account has limited rights there is normally no need for it to be an ultra-secure password.

Once you press Next, the installation completes, and the NTP service is started.  Note that, like any programs which access the Internet, NTP may trigger your firewall software into asking you if it's OK for NTPD to access the Internet.  Allow ntpd.exe both incoming and outgoing access (called "Act as a server" in Zone Alarm).  There is also a program (ntpq.exe) you can use to query how well NTP is working either on your own system or any system you have access to in you locally or on the Internet, and that may also need to be allowed through your firewall.  

 

Checking it's working

Check after a minute or so, to allow the program to connect to the Internet.  If you are comfortable working with the command-line, simply enter the command:

    ntpq -p

You should get output similar to the display below.  Alternatively, from the Start menu, select Meinberg, Network Time Protocol, Quick NTP status - which gives you a handy ntpq display which automatically refreshes every ten seconds.

Interpreting the ntpq output:

  • The display is a list of servers with various status reports arranged in columns.
  • One server should have an asterisk (*) in the first column.  This marks the server which NTP is currently using.
  • Servers which have a plus sign (+) are good enough for NTP to sync to, others are not.
  • The reach column should not be 0, and will expand during the normal working of NTP until it reaches 377.  It is an octal display of a bit-mask showing when the server was reached.  In the screenshot, NTP has been running for less than a minute, and hence only made contact once with each server.  Normally you expect to see 377 in this column against each server.  A column of all zeros means that NTP can't contact any servers - check your firewall settings.
  • The offset shows how far your PC is off from a nominal UTC, and the value is in milliseconds.  So the PC above is within about 1/40s of correct time!
  • The poll value should gradually increase from 64 seconds to 1024 seconds as NTP needs to contact the server less and less frequently as the clock offset and frequency are gradually corrected.  Changing the poll is automatic in NTP.
  • The delay shows the time for a packet from your PC to reach the remote server and vice versa.  Values above 150ms may indicate a satellite circuit and it's best to avoid such servers if possible.  You will get best performance from servers which are close to you on the network.
  • The jitter column shows how stable the connection between you and the remote server is.
  • The "st" column shows the stratum of the server, with stratum 1 servers having a local reference such as an atomic clock or, for many servers, a radio-clock or GPS receiver reference.  Most servers you will see are at stratum 2, so they are locked to a stratum-1 server.  A lightly loaded stratum-2 server is probably a better reference than a heavily loaded stratum-1 server such as those with widely-publicised addresses.

 
Troubleshooting

NTP s a network application, so the basics of troubleshooting any network application apply.  In today's Windows environments:

  • Check firewall access.
    • Are the programs ntpd.exe and ntpq.exe "known" to the firewall?
    • Do they have both incoming and outgoing access enabled?
    • In Zone Alarm, this means "Act as a server".
    • Are the access requests from the firewall software enabled - you aren't missing any?
  • Can you PING and TRACERT to the server in question?
    • Be aware that this is a poor test today, as many networks and servers disable PING access.
  • Can you use the "ntpq  -p" command as shown above against the server?
    • Again, this can be a poor test, but I found one server which responds:  ntp.exnet.com
    • Do you get a similar result running "ntpq  -p" on its own?
  • Check that you are allowed access to the server -many stratum-1 servers require that you contact them before accessing.  Look for an "open access" server.  There is a list of servers here.

Use the Event Log

Windows records events from programs including NTP in the Event Log.  You can use the Windows Event Viewer to look at events which NTP records as a help in diagnosing more difficult issues.  There is more information about the Event Viewer for Windows XP, and Windows Vista and Windows-7.

Look at the Application log, and use the Filter function of the Event Viewer to select only those events from  NTP.  There is more information on the Internet, for example, here.  You will get some event log messages as NTP starts and these are quite normal.  Look out for those which indicate failure.


Why NTP?

People sometimes ask why they should use this NTP software, rather than the W32Time service built into Windows, or other so-called "atomic time" programs.

  • NTP uses more than one server, and automatically measures and dynamically chooses the best one based on the observed behaviour of each available server.  If a server goes down, another one is selected without user intervention.  By comparison W32Time, like many clock programs, only uses a single server.
  • NTP contacts the servers only as frequently as needed, between once a minute and once every 20 minutes.  W32Time, by default, only contacts servers once a week, so your PC could be minutes out between corrections!
  • NTP from the Meinberg installation will try and use pool servers located nearer to you for better performance, and not ones a continent away.
  • NTP alters the clock rate, as well as the clock time, so that the clock will stay as close as possible to UTC between corrections.
  • Once NTP is running, the time is not stepped, but is adjusted smoothly.
  • NTP is much more accurate.
  • You can use your own time sources with NTP, such as a radio-clock or GPS receiver, and it will then work independently of an internet connection, such as when you are out in the field.
  • NTP allows you to check on its performance, other programs typically do not.  Example of automated NTP monitoring.
  • NTP is open-source software, 100% compliant with the Internet protocol for network time.
  • You can run NTP on many operating systems.
  • NTP runs as a service once setup - it can even keep time while you are logged off your PC.
 

 
Copyright © David Taylor, Edinburgh Last modified: 2009 Dec 03 at 13:31