sealuxe希诺丝是假高端:windows ntp server时间同步命令

来源:百度文库 编辑:偶看新闻 时间:2024/05/06 02:31:24
Windows 2000下有关时间的命令有两个,net time和W32tm,下面对这两个命令的语法和参数加以说明。
net 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:"time.nist.gov,0x1 time-a.nist.gov,0x1”,其中的0x1是在使用完整域名称作为NTP服务器的时候需要的,如果使用IP地址则可以忽略。
W32tm是用来同步本地计算机与远程计算机或域时间的类似命令。在域控制器上使用W32tm前必须停止W32Time,完成后再启动W32Time。W32tm的语法为:
w32tm [ -tz | -s [computer] | -adj | -adjoff | -source | -once ]
[-test] [-v] [-p ] [-period ]
关于W32tm语法的详细说明,可以在命令提示符下键入W32tm /?,将列出语法和所有参数的说明。
以下注册表项位于 HKLM\SYSTEM\CurrentControlSet\Services\W32Time1.2.1 Parameters\Period
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\Period 注册表项控制着 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:192.168.1.232
net stop w32time
net start w32time
w32tm –s
(设置时间服务器地址)
(停止时间服务)
(启动时间服务)
(立即同步时间)
计算机没有同步。因为没有可用的时间数据。(The computer did not resync because no time data was available)
出现该问题的原因可能是windows time service没有正确的启动,或者与组策略中的时间配置冲突。请在组策略(gpedit.msc)中将配置更改为“未配置”。
Windows XP下有关时间的命令有两个,net time和W32tm,下面对这两个命令的语法和参数加以说明。
net 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:"time.nist.gov,0x1 time-a.nist.gov,0x1”,其中的0x1是在使用完整域名称作为NTP服务器的时候需要的,如果使用IP地址则可以忽略。
W32tm是用来同步本地计算机与远程计算机或域时间的类似命令。在域控制器上使用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 /?,将列出语法和所有参数的说明。
以下注册表项位于 HKLM\SYSTEM\CurrentControlSet\Services\W32Time
注册表项
MaxPosPhaseCorrection
路径
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config
注意
该 项指定服务可进行的最大正时间校准量(以秒为单位)。如果服务确定某个更改幅度大于所需的幅度,它将记录一个事件。特殊情况:0xFFFFFFFF 表示总是校准时间。域成员的默认值是 0xFFFFFFFF。独立客户端和服务器的默认值是 54,000(15 小时)。
注册表项
MaxNegPhaseCorrection
路径
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config
注意
该项指定服务可进行的最大负时间校准量(以秒为单位)。如果服务确定某个更改幅度大于所需的幅度,它将转而记录一个事件。特殊情况:-1 表示总是校准时间。域成员的默认值是 0xFFFFFFFF。独立客户端和服务器的默认值是 54,000(15 小时)。
注册表项
MaxPollInterval
路径
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config
注意
该项指定系统轮询间隔所允许的最大间隔(单位是对数表示的秒)。请注意,尽管系统必须根据预定的间隔进行轮询,但是提供程序可以根据请求拒绝生成示例。域成员的默认值是 10。独立客户端和服务器的默认值是 15。
注册表项
SpecialPollInterval
路径
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient
注意
该项指定手动对等端的特殊轮询间隔(以秒为单位)。当启用 SpecialInterval 0x1 标志时,W32Time 将使用此轮询间隔而非操作系统确定的轮询间隔。域成员的默认值是 3,600。独立客户端和服务器的默认值是 604,800。
注册表项
MaxAllowedPhaseOffset
路径
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config
注意
该项指定 W32Time 尝试使用时钟速率调整计算机时钟的最大偏移(以秒为单位)。当偏移大于该速率时,W32Time 将直接设置计算机时钟。域成员的默认值是 300。独立客户端和服务器的默认值是 1。
2.2.1 Parameters\NtpServer
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\NtpServer
Data type
Range
Default value
REG_SZ
DNS name or IP address[,0x1 | 0x2 | 0x3]
time.windows.com,0x1
Description
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:
Value
Meaning
0x1
Instead 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.
0x2
Use 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.
0x4
Set the local computer to operate in symmetric active mode in the association with this source.
0x8
Set the local computer to operate in client mode in the association with this source.
例如net time /setsntp:"time.nist.gov,0x1 time-a.nist.gov,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 Parameters\Type
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
Data type
Range
Default value
REG_SZ
NoSync | NTP | Nt5DS | AllSync
Nt5DS for computers joined to a domain; NTP for others
Description
Specifies the type of time sources, if any, to which the computer synchronizes its time.
Value
Meaning
NoSync
Does not synchronize time.
NTP
Synchronizes time to the time sources specified in theParameters\NtpServer entry.
Nt5DS
Synchronizes time to the domain hierarchy.
AllSync
Uses 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 /update2.3 设置示例
2.3.1 使用“时间和日期 属性”设置对话框
双击任务栏右下角“时间”,打开“时间和日期 属性”设置对话框;
选择“Internet时间”标签;
选中“自动与Internet时间服务器同步”选项,在“服务器”中填入网络时间服务器的IP地址,如“192.168.1.232”(只能输入1个服务器地址)。按“立即更新”可直接同步。2.3.2 命令方式
在“运行(R)”中用“cmd”命令进入在DOS命令行窗体;执行以下命令(注意空格):
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)中将配置更改为“未配置”。
Windows Server 2003下有关时间的命令有两个,net time和W32tm,下面对这两个命令的语法和参数加以说明。
net 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项说明。
W32tm是用来同步本地计算机与远程计算机或域时间的类似命令。在域控制器上使用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 /?,将列出语法和所有参数的说明。
以下注册表项位于 HKLM\SYSTEM\CurrentControlSet\Services\W32Time
注册表项
MaxPosPhaseCorrection
路径
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config
注意
该 项指定服务可进行的最大正时间校准量(以秒为单位)。如果服务确定某个更改幅度大于所需的幅度,它将记录一个事件。特殊情况:0xFFFFFFFF 表示总是校准时间。域成员的默认值是 0xFFFFFFFF。独立客户端和服务器的默认值是 54,000(15 小时)。
注册表项
MaxNegPhaseCorrection
路径
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config
注意
该项指定服务可进行的最大负时间校准量(以秒为单位)。如果服务确定某个更改幅度大于所需的幅度,它将转而记录一个事件。特殊情况:-1 表示总是校准时间。域成员的默认值是 0xFFFFFFFF。独立客户端和服务器的默认值是 54,000(15 小时)。
注册表项
MaxPollInterval
路径
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config
注意
该项指定系统轮询间隔所允许的最大间隔(单位是对数表示的秒)。请注意,尽管系统必须根据预定的间隔进行轮询,但是提供程序可以根据请求拒绝生成示例。域成员的默认值是 10。独立客户端和服务器的默认值是 15。
注册表项
SpecialPollInterval
路径
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient
注意
该项指定手动对等端的特殊轮询间隔(以秒为单位)。当启用 SpecialInterval 0x1 标志时,W32Time 将使用此轮询间隔而非操作系统确定的轮询间隔。域成员的默认值是 3,600。独立客户端和服务器的默认值是 604,800。
注册表项
MaxAllowedPhaseOffset
路径
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config
注意
该项指定 W32Time 尝试使用时钟速率调整计算机时钟的最大偏移(以秒为单位)。当偏移大于该速率时,W32Time 将直接设置计算机时钟。域成员的默认值是 300。独立客户端和服务器的默认值是 1。
3.2.1 Parameters\NtpServer
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\NtpServer
Data type
Range
Default value
REG_SZ
DNS name or IP address[,0x1 | 0x2 | 0x3]
time.windows.com,0x1
Description
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:
Value
Meaning
0x1
Instead 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.
0x2
Use 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.
0x4
Set the local computer to operate in symmetric active mode in the association with this source.
0x8
Set the local computer to operate in client mode in the association with this source.
例如net time /setsntp:"time.nist.gov,0x1 time-a.nist.gov,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 Parameters\Type
HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
Data type
Range
Default value
REG_SZ
NoSync | NTP | Nt5DS | AllSync
Nt5DS for computers joined to a domain; NTP for others
Description
Specifies the type of time sources, if any, to which the computer synchronizes its time.
Value
Meaning
NoSync
Does not synchronize time.
NTP
Synchronizes time to the time sources specified in theParameters\NtpServer entry.
Nt5DS
Synchronizes time to the domain hierarchy.
AllSync
Uses 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 /update3.3 设置示例
属性”设置对话框
双击任务栏右下角“时间”,打开“时间和日期 属性”设置对话框;
选择“Internet时间”标签;
选中“自动与Internet时间服务器同步”选项,在“服务器”中填入网络时间服务器的IP地址,如“192.168.1.232”(只能输入1个服务器地址)。按“立即更新”可直接同步。3.3.2 命令方式
在“运行(R)”中用“cmd”命令进入在DOS命令行窗体;执行以下命令(注意空格):
net time /setsntp: ”192.168.1.232 time.windows.com,0x1”
net stop w32time
net start w32time
w32tm /resync /nowait /rediscover
(设置时间服务器地址,可多个)
(停止时间服务)
(启动时间服务)
(立即同步时间)
3.4 可能出现的问题
计算机没有同步。因为没有可用的时间数据。(The computer did not resync because no time data was available)
出现该问题的原因可能是windows time service没有正确的启动,或者与组策略中的时间配置冲突。请在组策略(gpedit.msc)中将配置更改为“未配置”。4 参考
有关 Windows 时间服务的更多信息,请单击下面的文章编号,以查看 Microsoft 知识库中相应的文章:
216734 如何在 Windows 2000 中配置权威时间服务器
321708 如何在 Windows 2000 中使用网络诊断工具 (Netdiag.exe)
314054 如何在 Windows XP 中配置权威时间服务器
816042 如何在 Windows Server 2003 中配置权威时间服务器
816043 如何打开 Windows 时间服务中的调试日志
884776 配置 Windows 时间服务以防出现大的时间偏移