Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Solution to the problem of time synchronization in ntp

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Asia-asia.pool.ntp.org http://www.pool.ntp.org/zone/asia

0.asia.pool.ntp.org

1.asia.pool.ntp.org

2.asia.pool.ntp.org

3.asia.pool.ntp.org

2.1 Registry information modification

PDC configure external time source settings

# config external NTP server

W32tm.exe / config / manualpeerlist: "0.asia.pool.ntp.org update 1.asia.pool.ntp.org2.asia.pool.ntp.org.3.asia.pool.ntp.org.0x1" / syncfromflags:manual / reliable:YES / update

# update

W32tm.exe / config / update

# you can not use it during the configuration process, and then perform the action of shutting down and turning on the server if the configuration does not take effect

# stop w32time

Stop-Service W32Time

# start w32time

Start-Service w32time

# internal NTP for PDC

Set-ItemProperty "HKLM:\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ Parameters"-Name "Type"-Value NTP

Set-ItemProperty "HKLM:\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ Config"-Name "AnnounceFlags"-Value 5

Set-ItemProperty "HKLM:\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ TimeProviders\ NtpServer"-Name "Enabled"-Value 1

Set-ItemProperty "HKLM:\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ TimeProviders\ NtpClient"-Name "SpecialPollInterval"-Value 900

Description:

The above code configuration can directly configure the external time source for PDC, and set parameters such as the finer frequency of the client. The settings can be adjusted according to the actual requirements of the customer.

2.1.1 specify an external time source

W32tm / config / manualpeerlist: "time.stdtime.gov.tw clock.stdtime.gov.tw tick.stdtime.gov.tw watch.stdtime.gov.tw,0x1" / syncfromflags:manual / reliable:yes / update

2.1.2 set up an authorized time server

"HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ Config"

[AnnounceFlags] modify the set value to 5

2.1.3 enable NTP service

The setting value of "HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ Parameters" [Type] is changed to NTP

The value of "HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ TimeProviders\ NtpServer" [Enabled] is modified to 1.

2.1.4 set query interval

"HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ TimeProviders\ NtpClient" [SpecialPollInterval] changes the value to "decimal" 600

2.1.5 time correction settings

"HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ Config"

[MaxPosPhaseCorrection] changed to decimal 6000 (negative error correction)-if the network time is slower than the local time, it will not be corrected automatically.

[MaxNegPhaseCorrection] changed to decimal 6000 (error correction)-if the network time is faster than the local time, it will not be corrected automatically

2.1.6 Open time service port

Netsh firewall add portopening protocol=UDP port=123 name=NTPSERVER

2.1.7 restart the Time32 time service and synchronize external time sources

Net stop w32time & net start w32time / / restart the w32time time server

W32tm / config / update / / Update time service configuration information

W32tm / resync / / synchronize time sources

W32tm / query / peers / / query time synchronization server and related intelligence

W32tm / query / source / / View synchronization time source

2.2 modify AD related settings

2.2.1 set up AD time source server

2.2.2 modify PDC server to use internal time source

2.2.3 Group Policy Settings

3 synchronization time test

Clients without adding domains need to run synchronization time scripts for the first time to specify internal NTP servers for time synchronization

The script reads as follows:

@ echo off

Color 2f

Title adjusts Time

Echo.

Echo.

Echo.

Echo. Open firewall port 123

Netsh firewall add portopening protocol = UDP port = 123name = NTPSERVER

Echo.

Echo.

Echo.

Echo. Write registry information

W32tm / config / update / manualpeerlist: "172.16.108.7 ntp.fudan.edu.cn s1b.time.edu.cn s1c.time.edu.cnjue 0x1"

Echo.

Echo.

Echo.

Echo. Restart the w32time service

Net stop w32time & net start w32time

Echo.

Echo.

Echo.

Echo. Update time configuration

W32tm / config / update

W32tm / config / update

W32tm / config / update

W32tm / resync

W32tm / resync

W32tm / resync

W32tm / resync

W32tm / resync

W32tm / resync

Pause

After repeated tests, the client can successfully synchronize the time server time

Check the registry branch: [HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ TimeProviders\ NtpClient], find Enabled, change 0 to 1, and then restart the time synchronization service.

This can be solved when synchronization time encounters "element not found".

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report