[ntp:questions] Setting ntp servers with ntpd windows
Heiko_removeme at am-anger-1.de
Fri Aug 10 10:13:46 UTC 2007
Ryan Malayter schrieb:
> On Aug 8, 11:41 am, shane-dated-1187195937.8dd... at cm.nu wrote:
>> I use the ntp installer for Windows and have installed to a number of
>> machines here. Just wondering if there is a better way of doing the ntpd
>> server config than manual entries in ntp.conf. For example on our
>> Unix-based systems, we use a dhcp server and use the ntp-servers dhcp
>> option. The dhclient-script on the Unix clients rewrites ntp.conf with the
>> servers obtained from dhcp making configuration changes much easier. Is
>> there any way to do this under the Windows client?
> If you have a Windows domain (meaning a Windows Server with Active
> Directory), your client workstations and non-domain controller servers
> will by default use the Windows time service to automatically get time
> from the domain controllers. So only the domain controllers need to
> have any configuration done.
> If you want to use the "real" ntpd on windows, I know of no way to
> modify the Windows DHCP client service to execute a script. I think
> the Windows DHCP client itself simply ignores any DHCP options it is
> not interested in. Our DHCP server returns type 042 records for time
> servers, but those are not stored in the Windows system registry as
> far as I can tell.
> However, it appears you can get at the data somehow with the windows
> DHCP client API:
That looks really nice and I will check if we can implement this into
the Windows port. I could add the required registry entries with my
installer and all it would take would be that ntpd reads a specific
registry key (where the DHCP results have been stored) and creates a
ntpd.conf out of it. Another possibility would be to use a little
utility which generates a config file out of this, but this would mean
that this tools would have to be started before the service which is a
PITA to set up.
> You could do this with any scripting language that can make win32 API
> calls. VBscript cannot do so without a C++ COM wrapper, nor can
> really want to do this.
> If you don't want to mess with Win32 API stuff, I think the simplest
> solution would be to have a startup script on all machines that
> updates the ntpd configuration file from a network share. You can then
> have that shared config file manually updated, or update the network
> share from one of your UNIX machines. Your DHCP time server
> configuration should be fairly static.
If you use the unattended install mode of our installer, you can specify
a location from which the installer will read a prepared ntp
configuration file. This file will be copied into the NTP program folder
(NTP\etc\ntp.conf) once during installation. It is not updated later,
but you could use the startup script to do this, just as described above.
More information about the questions