Thursday, March 18, 2010

Configuring Windows 2003 /​ XP SP2 to Use IOS NTP Server

June 10, 2008 by Greg Ferro · 5 Comments 

In cer­tain net­works, it is dif­fi­cult to get the time on your serv­ers to be exactly the same as the NTP time on your net­work equip­ment. In this case, you want to force the Windows serv­ers to use the same NTP Network time source as your routers and switches. But Microsoft Windows doesn’t under­stand NTP by default, it has its own ‘way’ of set­ting up NTP so you need a little tweak to make it com­pat­ible.

You should con­sider care­fully the state of your serv­ers before you do this. MS serv­ers that are part of an AD tree really should get their time from the AD Master (or how­ever the server folks have con­figured), if the clock var­ies you might find that some things don’t work well . I think this solu­tion works best for Standalone server (work­group mode) that are used as man­age­ment or mon­it­or­ing serv­ers. YMMV.

To Work

Stop the Windows Time Service using the CLI.

C:\Program Files\Support Tools>net stop w32time
The Windows Time service is stopping.
The Windows Time service was stopped successfully.

Now wind the time for­ward a couple of hours so we can con­firm that the NTP source is act­ive and it works.

C:\Program Files\Support Tools>time
The current time is: 19:19:23.95
Enter the new time: 21:19

C:\Program Files\Support Tools>time
The current time is: 21:19:01.82
Enter the new time: (just press enter to do nothing here)

Here comes the magic part:

C:\Program Files\Support Tools>w32tm /config /manualpeerlist:"198.18.0.2,198.18.0.3",0x8 /syncfromflags:MANUAL
The command completed successfully.

The peer list must be enclosed
Use the 0×8 flag to force W32time to send nor­mal cli­ent requests instead of sym­met­ric act­ive mode pack­ets (a la the Microsoft way). The NTP server replies to these nor­mal cli­ent requests as usual.

Restart the Windows Time Service and then force a sync.

C:\Program Files\Support Tools>net start w32time
The Windows Time service is starting.
The Windows Time service was started successfully.

C:\Program Files\Support Tools>w32tm /resync
Sending resync command to local computer...
The command completed successfully.

And, check the time

C:\Program Files\Support Tools>time
The current time is: 19:19:23.95
Enter the new time:

IOS con­fig­ur­a­tion

Your IOS router will need to be con­figured as an NTP Master, should get its time from a suit­able place. I also hook the NTP server on the Loopback inter­face so it works in HA net­works designs. So the fol­low­ing con­fig­ur­a­tion should be enough.

ntp source Loopback0
ntp update-calendar
ntp server xx.xx.xx.xx (see above for a valid time source)
ntp master

IOS NTP Debug looks like

242626: Jun  2 13:41:58.243 BST: NTP: rcv packet from 198.18.0.10 to 198.18.0.2 on Loopback0:
242627: Jun  2 13:41:58.243 BST:  leap 0, mode 3, version 3, stratum 4, ppoll 1024
242628: Jun  2 13:41:58.243 BST:  rtdel 0C42 (47.882), rtdsp 7D1D6 (7819.672), refid 0AD80002 (198.18.0.2)
242629: Jun  2 13:41:58.243 BST:  ref CBEE6523.AC125CF9 (13:25:07.672 BST Mon Jun 2 2008)
242630: Jun  2 13:41:58.243 BST:  org CBEE6516.27FF76BF (13:24:54.156 BST Mon Jun 2 2008)
242631: Jun  2 13:41:58.243 BST:  rec CBEE6516.28125CF9 (13:24:54.156 BST Mon Jun 2 2008)
242632: Jun  2 13:41:58.243 BST:  xmt CBEE6916.30125CF9 (13:41:58.187 BST Mon Jun 2 2008)
242633: Jun  2 13:41:58.243 BST:  inp CBEE6916.3F053E50 (13:41:58.246 BST Mon Jun 2 2008)
242634: Jun  2 13:41:58.243 BST: NTP: stateless xmit packet to 198.18.0.10:
242635: Jun  2 13:41:58.247 BST:  leap 0, mode 4, version 3, stratum 3, ppoll 1024
242636: Jun  2 13:41:58.247 BST:  rtdel 03D4 (14.954), rtdsp 0418 (15.991), refid 9E2BC042 (158.43.192.66)
242637: Jun  2 13:41:58.247 BST:  ref CBEE6908.3E268A0C (13:41:44.242 BST Mon Jun 2 2008)
242638: Jun  2 13:41:58.247 BST:  org CBEE6916.30125CF9 (13:41:58.187 BST Mon Jun 2 2008)
242639: Jun  2 13:41:58.247 BST:  rec CBEE6916.3F053E50 (13:41:58.246 BST Mon Jun 2 2008)
242640: Jun  2 13:41:58.247 BST:  xmt CBEE6916.3F38602F (13:41:58.246 BST Mon

Configuration Mistake ?

If you need to change any­thing, or make a mis­take it seems that the only way to change the settings:

w32tm [/​? | /​register | /​unregister ]
? — this help screen.
register — register to run as a ser­vice and add default con­fig­ur­a­tion to the registry.
unre­gister — unre­gister ser­vice and remove all con­fig­ur­a­tion inform­a­tion from the registry.

I am not sure whether a reboot is man­dat­ory to unre­gister, but I think that it is required. (please leave a com­ment if you know for sure)

Inspecting your Configuration

Open up regedit and nav­ig­ate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer

W32TIME01.jpg

Reference

1) http://​www​.spec​tracom​corp​.com/​S​u​p​p​o​r​t​/​L​i​b​r​a​r​y​/​I​n​t​e​g​r​a​t​i​o​n​G​u​i​d​e​s​/​S​y​n​c​h​w​i​t​h​W​3​2​T​i​m​e​/​W​i​n​2​0​0​3​d​o​m​a​i​n​c​o​n​t​r​o​l​l​e​r​/​t​a​b​i​d​/​1​7​8​/​D​e​fault.aspx

2) How to con­fig­ure an author­it­at­ive time server in Windows Server 2003

Please rate this post:

  Why Rate Posts?
1 Star - It\\\'s Crud2 Stars - It\\\'s Tosh3 Stars - Something\\\'s missing4 Stars - Needs works5 Stars - Good Enough6 Stars - Good7 Stars - Excellent8 Stars - Brilliant9 Stars - Astonishing10 Stars - Awesomely Godlike? (No Ratings Yet)
Loading ... Loading ...

Comments

5 Responses to “Configuring Windows 2003 /​ XP SP2 to Use IOS NTP Server”
  1. Michael says:

    why NTP mas­ter? i think you need NTP mas­ter on IOS only if you do not have a ref­er­ence clock but you do if you use a ntp server…

    BTW you might want to point out every­body can sync to pool​.ntp​.org

    MGK

  2. Greg Ferro says:

    From a secur­ity per­spect­ive, you should always have an internal clock source for your net­work. Thus ‘ntp master’.

    Therefore I usu­ally make the two ‘most’ core switches the NTP mas­ter for the entire net­work. Then sync these two against an external time source (ready for an atomic clock in the future). Thus ‘ntp server’.

    Firewall rules for pool​.ntp​.org are prob­lem­atic in some com­pan­ies since they may only allow IP addresses in fire­wall rules. Also, trust­ing an external clock is broadly regarded as insecure.

    Hard to find middle ground really.

  3. BenG says:

    Greg -

    The “ntp mas­ter” com­mand is only going to do some­thing if you loose your external syn­chron­iz­a­tion. By default, it has a stratum value of 7. Unless your external sources have a REALLY low stratum value, “ntp mas­ter” will never do any­thing. If you have two core devices, you may want to invest­ig­ate “ntp peer” between the two. This will allow both to sync to each other should they loose their bet­ter val­ued upstream source.

  4. Ivan says:

    Thanks a lot for your input!!! My sys­tem is work­ing great after fol­low­ing your doc­u­ment line by line.

    Thanks again!!
    Ivan

Trackbacks

Check out what others are saying about this post...


Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!