ntp 用组策略配置Windows时间客户端.doc_第1页
ntp 用组策略配置Windows时间客户端.doc_第2页
ntp 用组策略配置Windows时间客户端.doc_第3页
ntp 用组策略配置Windows时间客户端.doc_第4页
ntp 用组策略配置Windows时间客户端.doc_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

用组策略配置Windows时间客户端用组策略配置Windows时间客户端2009-12-15 23:09经常我们会发现自己的计算机时间不准确,即使校对之后,不长时间发现时间又不准确了。通常这跟主板上的芯片质量有关系,因为每台计算机的时钟发生器 的精度不同。对于一般人来说,如果时间差异不大,都可以接受,但是对于许多时间相关的系统来说,例如银行、电信等,这就非常重要的,这些系统至少需要保证 同一套系统中所有服务器的时间相一致。解决方法是使用软件自动对时,时间协议就是用于这个目的。可以在局域网中配置一个时间服务器,然后所有客户端与之同 步时间。因特网上也有许多免费的时间服务器。现在的操作系统大部分都自带时间服务器或客户端软件,只需要稍微配置一下,就可以与时间服务器同步,从而保证自己的时间与服务器相一致。 Windows也不例外,自Windows 2000开始,就可以很方便地配置时间客户端或时间服务。下面以Windows 2003为例,使用组策略的方法来配置时间客户端。首先选择“开始”“运行”,并输入gpedit.msc:打开组策略编辑器,并选择“计算机配置”“管理模板”“系统”“Windows时间服务”“时间提供程序”:在右边栏中选择“启用Windows NTP客户端”,并在“启用Windows NTP客户端”对话框中选择“已启用”:点击“下一设置”,并在“配置Windows NTP客户端”对话框中配置相应信息(例如将NtpServer设置为, 0x1,选择Type为NTP):点击“下一设置”,并在对话框中选择“已禁用”:点击“确定”,完成配置。之后系统将每小时(3600秒)与时间服务器同步一次,这可以通过打开“日期和时间 属性”对话框来确认:关于如何配置时间服务器的方法,请参考此文档。目录 使用Windows操作系统的客户端如何设置NTP网络服务器. 1 1 Windows 2000. 1 1.1 命令介绍. 1 1.1.1 NET TIME. 1 1.1.2 W32time. 1 1.1.3 设置示例. 2 1.1.4 可能出现的问题. 2 2 Windows XP. 2 2.1 命令介绍. 2 2.1.1 NET TIME. 2 2.1.2 W32time. 3 2.1.3 设置示例. 3 2.1.4 可能出现的问题. 3 3 Windows Server 2003. 3 3.1 命令介绍. 3 3.1.1 NET TIME. 3 3.1.2 W32time. 4 3.1.3 设置示例. 4 3.1.4 可能出现的问题. 4 1 Windows 20001.1 命令介绍Windows 2000下有关时间的命令有两个,net time和W32tm,下面对这两个命令的语法和参数加以说明。 1.1.1 NET TIMEnet time命令使计算机的时钟与另一个计算机或域的时钟同步。如果在没有 /set 选项的情况下使用,则显示另一个计算机或域的时间。net time的语法为: net time computername | /domain:domainname | /rtsdomain:domainname /set net time computername /querysntp | /setsntp:ntp server list参数说明: l 无参数,显示被指派为本地计算机的Windows服务器域时间服务器的当前时间。 l computername,指定要检查或与之同步的服务器的名称。 l /domain:domainname,指定要同步时间的域。 l /rtsdomain:domainname,指定要与之同步的可信时间服务器所在的域。 l /set,使计算机的时钟与指定的计算机或域的时间同步。 l /querysntp,显示当前为本地计算机或 computername 所指定的计算机配置网络时间协议(NTP)服务器的名称。 l /setsntp:ntp server list,指定本地计算机所使用的NTP时间服务器的列表。该列表可以包含IP地址或DNS名称,用空格分开。如果要使用多个时间服务器,该列表必须用引号引起来。例如net time /setsntp:,0x1 ,0x1”,其中的0x1是在使用完整域名称作为NTP服务器的时候需要的,如果使用IP地址则可以忽略。 1.1.2 W32timeW32tm是用来同步本地计算机与远程计算机或域时间的类似命令。在域控制器上使用W32tm前必须停止W32Time,完成后再启动W32Time。W32tm的语法为: w32tm -tz | -s computer | -adj | -adjoff | -source | -once -test -v -p -period 关于W32tm语法的详细说明,可以在命令提示符下键入W32tm /?,将列出语法和所有参数的说明。 1.2 注册表项以下注册表项位于 HKLMSYSTEMCurrentControlSetServicesW32Time 1.2.1 ParametersPeriodHKLMSYSTEMCurrentControlSetServicesW32TimeParametersPeriod 注册表项控制着 Windows 时间服务同步的频率。为它指定的值只能是以下列表中的某个特殊值: l 65531, DailySpecialSkew - 设置为每隔 45 分钟同步一次,直到有一次成功,然后每天同步一次。 l 65532, SpecialSkew - 设置为每隔 45 分钟同步一次,直到有三次成功,然后每隔八小时同步一次。这是默认设置。 l 65533, Weekly - 设置为每隔七天同步一次。 l 65534, Tridaily - 设置为每隔三天同步一次。 l 65535, BiDaily - 设置为每隔两天同步一次。 l 0 - 对于 NT5DS,则每隔 45 分钟同步一次,直到有三次成功,然后每隔八小时同步一次。对于 NTP,则每隔 8 小时同步一次。 l freq - freq 代表您希望 Windows 时间服务每天同步的次数。如果您不想使用那些事先指定好的值,则必须使用此选项。 1.3 设置示例设置 Windows Time 服务:在“控制面板”中打开“管理工具”,再打开“服务”;在服务中找到“Windows Time”,双击服务名称,在打开的“Windows Time的属性”中设置“启动类型”为“自动”,再按下启动按钮。 在“运行(R)”中用“cmd”命令进入在DOS命令行窗体;执行以下命令(注意空格): net time /setsntp:32 net stop w32time net start w32time w32tm s(设置时间服务器地址) (停止时间服务) (启动时间服务) (立即同步时间)1.4 可能出现的问题计算机没有同步。因为没有可用的时间数据。(The computer did not resync because no time data was available) 出现该问题的原因可能是windows time service没有正确的启动,或者与组策略中的时间配置冲突。请在组策略(gpedit.msc)中将配置更改为“未配置”。 2 Windows XP2.1 命令介绍Windows XP下有关时间的命令有两个,net time和W32tm,下面对这两个命令的语法和参数加以说明。 2.1.1 NET TIMEnet time命令使计算机的时钟与另一个计算机或域的时钟同步。如果在没有 /set 选项的情况下使用,则显示另一个计算机或域的时间。net time的语法为: net time computername | /domain:domainname | /rtsdomain:domainname /set net time computername /querysntp | /setsntp:ntp server list参数说明: l 无参数,显示被指派为本地计算机的Windows服务器域时间服务器的当前时间。 l computername,指定要检查或与之同步的服务器的名称。 l /domain:domainname,指定要同步时间的域。 l /rtsdomain:domainname,指定要与之同步的可信时间服务器所在的域。 l /set,使计算机的时钟与指定的计算机或域的时间同步。 l /querysntp,显示当前为本地计算机或 computername 所指定的计算机配置网络时间协议(NTP)服务器的名称。 l /setsntp:ntp server list,指定本地计算机所使用的NTP时间服务器的列表。该列表可以包含IP地址或DNS名称,用空格分开。如果要使用多个时间服务器,该列表必须用引号引起来。例如net time /setsntp:,0x1 ,0x1”,其中的0x1是在使用完整域名称作为NTP服务器的时候需要的,如果使用IP地址则可以忽略。 2.1.2 W32timeW32tm是用来同步本地计算机与远程计算机或域时间的类似命令。在域控制器上使用W32tm前必须停止W32Time,完成后再启动W32Time。W32tm的语法为:w32 w32tm /? | /register | /unregister w32tm /monitor /domain: /computers:,. /threads: w32tm /ntte w32tm /ntpte w32tm /resync /computer: /nowait /rediscover /soft w32tm /stripchart /computer: /period: /dataonly /samples: w32tm /config /computer: /update /manualpeerlist: /syncfromflags: /LocalClockDispersion: w32tm /tz w32tm /dumpreg /subkey: /computer:关于W32tm语法的详细说明,可以在命令提示符下键入W32tm /?,将列出语法和所有参数的说明。 2.2 注册表项以下注册表项位于 HKLMSYSTEMCurrentControlSetServicesW32Time 注册表项MaxPosPhaseCorrection路径HKLMSYSTEMCurrentControlSetServicesW32TimeConfig注意该 项指定服务可进行的最大正时间校准量(以秒为单位)。如果服务确定某个更改幅度大于所需的幅度,它将记录一个事件。特殊情况:0xFFFFFFFF 表示总是校准时间。域成员的默认值是 0xFFFFFFFF。独立客户端和服务器的默认值是 54,000(15 小时)。注册表项MaxNegPhaseCorrection路径HKLMSYSTEMCurrentControlSetServicesW32TimeConfig注意该项指定服务可进行的最大负时间校准量(以秒为单位)。如果服务确定某个更改幅度大于所需的幅度,它将转而记录一个事件。特殊情况:-1 表示总是校准时间。域成员的默认值是 0xFFFFFFFF。独立客户端和服务器的默认值是 54,000(15 小时)。注册表项MaxPollInterval路径HKLMSYSTEMCurrentControlSetServicesW32TimeConfig注意该项指定系统轮询间隔所允许的最大间隔(单位是对数表示的秒)。请注意,尽管系统必须根据预定的间隔进行轮询,但是提供程序可以根据请求拒绝生成示例。域成员的默认值是 10。独立客户端和服务器的默认值是 15。注册表项SpecialPollInterval路径HKLMSYSTEMCurrentControlSetServicesW32TimeTimeProvidersNtpClient注意该项指定手动对等端的特殊轮询间隔(以秒为单位)。当启用 SpecialInterval 0x1 标志时,W32Time 将使用此轮询间隔而非操作系统确定的轮询间隔。域成员的默认值是 3,600。独立客户端和服务器的默认值是 604,800。注册表项MaxAllowedPhaseOffset路径HKLMSYSTEMCurrentControlSetServicesW32TimeConfig注意该项指定 W32Time 尝试使用时钟速率调整计算机时钟的最大偏移(以秒为单位)。当偏移大于该速率时,W32Time 将直接设置计算机时钟。域成员的默认值是 300。独立客户端和服务器的默认值是 1。2.2.1 ParametersNtpServerHKLMSYSTEMCurrentControlSetServicesW32TimeParametersNtpServer Data typeRangeDefault valueREG_SZDNS name or IP address,0x1 | 0x2 | 0,0x1Description Stores a list of time sources that this computer uses to synchronize its time. The time sources appear either as a DNS name or an IP address of the time source server. The list is space-delimited, with one address per line. Each time source may also be followed by a comma and a DWORD containing flags for special handling of that time source. If the flags are not specified, they default to 0x0. The available flags are: ValueMeaning0x1Instead of following the NTP specification, wait for the interval specified in the SpecialPollInterval entry before attempting to recontact this time source. Setting this flag decreases network usage, but it also decreases accuracy.0x2Use this time source only as a fallback. If all time sources that are not fallbacks have failed, then the system selects one fallback time source at random and uses it.0x4Set the local computer to operate in symmetric active mode in the association with this source.0x8Set the local computer to operate in client mode in the association with this source.例如net time /setsntp:,0x1 ,0x1”,其中的0x1是在使用完整域名称作为NTP服务器的时候需要的,如果使用IP地址则可以忽略。 Change Method You can change the value of this entry by using the /setsntp parameter of the net time command at the command line. For more information about net time, see Help and Support Center for Windows XP. 2.2.1 ParametersTypeHKLMSYSTEMCurrentControlSetServicesW32TimeParameters Data typeRangeDefault valueREG_SZNoSync | NTP | Nt5DS | AllSyncNt5DS for computers joined to a domain; NTP for othersDescription Specifies the type of time sources, if any, to which the computer synchronizes its time. ValueMeaningNoSyncDoes not synchronize time.NTPSynchronizes time to the time sources specified in the ParametersNtpServer entry.Nt5DSSynchronizes time to the domain hierarchy.AllSyncUses all synchronization mechanisms available.Change Method To change the value of this entry, use the command-line tool w32tm.exe (specifically, the command w32tm /config /syncfromflags). For more information about w32tm.exe, see Windows Server 2003 Help and Support Center. Activation Method To make changes to this entry effective, at the command line, type: w32tm /config /update 2.3 设置示例2.3.1 使用“时间和日期 属性”设置对话框双击任务栏右下角“时间”,打开“时间和日期 属性”设置对话框; 选择“Internet时间”标签; 选中“自动与Internet时间服务器同步”选项,在“服务器”中填入网络时间服务器的IP地址,如“32”(只能输入1个服务器地址)。按“立即更新”可直接同步。 2.3.2 命令方式在“运行(R)”中用“cmd”命令进入在DOS命令行窗体;执行以下命令(注意空格): net time /setsntp: ”32 ,0x1” net stop w32time net start w32time w32tm /resync /nowait /rediscover(设置时间服务器地址,可多个) (停止时间服务) (启动时间服务) (立即同步时间)2.4 可能出现的问题计算机没有同步。因为没有可用的时间数据。(The computer did not resync because no time data was available) 出现该问题的原因可能是windows time service没有正确的启动,或者与组策略中的时间配置冲突。请在组策略(gpedit.msc)中将配置更改为“未配置”。 3 Windows Server 20033.1 命令介绍Windows Server 2003下有关时间的命令有两个,net time和W32tm,下面对这两个命令的语法和参数加以说明。 3.1.1 NET TIMEnet time命令使计算机的时钟与另一个计算机或域的时钟同步。如果在没有 /set 选项的情况下使用,则显示另一个计算机或域的时间。net time的语法为: net time computername | /domain:domainname | /rtsdomain:domainname /set net time computername /querysntp | /setsntp:ntp server list参数说明: l 无参数,显示被指派为本地计算机的Windows服务器域时间服务器的当前时间。 l computername,指定要检查或与之同步的服务器的名称。 l /domain:domainname,指定要同步时间的域。 l /rtsdomain:domainname,指定要与之同步的可信时间服务器所在的域。 l /set,使计算机的时钟与指定的计算机或域的时间同步。 l /querysntp,显示当前为本地计算机或 computername 所指定的计算机配置网络时间协议(NTP)服务器的名称。 l /setsntp:ntp server list,指定本地计算机所使用的NTP时间服务器的列表。该列表可以包含IP地址或DNS名称,用空格分开。如果要使用多个时间服务器,该列表必须用引号引起来。参见注册表项中NtpServer项说明。 3.1.2 W32timeW32tm是用来同步本地计算机与远程计算机或域时间的类似命令。在域控制器上使用W32tm前必须停止W32Time,完成后再启动W32Time。W32tm的语法为: w32tm /? | /register | /unregister w32tm /monitor /domain: /computers:,. /threads: w32tm /ntte w32tm /ntpte w32tm /resync /computer: /nowait /rediscover /soft w32tm /stripchart /computer: /period: /dataonly /samples: w32tm /config /computer: /update /manualpeerlist: /syncfromflags: /LocalClockDispersion: w32tm /tz w32tm /dumpreg /subkey: /computer:关于W32tm语法的详细说明,可以在命令提示符下键入W32tm /?,将列出语法和所有参数的说明。 3.2 注册表项以下注册表项位于 HKLMSYSTEMCurrentControlSetServicesW32Time 注册表项MaxPosPhaseCorrection路径HKLMSYSTEMCurrentControlSetServicesW32TimeConfig注意该 项指定服务可进行的最大正时间校准量(以秒为单位)。如果服务确定某个更改幅度大于所需的幅度,它将记录一个事件。特殊情况:0xFFFFFFFF 表示总是校准时间。域成员的默认值是 0xFFFFFFFF。独立客户端和服务器的默认值是 54,000(15 小时)。注册表项MaxNegPhaseCorrection路径HKLMSYSTEMCurrentControlSetServicesW32TimeConfig注意该项指定服务可进行的最大负时间校准量(以秒为单位)。如果服务确定某个更改幅度大于所需的幅度,它将转而记录一个事件。特殊情况:-1 表示总是校准时间。域成员的默认值是 0xFFFFFFFF。独立客户端和服务器的默认值是 54,000(15 小时)。注册表项MaxPollInterval路径HKLMSYSTEMCurrentControlSetServicesW32TimeConfig注意该项指定系统轮询间隔所允许的最大间隔(单位是对数表示的秒)。请注意,尽管系统必须根据预定的间隔进行轮询,但是提供程序可以根据请求拒绝生成示例。域成员的默认值是 10。独立客户端和服务器的默认值是 15。注册表项SpecialPollInterval路径HKLMSYSTEMCurrentControlSetServicesW32TimeTimeProvidersNtpClient注意该项指定手动对等端的特殊轮询间隔(以秒为单位)。当启用 SpecialInterval 0x1 标志时,W32Time 将使用此轮询间隔而非操作系统确定的轮询间隔。域成员的默认值是 3,600。独立客户端和服务器的默认值是 604,800。注册表项MaxAllowedPhaseOffset路径HKLMSYSTEMCurrentControlSetServicesW32TimeConfig注意该项指定 W32Time 尝试使用时钟速率调整计算机时钟的最大偏移(以秒为单位)。当偏移大于该速率时,W32Time 将直接设置计算机时钟。域成员的默认值是 300。独立客户端和服务器的默认值是 1。3.2.1 ParametersNtpServerHKLMSYSTEMCurrentControlSetServicesW32TimeParametersNtpServer Data typeRangeDefault valueREG_SZDNS name or IP address,0x1 | 0x2 | 0,0x1Description Stores a list of time sources that this computer uses to synchronize its time. The time sources appear either as a DNS name or an IP address of the time source server. The list is space-delimited, with one address per line. Each time source may also be followed by a comma and a DWORD containing flags for special handling of that time source. If the flags are not specified, they default to 0x0. The available flags are: ValueMeaning0x1Instead of following the NTP specification, wait for the interval specified in the SpecialPollInterval entry before attempting to recontact this time source. Setting this flag decreases network usage, but it also decreases accuracy.0x2Use this time source only as a fallback. If all time sources that are not fallbacks have failed, then the system selects one fallback time source at random and uses it.0x4Set the local computer to operate in symmetric active mode in the association with this source.0x8Set the local computer to operate in client mode in the association with this source.例如net time /setsntp:,0x1 ,0x1”,其中的0x1是在使用完整域名称作为NTP服务器的时候需要的,如果使用IP地址则可以忽略。 Change Method You can change the value of this entry by using the /setsntp parameter of the net time command at the command line. For more information about net time, see Help and Support Center for Windows Server 2003. 3.2.2 ParametersTypeHKLMSYSTEMCurrentControlSetServicesW32TimeParameters Data typeRangeDefault valueREG_SZNoSync | NTP | Nt5DS | AllSyncNt5DS for computers joined to a domain; NTP for othersDescription Specifies the type of time sources, if any, to which the computer synchronizes its time. ValueMeaningNoSyncDoes not synchronize

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论