Build a Clock Synchronization Server with Windows Server 2008

Reprinted from CSDN  

https://blog.csdn.net/leizi191110211/article/details/51833638

Overview:

This article mainly explains how to build your own clock synchronization server through Windows Server 2008 to ensure the clock synchronization of each server in the system.

background:

During the prize auction of the " Blog Unparalleled " event last Friday , the results of the auction were controversial because the clocks of the Web server and the database server were out of sync. A friend who bid in the last 5 seconds, the bid time recorded in the database is beyond the auction closing time. Problems caused by this program are entirely our responsibility and we will compensate the last bidder for a WP7 phone. The lesson for us is that there cannot be the slightest oversight in technology. Now that we have solved the server clock synchronization problem, we will share the solution with you here.

Introduction to the clock synchronization function:

In Windows systems, clock synchronization is done through the Windows Time service (W32Time). W32Time accesses port 123 of the target clock synchronization server through the NTP (Network Time Protocol) protocol for time synchronization. The server's address can be set in the "Internet Time" option of the "Time and Date" settings window. Windows provides several clock synchronization server addresses on the Internet by default, such as: time.windows.com. The clock synchronization on your computer is performed by W32Time by accessing the preset server address here. The default time interval is 7 days.

You may ask, since Windows provides clock synchronization by default, how can the time of the blog park server be out of sync? This is because our database server has no direct connection to the internet and cannot access the preset clock synchronization server. Therefore, our solution is to match our own clock synchronization server, and other servers synchronize their clocks with this server.

Configuration steps:

——Server side configuration——

1. Select a server as the time synchronization server.

2. Run Regedit to open the Registry Editor.

3. 找到注册表项HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\,在右侧窗口中将AnnounceFlags的值修改为5。

4. 继续找到注册表项HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer\,在右侧窗口中将Enabled的值修改为1。

5. 在命令行中输入”net stop w32time && net start w32time“重启W32Time服务。

6. 修改Windows防火墙设置,允许123端口的UDP连接。

——客户端配置——

1. 设置目标服务器地址:

打开修改日期与时间的窗口,进入“Internet Time” 选项,输入时钟同步服务器的网址或IP地址,如下图:

w32time

然后点击同步按钮,配置没问题的话,就会显示同步成功,如下图:

w32time2

2. 设置同步时间间隔:

默认的同步时间间隔是7天,实在是太久了,可以修改为你想要的同步时间间隔。

在客户端电脑上打开注册表编辑器,找到注册表项HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient,在右侧窗口中找到SpecialPollInterval,打开修改窗口,选择十进制,输入同步时间间隔即可(单位为秒)。如下图:

未命名-3

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326039172&siteId=291194637