Synchronizing to an NTP server over LAN

jtr1962

Storage? I am Storage!
Joined
Jan 25, 2002
Messages
4,168
Location
Flushing, New York
I recently set up my desktop PC as an NTP server ( don't ask-it's a really long story ). Everything works well, time seems to match my G-Shock solar atomic watch exactly. I even set up my laptop to synchronize to the desktop over the LAN every 15 minutes. I used task scheduler to run the net time \\{time server name} /set command every 15 minutes indefinitely.

My question-is there an easier way to do this? It took a lot of trial and error to get the synchronization to work properly. When I was done, I couldn't help but think there had to be a better way. I tried Internet time synchronization using the name of my desktop as the time server, but it didn't work for some reason. Ultimately, since I went through the bother of setting up a time server, I want to use it to sync the clocks of all the PCs on the network.

BTW, the desktop is running XP Service Pack 3 and the laptop is running Vista Business 64.

Another question-the polling interval on the desktop seems to have settled down to 1024 seconds. Is this typical for NTP servers? To me it doesn't matter one way or another, but I don't want to be blocked from any Internet time servers on account of an abusively high polling rate. I'm assuming my NTP client decided that 1024 was as high as it could go without clock going outside the 128 ms NTP limit.

Oh, and the short version of the long story is that the time on my friend's XP desktop went wacko (i.e. it was off by 30 seconds ten minutes after syncing to Internet time). My attempts to help him fix the problem led me to the world of NTP. Being that I like to experiment, and I'm a stickler for having clocks keeping time to the second, it was inevitable that I'd end up setting up a time server. That's the short version. The long one would take about ten pages.
 

ddrueding

Fixture
Joined
Feb 4, 2002
Messages
19,511
Location
Horsens, Denmark
My guesses:

1. Your friend is overclocking
2. Your friend has a dead BIOS battery.

NTP is a PITA that I've abandoned. I set the domain controller manually (which I set from my cell phone), and everything pulls from there.
 

Chewy509

Wotty wot wot.
Joined
Nov 8, 2006
Messages
3,327
Location
Gold Coast Hinterland, Australia
Yes there is a better way, use the w32time service that is builtin into windows. (This is the service that keeps time in sync when computers are part of a domain).

IIRC, you simply just need to run:

w32tm /setsntp:<ntp server>

and start the w32time service. You client will then sync as needed, which IIRC is once a day or at start-up.

However MS seem to f&*k with these settings on each windows version (and even between service packs), so you may need to hit google to find the exact settings... (Which may explain why DD has had issues with it).
 

Howell

Storage? I am Storage!
Joined
Feb 24, 2003
Messages
4,740
Location
Chattanooga, TN
Depending on the size of of your domain you should set one or two boxes to be authoritative NTP time servers, pulling time from external sources. All of your other boxes will pull time from the authoritative servers. For my money it is important that internal time be consistent for domain authentications, but it is also important the internal time be consistent with external time for things like time stamps on log files. I just spent a small amount of time getting my switches pulling time so the logs and firmware time stamps would be sensible.

Jtr, since you don't have a normal domain the "client" may not automatically find the "server" but it is easy enough to configure it manually. Get the server pulling time properly with the NTProtocol and then get the client pulling from the server with the NTD5(?) protocol.


Btw, the default windows NTP time server time.microsoft.com has been down for awhile. You should use nist.time.gov instead.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,737
Location
USA
I don't have anything to add except to ask if pool.ntp.org is as good as, better, or worse than using nist.time.gov? I've always pointed my servers to pool.ntp.org, which is why I ask.
 

jtr1962

Storage? I am Storage!
Joined
Jan 25, 2002
Messages
4,168
Location
Flushing, New York
Yes there is a better way, use the w32time service that is builtin into windows. (This is the service that keeps time in sync when computers are part of a domain).

IIRC, you simply just need to run:

w32tm /setsntp:<ntp server>

and start the w32time service. You client will then sync as needed, which IIRC is once a day or at start-up.

However MS seem to f&*k with these settings on each windows version (and even between service packs), so you may need to hit google to find the exact settings... (Which may explain why DD has had issues with it).
/setsntp: wasn't even a valid switch in Vista for w32tm. Before I even started this thread, I did try net time /setsntp: which worked just fine for setting the NTP server ( so does w32tm /config /syncfromflags:MANUAL /manualpeerlist:time_server_name /update ), but w32 time refused to synchonize when I tried w32tm /resync. All I ended up with was this error message: "The computer did not resync because no time data was available".

In any case, I stumbled on the answer-I needed to open port 123 on my time server to NTP traffic. The weird thing is the net time /set command worked just fine even when this port was closed. Here is a good how-to in case anyone else is having a similar problem. Once I opened port 123, w32tm /resync worked just fine, and so does Internet time synchronization with the name of my time server as the time source.

Lesson of the day-if you're setting up a time server, make sure port 123 is open.

And why does M$ make what should be a simple task so f-ing hard?
 

Bozo

Storage? I am Storage!
Joined
Feb 12, 2002
Messages
4,396
Location
Twilight Zone
To me it sounds like you are making it harder than it has to be.

Right click on the time in the task bar; Click the Internet Time tab; have the computer sychronise with the time server of your choice.

Then have the other computer sync with a batch file [net time \\xxx.xxx.xxx.xxx /set /yes] Run this from schdualed task.
 

Howell

Storage? I am Storage!
Joined
Feb 24, 2003
Messages
4,740
Location
Chattanooga, TN
How I feel about pool.ntp.org centers around the fact that each node is a volunteer project and which node you get is determined by round robin. Additionally, according to their website (http://www.pool.ntp.org/en/) most major Linux distributions are pointed there which is certain to increase the load.

In the end, in order to be effective a time server needs to be accurate and available. As robust as the NTP protocol is I'm not as concerned with accuracy as with availability and the NIST servers are almost all run by universities. I feel more comfortable querying a government body for the business.

As an aside, I used to use tick and tock at USNO but I kept forgetting the full address. :)
 

Mercutio

Fatwah on Western Digital
Joined
Jan 17, 2002
Messages
21,564
Location
I am omnipresent
All of Purdue's UNIX hosts are configured to properly handle NTP queries. In cases where I've needed it, I've pointed hosts at addresses there for years.
 
Top