How to synchronize time between a Windows client and a Linux NTP server?

24,322

Solution 1

Time servers take a couple of samples to make sure they are reading the upstream servers properly and to set their own stratum correctly. It sometimes takes a while. Usually less then 10 minutes.

When you get an error like that you should first check the stratum your NTP server is reporting. There is a limit on how low windows will go to set its time from a NTP server, but I dont recall off the top of my head.

Solution 2

Well, David Schwartz was right: by the time it took me to write my question, my NTP server got synchronized and Windows successfully updated its clock.

Quite frankly, I had no idea I needed to actually wait for it. I thought it was instantaneous. You're good to go when OpenNTPD writes clock is now synced to the syslog, not before. Well, good to know.

If only the error messages from Windows were a little more explicit…

Share:
24,322
Etienne Dechamps
Author by

Etienne Dechamps

Updated on September 18, 2022

Comments

  • Etienne Dechamps
    Etienne Dechamps over 1 year

    I want my Windows 7 machine to get its time from my Linux Debian Sid server.

    So I want ahead and installed OpenNTPD from the Debian repository. It doesn't listen to anything by default, so I configured it as follows:

    listen on 192.168.0.1
    server 0.debian.pool.ntp.org
    server 1.debian.pool.ntp.org
    server 2.debian.pool.ntp.org
    server 3.debian.pool.ntp.org
    

    192.168.0.1 being my server's IP address on my LAN. I entered it in the Windows settings and I got this:

    enter image description here

    I used a network sniffer (Wireshark) to check if this was a network issue. It's not: Windows is happily sending NTP packets and receives responses from my server. I guess Windows is not pleased by the answer it gets from the server. Thing is, I have no idea why…

    Here's the result of w32tm /query /verbose /peers on the Windows machine:

    #Peers: 1
    
    Peer: 192.168.0.1,0x9
    State: Active
    Time Remaining: 604046.2718893s
    Mode: 3 (Client)
    Stratum: 0 (unspecified)
    PeerPoll Interval: 0 (unspecified)
    HostPoll Interval: 10 (1024s)
    Last Successful Sync Time: (null)
    LastSyncError: 0x80004005 (Unspecified error )
    LastSyncErrorMsgId: 0x00000000 (Succeeded)
    AuthTypeMsgId: 0x0000005A (NoAuth )
    Resolve Attempts: 0
    ValidDataCounter: 2
    Reachability: 4
    

    "Unspecified error" doesn't help me much. Any idea what's going on here?

    • mdpc
      mdpc over 12 years
      Is this a firewall problem on the debian box?
    • Etienne Dechamps
      Etienne Dechamps over 12 years
      DavidSchwartz: thank you (see answer) mdpc: I ruled out network issues in my question (sniffer showing packets flowing in both directions).
    • Etienne Dechamps
      Etienne Dechamps over 12 years
      Oh, and OpenNTPD does not provide ntpq.
    • cco
      cco over 12 years
      Try ntpdc -p that will show what you server is associtaed with and what stratum they are.
  • David Schwartz
    David Schwartz over 12 years
    It is impossible to synchronize two time sources instantaneously. You can make them show the same value at the time you synchronize them, but that does not make them synchronized. ('Synchronized' means operating in unison.)