Default Reasoning

Construction of sensible guesses when some useful information is lacking and no contradictory evidence is present…

  • Subscribe

  • Disclaimer

    This blog is personal. The views and opinions expressed here represent my own and not those of the people, institutions or organizations that I may or may not be related with unless stated explicitly. All blog post, white papers and manuals were written during the projects, mostly at a customer site and are scenario specific. Use at your own risk.
  • Meta

Synchronize time with external NTP server on Windows Server 2008 (R2).

Posted by Marek.Z on 16 November 2009

Time synchronization is an important aspect for all computers on the network. By default, the clients computers get their time from a Domain Controller and the Domain Controller gets his time from the domain’s PDC Operation Master. Therefore the PDC must synchronize his time from an external source. I usually use the servers listed at the NTP Pool Project website. Before you begin, don’t forget to open the default UDP 123 port (in- and outbound) on your (corporate) firewall.

  1. First, locate your PDC Server. Open the command prompt and type: C:\>netdom /query fsmo
  2. Log in to your PDC Server and open the command prompt.
  3. Stop the W32Time service: C:\>net stop w32time
  4. Configure the external time sources, type: C:\> w32tm /config /syncfromflags:manual /manualpeerlist:”0.pool.ntp.org, 1.pool.ntp.org, 2.pool.ntp.org”
  5. Make your PDC a reliable time source for the clients. Type: C:\>w32tm /config /reliable:yes
  6. Start the w32time service: C:\>net start w32time
  7. The windows time service should begin synchronizing the time. You can check the external NTP servers in the time configuration by typing: C:\>w32tm /query /configuration
  8. Check the Event Viewer for any errors.

Tested on Windows Server 2008 R2 (Build 7600).

Cheers!

- Marek.Z

About these ads

75 Responses to “Synchronize time with external NTP server on Windows Server 2008 (R2).”

  1. A8_francois said

    Thanks for this, it works very well but manualpeerlist needs quotes like this : w32tm /config /syncfromflags:manual /manualpeerlist:”0.ntp.pool.org, 1.ntp.pool.org, 2.ntp.pool.org”

  2. Thanx for the info!

  3. NTPserver said

    The command put the whole string into the registry, quotes and all.

    This is what worked:

    w32tm /config /syncfromflags:manual “/manualpeerlist:time.chu.nrc.ca,0×1 ntp.uunet.ca,0×2″

    Hope that helps someone. :)

    • Marek.Z said

      Hm.. strange, I’ve tested it on a W2k8 R2 server. It works without the quotes when you type the NTP servers wihout any spaces after the /manualpeerlist parameter.

  4. guest said

    My Win2k8 R2 needed this. No spaces or quotes after /manualpeerlist:

    w32tm /config /syncfromflags:manual /manualpeerlist:0.ntp.pool.org,1.ntp.pool.org,2.ntp.pool.org

  5. Brian said

    Are the names of the time servers correct? When I check the link, it references *.pool.ntp.org. Your directions say ntp.pool.org.

    Incidentally, it didn’t work for me in 2k8R2 until I took out the space, despite the fact that help says the list should be space delimited:

    w32tm /config /syncfromflags:manual /manualpeerlist:”0.poolntp.org,1.pool.ntp.org,2.pool.ntp.org”

  6. I found this information usefull.

  7. This is a good post.

  8. Thanks for this interesting information.

  9. Cody said

    Thank you for this information saved me hours of deciphering ms documentation.

  10. PAL said

    That didn’t work for me. I had to remove both the quotes and the space, delimiting only by comma, ergo:

    w32tm /config /syncfromflags:manual /manualpeerlist:0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org

    • Marek.Z said

      Hi,

      Yeah, Couple of other guys already mention this. I’ve no idea why though…

      Marek.Z

      • Devang Patel said

        Marek thank you for this post, it seem to have saved so time for everyone.

        I think i know why people are having problem they are cutting and pasting the command which for some reason the qoute are cuaseing an issue.

        what i did was remove the qoute on notepad and put them back in. that seem to fix it.

        hopefully that makes sense.

        • Marek.Z said

          Hi,

          Thanks for visit :)

          It seems that sometimes the quotes are needed and sometimes they not. Personally, I always retype the command. This way you should be able to identify the syntax error. Don’t be a copy-paste admin :)

          Cheers!

          Marek.Z

        • mkaluza said

          Sorry of my english … :-) but my w32tm help write: when I use more than one peer, I must use space between peers and “” to all switch …. eg. “/manualpeerlist:0.pool.ntp.org 1.pool.ntp.org 1.pool.ntp.org” … ;-)

    • said

      You can use quotes as long as there is no space between the argument manualpeerlist, the colon and the first quote

      …/manualpeerlist:”myntp…

  11. johan said

    excellent post!
    this might also help someone:
    To clear the current time configuration, do the following:
    net stop w32time
    w32tm /unregister
    w32tm /register
    net start w32time

    unregistering will remove the whole w32tm key from the registry while registering will create a fresh key filled with the windows defaults.

    • Marek.Z said

      Hi Johan,

      Good one! Thanks for sharing.

      Cheers!

    • Stacy said

      Thank you so much, for the info here Johan, yours was the only thing that has worked for me – I work for a non-profit agency and we don’t spend much for IT – all our systems & peripherals are donated and they can’t afford to hire an experienced IT Tech so I’m it. Although it has literally been years since I’ve had anything to do with a server and that was only in school and you know how fast technology goes.

      All the other strings I typed in, not copy/pasted and I just kept getting the error that the command was unknown. So at least I got our system clocks to the correct time for now and I’ll probably have to repeat this step again but at least it works.

      Newbie IT Tech.

  12. Shane said

    Thanks! I used a combo of your instructions and those from M$:
    http://support.microsoft.com/kb/816042

    the list of servers needed to have ,0×1 after each entry and a space separating them to show up correctly in the NTPClient section of the registry. Otherwise only the first server on the list would populate.

  13. Microsoft has provided a grafical FixIt program to set the timesources in Windows 2008 R2. This helps with all the syntax issues and the “,0×1 ” issue.

    Read more about the program and where to download it here:
    http://www.vansoest.it/v1/uk/default.asp?file=Hotlist.whc and open the Network topic. There is a download link in the article “How to configure an authoritative time server in Windows™ Server 2008 (R2)”

  14. MichaelM said

    Worked like a champ for me, no modifications, typed as indicated, and after restarting the time service, the server picked up on the correct time right away.
    THANKS!!

  15. Graeme said

    You can simplify this to two commands: (note these are both one line, they may wrap here)

    w32tm /config /syncfromflags:manual manualpeerlist:0.uk.pool.ntp.org,1.uk.pool.ntp.org /update /reliable:yes

    w32tm /resync

    No need to restart services, and no quotes as per MS documentation

  16. Luc said

    Great Job :)

  17. Steve said

    Thank you, finally a concise and straightforward way. It puzzles me that windows does not offer a GUI for this… RedHat even has one!
    Steve

  18. nice Artical

  19. Eric said

    I’m not sure if anybody mentioned this, but the reason some people may be having problems with quotes is probably due to them being formatted.

    And yes this worked great, thanks.

    Eric

  20. a13a said

    Maybe too late now but in case anyone is wondering about the quotes & spaces thing, here’s the clarification – the commandline expects a single argument after a flag such as /manualpeerlist and a space tells it to end the arugment; quotes are used to make the string with spaces appear as one single argument. It’s the same as when you want to cd to Documents and Settings, for instance – it would be:
    c:\> cd “Documents and Settings”

    Bottom line is, if you put spaces in between the peers in the peer list, you need the quotes; no spaces, don’t need the quotes.

  21. MagniuM said

    Hey there. thanks for helpful post.
    Just want to add some notes. I’ve found out recently that my 2008 R2 works weird with /manualpeerlist:”server0, server1, server2” and i changed to /manualpeerlist:time.nist.gov (just one domain)

    After this step it works fine.

  22. Moazzam said

    hi, i did the above actions and added multiple Time servers:

    w32tm /config /syncfromflags:manual /manualpeerlist:”0.oceania.pool.ntp.org,1.oceania.pool.ntp.org,2.oceania.pool.ntp.org,3.oceania.pool.ntp.org,ntp.mel.connect.com.au,toc.ntp.telstra.net”

    but still server time which is also DC, is 6 minutes slower than the actual time.

    what am i missing. please guide. Thanks

    • Marek.Z said

      Hi,

      Did you checked your firewall? Are the appropriate ports open for NTP traffic? If so, telnet to these NTP hosts to check the connection.

      Cheers!

  23. RDE said

    Thanks for your excellent and succinct post. One note, I just followed this again as I had to set up a new home/consulting network doman PDC from scratch, as my old one had become corrupted by bad RAM in the server. This during a transition of server upgrades that left it as the only domain controller in the forest. Bad news, really. Anyway, the access to the external NTP servers seems to work fine with only an inbound rule allowing port 123 access enabled, with no outbound port 123 rule. FWIW, but I just verified by sorting by port numbers in my Windows firewall to be sure.

    • Marek.Z said

      Hi,

      Thanks for your post. The inbound port needs to be opened for your clients accessing the DC and synchronizing the time. I was also referring to the corporate firewall, I’ll update the post.

      Cheers!

      - Marek.Z

  24. claymen said

    This is what worked for me.

    w32tm /config /syncfromflags:manual /manualpeerlist:”0.au.pool.ntp.org 1.au.pool.ntp.org 2.au.pool.ntp.org 3.au.pool.ntp.org” /update /reliable:yes
    w32tm /resync

    Keep in mind you can easily check whether it has worked by running
    w32tm /query /peers

    If you only see one peer then it’s not right. If you see multiple then all good. What you should see if you run the command above is written below. What I have noticed is that it will generally accept anything you put in but it needs to be as per the help section of w32tm /? which is space delimited and enclosed in quotes to get them all.

    w32tm /query /peers
    #Peers: 4

    Peer: 0.au.pool.ntp.org
    State: Active
    Time Remaining: 17.2309002s
    Mode: 1 (Symmetric Active)
    Stratum: 3 (secondary reference – syncd by (S)NTP)
    PeerPoll Interval: 6 (64s)
    HostPoll Interval: 6 (64s)

    Peer: 1.au.pool.ntp.org
    State: Active
    Time Remaining: 17.2309002s
    Mode: 1 (Symmetric Active)
    Stratum: 2 (secondary reference – syncd by (S)NTP)
    PeerPoll Interval: 6 (64s)
    HostPoll Interval: 6 (64s)

    Peer: 2.au.pool.ntp.org
    State: Active
    Time Remaining: 17.2309002s
    Mode: 1 (Symmetric Active)
    Stratum: 2 (secondary reference – syncd by (S)NTP)
    PeerPoll Interval: 6 (64s)
    HostPoll Interval: 6 (64s)

    Peer: 3.au.pool.ntp.org
    State: Active
    Time Remaining: 17.2309002s
    Mode: 1 (Symmetric Active)
    Stratum: 3 (secondary reference – syncd by (S)NTP)
    PeerPoll Interval: 6 (64s)
    HostPoll Interval: 6 (64s)

  25. Fred said

    Very clean and straight forward method. No registry editing required. Thanx for this

  26. Alex said

    Well the only way it worked for me ( Windows 2008 Server R2 With SP1
    Was …. /manualpeerlist:”timeserver1″ “timeserver2″ “timeserver3″ …….

    None of the others worked.

    cheers

    • Wade said

      Thanks Alex, this is the only way it worked for me too.

      Wade

      • I required our time sources between our storage devices, firewall and PDC to be synced, so now all devices get there time synced from the same source.

        his is what worked for me on our 2008R2 Standard SP1 Server:

        w32tm /config /syncfromflags:manual /manualpeerlist:time.nist.gov /update /reliable:yes

        I then did a query using: w32tm /query /status

        Leap Indicator: 0(no warning)
        Stratum: 2 (secondary reference – syncd by (S)NTP)
        Precision: -6 (15.625ms per tick)
        Root Delay: 0.3060097s
        Root Dispersion: 7.7757678s
        ReferenceId: 0x808A8DAC (source IP: 128.138.141.172)
        Last Successful Sync Time: 12/22/2012 9:44:22 PM
        Source: time.nist.gov
        Poll Interval: 6 (64s)

        all working well.

  27. Vic said

    Fast, easy and reliable – that’s what we want! Thank you!

  28. Worked perfectly on a Windows 2008 Server!!!!

  29. Jorge Simples said

    Thank you for your help

    Best Regards

  30. Thank you for these easy configuration steps!

    According http://support.microsoft.com/kb/816042/en-us and http://www.meinberg.de/english/faq/faq_28.htm, the 0×8 flag should be used.

    Statement from the KB article mentioned above: Note Use the 0×8 flag to force W32time to send normal client requests instead of symmetric active mode packets. The NTP servier replies to these normal client requests as usual.

    Used the following command for the configuration: w32tm /config /syncfromflags:manual /manualpeerlist:”0.pool.ntp.org,0×8 1.pool.ntp.org,0×8 2.pool.ntp.org,0×8″ and it’s working.

  31. Gregg said

    I just spent an hour on this. With 2008R2 use the “s and the ,0×1 at the end of each peer and a space between the peers. Until you get the w32tm /query /peers /verbose command to display each peer separately you haven’t got it right. The event log will tell you when you have it right imediatley with the /update.

  32. t00thless said

    Great article, thanks. I wish M$ could write something like this. I think the problem folks are having copying and pasting is, even pasted into notepad, the leading ” was backwards. I had to delete it and type ” from my keyboard.

  33. SajDubai said

    Hi, First Of all thank you so much guys for sharing you great knowledge. It is helping people around the globe..Keep up the good work…
    I am from United arab emirates and when i checked this ntppool website the number of NTP servers in UAE is showing as Zero. My question is this will work for me or not??Your advise in this regards is highly appreciated.Thanks

  34. Don’t forget to open port for NTP (UDP) traffic…

  35. Steven said

    Thanks a lot, it works well, although i had to use 0.ntp.pool.org alone as 1.ntp.pool.org, 2.ntp.pool.org were unexpected arguments. Unless you remove spaces and the quotes. When querried, still shows 0.ntp.pool.org only

  36. John D said

    Thanks! Exactly what I needed.

  37. Len Inkster said

    you need to enclose the entire manualpeerlist parameter in quotes.e.g. “/manualpeerlist:0.ntp.pool.org, 1.ntp.pool.org, 2.ntp.pool.org”

    • Seb said

      I just had to paste the whole command but deleted and re-typed each double-quote individually. No need to wrap the whole switch in quotes.

  38. Tom said

    Just wanted you to know, this info page just keeps on giving. Thanks!

  39. Atanas said

    The command in Windows 2008 r2 must now be written as:
    w32tm / config / syncfromflags: manual / manualpeerlist: “0.pool.ntp.org”, “1.pool.ntp.org”, “2.pool.ntp.org”, “3.pool.ntp.org”

  40. Aleksey said

    Thanx, it helped :
    this worked in PS:

    w32tm /config /syncfromflags:manual /manualpeerlist:”0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org” /update /reliable:yes

  41. manivannan said

    Dear All,

    I have two DC (primary and secondary) both i have configured as
    w32tm /config /manualpeer:172.25.11.90 /syncfromflags:MANUAL
    around 15 domain member servers are there, almost 80% of server synchornized but only few server not getting the time from DC. is that anything need to update the domain client server or DC.

  42. Screw MSFT said

    I’ve literally tried every suggestion on here and it still doesn’t work.

    I don’t blame anyone here, I blame Microsoft for this gross incompetence.

    I mean seriously, do I really need to go through 2 hours of trying to figure out how to set a F*%&’ing clock?!

    WHERE THE HELL IS STANDARDIZATION

    F MSFT

  43. kuasadewa said

    it works like a charm for me in windows 7. if you do the copy paste, make sure you re-type the double quotes (using any text editor and repair the double quotes and copy paste from the text editor to command prompt). don’t forget one space button between ntp server lists.

  44. yusuf said

    Hi…, possible to sync time with linux server via commend .
    (Like windows with linux time sync)

  45. Pavan said

    Hi All, i am new to NTP
    We have 3 No’s AD…..AD1 and AD2 have same time on both machine but is not the right time. AD3 has the right time (GMT +530, India).
    All of the clients are synchronizing with either AD1 or AD2 (not sure which from the two). Here are the list of things i need help with.

    1. When i change the time manually on AD1 or AD2 it gets changed back to the wrong time which is 10min ahead of the actual time. (changes automatically in 3 seconds every time i try changing manually). How to fix?
    2. How to check which AD is supplying the time sync to the clients?

    Please help.

  46. sanjay said

    All the command completed successfully.but when I try to execute “w32tm /resync” command we get below error.

    C:\>w32tm /resync
    Sending resync command to local computer
    The computer did not resync because no time data was available.

    C:\>

  47. Mital said

    Extremely useful!

  48. Amit said

    Thanks a lot .. this worked flawlessly :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 613 other followers

%d bloggers like this: