五.Q&A问答:<?XML:NAMESPACE PREFIX = O />

1. 为何当我使用net time /set  /Y 进行时间同步的时候,会出现异常,System Error 1314 has occurred?

   出现以上问题,可以使用以下命令进行同步:

使用w32tm /resync /computer:需要同步的计算机名称或IP地址, 即可实现同步。

2. 时间同步的层次关系及理论介绍

为确保合理地使用公共时间,Windows 时间服务使用层级关系来控制授权,并且不允许出现循环。默认情况下,基于 Windows 的计算机使用下面的层级:

所有客户端桌面计算机都提名身份验证域控制器作为其入站时间伙伴。

所有成员服务器都遵循与客户端桌面计算机相同的过程。

域中的所有域控制器都提名主域控制器 (PDC) 操作主机作为其入站时间伙伴。

所有 PDC 操作主机都遵循域的层级来选择其入站时间伙伴。

在此层级中,位于林根的 PDC 操作主机成为组织的权威时间服务器。

在典型配置中,AD域中的计算机以下列顺序同步时间:

1. 域客户机或成员服务器向本域DC请求同步

2. 一个域中的DC会向本域的PDC模拟器进行同步
3.
所有非森林根域的PDC模拟器向森林根域的PDC模拟器同步

4. 森林根域PDC模拟器配置为向外部时间源同步。

Windows XP/2003 及之后的时间服务使用NTP(网络时间协议)通过网络进行同步。Windows时间服务的组件包括:“Service Control Manager”, “Windows Time Service Manager”, “Clock Discipline”“Time providers”

行时间同步时,这些组件的工作过程如下:

n  “Input providers”NTP时间源请求并接收时间样本。

n  时间样本被传递到”Windows Time Service Manager”

n  “Windows Time Service Manager” 收集所有样本,并将其传递到”Clock Discipline”

n  “Clock Discipline” 使用NTP算法选择最佳时间样本。

n  “Clock Discipline” 调整系统时钟频率或是直接更改时间

3. 时间同步使用哪些协议?

第一种:SNTP,是现在应用较多的一种网络时间协议,Windows域内的时间同步就是使用的这种协议,使用UDP123端口进行通讯

第二种:Time Protocol,服务器在TCP/UDP 37端口上进行监听,这种协议只能使用到2036

 

 

六. W32tm 的使用,由微软的帮助命令获取的信息,人工翻译,欠缺之处见谅。

(1). w32tm /monitor [/domain:]

               [/computers:[,[,...]]]

               [/threads:]

W32tm /monitor [/domain: 域名][/computers: pc1,pc2,…]或者[/threads:数目]

  domain - specifies which domain to monitor. If no domain name

    is given, or neither the domain nor computers option is

    specified, the default domain is used. This option may be

    used more than once.

    指定哪个域被监控,如果没有指定,则默认是当前的域

  computers - monitors the given list of computers. Computer

    names are separated by commas, with no spaces. If a name is

    prefixed with a '*', it is treated as a PDC. This option

    may be used more than once.

    监控多个计算机,计算机之间用逗号隔开,如果计算机名称前面加*号,代表当前计算机时PDC,会被特殊对待

  threads - how many computers to analyze simultaneously. The

    default value is 3. Allowed range is 1-50.

    指定多少计算机被同时分析,默认值为3,数字范围为1~50

(2). w32tm /ntte

  Convert a NT system time, in (10^-7)s intervals from 0h 1-Jan 1601,

  into a readable format.

  将当前时间设置为NT的时间类型, 起始时间为160111号,只读模式

 

w32tm /ntpte

  Convert an NTP time, in (2^-32)s intervals from 0h 1-Jan 1900, into

  a readable format.

将当前时间设置为NTP的时间类型, 起始时间为190011号,只读模式

(3). w32tm /resync [/computer:] [/nowait] [/rediscover] [/soft]  

Tell a computer that it should resynchronize its clock as soon

as possible, throwing out all accumulated error statistics.

通知一台计算机,它需要立即同步时钟,显示各种各样的错误统计。

  computer: - computer that should resync. If not

    specified, the local computer will resync.

  计算机名称,如果不指定,表示本地计算机需要同步。

  nowait - do not wait for the resync to occur;

    return immediately. Otherwise, wait for the resync to

    complete before returning.

  无需等待,立即返回,否则需要完成同步后,才可以进入下一个等待命令

  rediscover - redetect the network configuration and rediscover

    network sources, then resynchronize.

  是否需要检测网络配置和网络类型,然后再同步

  soft - resync utilizing existing error statistics. Not useful,

    provided for compatibility.  软同步,如果同步有误,则提供兼容性。

 

4w32tm /stripchart /computer: [/period:]

    [/dataonly] [/samples:]

  Display a strip_chart of the offset between this computer and

  another computer.

  以条形图的形式显示出当前计算机与另一台计算机之间的时间差异值

  computer: - the computer to measure the offset against.

  目标计算机

  period: - the time between samples, in seconds. The

    default is 2s

 2 个实例之间的间隔时间,默认是2

  dataonly - display only the data, no graphics.

    只显示数据,没有图形

  samples: - collect samples, then stop. If not

    specified, samples will be collected until Ctrl-C is pressed.

  指定实例的个数,如果没有指定需要用Ctrl—C 停止

注意:这里指定的计算机不能是普通计算机,必须是时间服务器(SNTP),这个命令本质就是查看当前客户源与一个SNTP(时间源)服务器的时间差

如果是普通计算机会出现_____0x800705B4错误,截图如下:

采用正确的时间源进行比较,截图如下:

(5). w32tm /config [/computer:] [/update]

    [/manualpeerlist:] [/syncfromflags:]

    [/LocalClockDispersion:]

  computer: - adjusts the configuration of . If not

    specified, the default is the local computer.

  指定需要调整的目标计算机,默认为本地

  _update- notifies the time service that the configuration has

    changed, causing the changes to take effect

通知time service 服务,配置信息已经发生变化,需要让变化生效。

  manualpeerlist: - sets the manual peer list to ,

    which is a space-delimited list of DNS and/or IP addresses.

    When specifying multiple peers, this switch must be enclosed in

    quotes.

   设定手动管道列表,多个DNSIP地址用空格分开。

  syncfromflags: - sets what sources the NTP client should

    sync from. should be a comma separated list of

    these keywords (not case sensitive):

      MANUAL - include peers from the manual peer list

      DOMHIER - sync from a DC in the domain hierarchy

   

(6). w32tm /tz

  Display the current time zone settings.

显示当前时区设置

(7). w32tm /dumpreg [/subkey:] [/computer:]

  Display the values associated with a given registry key.

显示指定注册表的值

  The default key is HKLM\System\CurrentControlSet\Services\W32Time

    (the root key for the time service).

  subkey: - displays the values associated with subkey of the default key.

  computer: - queries registry settings for computer

显示写在注册表中的值,默认位置为HKLM\System\CurrentControlSet\Services\W32Time