Windows server啟用Windows Time Service就可以當NTP server了。
如果service啟動後還是無法對時,請參考這幾篇文章
http://technet.microsoft.com/en-us/library/bb490605.aspx
http://support.microsoft.com/kb/816042/zh-tw
http://www.atomic-clock.galleon.eu.com/support/windows-2003-ntp-time-server.html
範例:Windows 2003 server啟用Windows Time Service當作NTP
1. 用regedit修改registry
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\
Type Set value to NTP.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\
AnnounceFlags Set the value to 5 (for reliable time source).
2. restart service "Windows time service"
網域主控站(DC)如何正確設定 Windows 時間服務 (w32tm)
w32tm /config /manualpeerlist:"time.stdtime.gov.tw clock.stdtime.gov.tw tick.stdtime.gov.tw watch.stdtime.gov.tw" /syncfromflags:manual /reliable:yes /update
----------------------------------------------------------------------------------------------------------
Linux client向NTP server對時。
參考 http://linux.vbird.org/linux_server/0440ntp.php#client_windows
1. ntpdate [-d] NTP-server-IP-or-DNS-name
-d 是 debug 使用,會列出詳細的訊息
Ex: ntpdate pdc.company.com
2. hwclock -w
將時間寫入BIOS
3. 編輯crontab
crontab -e,加入 10 5 * * * ntpdate pdc.company.com; hwclock -w
----------------------------------------------------------------------------------------------------------
如果NTP需要穿過防火牆對時,請開啟UDP 123 port。
2022/7/29 update:
DC 對時錯誤狀況:
C:\Windows\system32>w32tm /monitor
DC02.domain.com[192.168.x.x:123]:
ICMP: 0ms delay
NTP: -8.6596986s offset from DC03.domain.com
RefID: (unspecified / unsynchronized) [0x00000000]
Stratum: 0
DC03.domain.com *** PDC ***[[::1]:123]:
ICMP: 0ms delay
NTP: +0.0000000s offset from DC03.domain.com
RefID: 'LOCL' [0x4C434F4C]
Stratum: 1
DC01.domain.com[192.168.x.x:123]:
ICMP: 0ms delay
NTP: -0.1569371s offset from DC03.domain.com
RefID: (unspecified / unsynchronized) [0x00000000]
Stratum: 0
DC02.domain.com[192.168.x.x:123]:
ICMP: 0ms delay
NTP: -8.6596986s offset from DC03.domain.com
RefID: (unspecified / unsynchronized) [0x00000000]
Stratum: 0
DC03.domain.com *** PDC ***[[::1]:123]:
ICMP: 0ms delay
NTP: +0.0000000s offset from DC03.domain.com
RefID: 'LOCL' [0x4C434F4C]
Stratum: 1
DC01.domain.com[192.168.x.x:123]:
ICMP: 0ms delay
NTP: -0.1569371s offset from DC03.domain.com
RefID: (unspecified / unsynchronized) [0x00000000]
Stratum: 0
C:\Windows\system32>W32tm /query /source
Local CMOS Clock
Local CMOS Clock
C:\Windows\system32>w32tm /query /peers
#??: 1
Peer: clock.stdtime.gov.tw
State: Pending
Time Remaining: 888.3607281s
Mode: 0 (reserved)
Stratum: 0 (unspecified)
PeerPoll Interval: 0 (unspecified)
HostPoll Interval: 0 (unspecified)
#??: 1
Peer: clock.stdtime.gov.tw
State: Pending
Time Remaining: 888.3607281s
Mode: 0 (reserved)
Stratum: 0 (unspecified)
PeerPoll Interval: 0 (unspecified)
HostPoll Interval: 0 (unspecified)
處理方法: (先確認 registry 已經設定 NTP)
net stop w32time
w32tm /unregister
w32tm /register
net start w32time
w32tm /resync
w32tm /query /peers
w32tm /unregister
w32tm /register
net start w32time
w32tm /resync
w32tm /query /peers
處理後:
C:\Windows\system32>w32tm /monitor
DC02.domain.com[192.168.x.x:123]:
ICMP: 0ms delay
NTP: -0.0253315s offset from DC03.domain.com
RefID: 211-22-103-158.hinet-ip.hinet.net [211.22.103.158]
Stratum: 3
DC03.domain.com *** PDC ***[[::1]:123]:
ICMP: 0ms delay
NTP: +0.0000000s offset from DC03.domain.com
RefID: 211-22-103-158.hinet-ip.hinet.net [211.22.103.158]
Stratum: 3
DC01.domain.com[192.168.x.x:123]:
ICMP: 0ms delay
NTP: -0.0140247s offset from DC03.domain.com
RefID: 211-22-103-158.hinet-ip.hinet.net [211.22.103.158]
Stratum: 3
DC02.domain.com[192.168.x.x:123]:
ICMP: 0ms delay
NTP: -0.0253315s offset from DC03.domain.com
RefID: 211-22-103-158.hinet-ip.hinet.net [211.22.103.158]
Stratum: 3
DC03.domain.com *** PDC ***[[::1]:123]:
ICMP: 0ms delay
NTP: +0.0000000s offset from DC03.domain.com
RefID: 211-22-103-158.hinet-ip.hinet.net [211.22.103.158]
Stratum: 3
DC01.domain.com[192.168.x.x:123]:
ICMP: 0ms delay
NTP: -0.0140247s offset from DC03.domain.com
RefID: 211-22-103-158.hinet-ip.hinet.net [211.22.103.158]
Stratum: 3
C:\Windows\system32>w32tm /query /source
clock.stdtime.gov.tw
clock.stdtime.gov.tw
C:\Windows\system32>w32tm /query /peers
#??: 1
Peer: clock.stdtime.gov.tw
State: Active
Time Remaining: 53.5851137s
Mode: 1 (Symmetric Active)
Stratum: 2 (secondary reference - syncd by (S)NTP)
PeerPoll Interval: 6 (64s)
HostPoll Interval: 6 (64s)
#??: 1
Peer: clock.stdtime.gov.tw
State: Active
Time Remaining: 53.5851137s
Mode: 1 (Symmetric Active)
Stratum: 2 (secondary reference - syncd by (S)NTP)
PeerPoll Interval: 6 (64s)
HostPoll Interval: 6 (64s)
Reference:
沒有留言:
張貼留言