Настройка синхронизации времени windows server 2019

Windows Server 2019 provides an option to configure an NTP (Network Time Protocol) server on a domain controller. NTP is a protocol used to synchronize the time on network devices and ensure accurate timekeeping. By configuring your domain controller as an NTP server, you can ensure that all devices within your network have synchronized time. This tutorial will guide you through the steps of configuring an NTP server on a Windows 2019 domain controller.

Step 1: Open the Command Prompt as an Administrator.
To begin, open the Command Prompt with administrator rights. You can do this by right-clicking on the Start button and selecting «Command Prompt (Admin)» from the context menu.

Step 2: Check the current time settings.
Before configuring the NTP server, it’s important to check the current time settings on your domain controller. To do this, type the following command in the Command Prompt and press Enter:
«`
w32tm /query /status
«`
This command will display the current time settings, including the time source.


Step 3: Configure the NTP server.
Next, you need to configure your domain controller as an NTP server. In the Command Prompt, enter the following command, replacing `time.windows.com` with the NTP server of your choice:
«`
w32tm /config /syncfromflags:manual /manualpeerlist:
«time.windows.com
«
«`
This command tells the domain controller to synchronize time from the specified NTP server.

Step 4: Restart the time service.
To apply the changes made in the previous step, you need to restart the time service. Enter the following command in the Command Prompt and press Enter:
«`
net stop w32time && net start w32time
«`
This command stops and starts the time service, ensuring that the changes take effect.

Step 5: Verify the NTP server configuration.
Finally, you can verify that the NTP server configuration was successful. Run the following command in the Command Prompt:
«`
w32tm /query /status
«`
Check the output to ensure that the «Source» field displays the NTP server you configured.

Pros Cons
1. Provides accurate time synchronization for all devices within your network. 1. Requires administrative privileges to configure the NTP server.
2. Improves network security by ensuring consistent time timestamps. 2. Relies on the availability and reliability of the chosen NTP server.
3. Helps prevent issues with authentication, auditing, and file replication across network devices. 3. Incorrectly configuring the NTP server may cause time synchronization problems.

By following these steps, you can easily configure an NTP server on a Windows 2019 domain controller. Having synchronized time across your network devices is crucial for various operations, including authentication, auditing, and file replication. Take advantage of this feature to ensure accurate timekeeping in your IT infrastructure.

Video Tutorial:Does Active Directory use NTP?

How to set NTP time on domain controller?

Setting NTP (Network Time Protocol) time on a domain controller is an essential task to ensure accurate time synchronization across the network. Follow these steps to set NTP time on a domain controller:

1. Log in to the domain controller with administrative privileges.

2. Open the Command Prompt with administrative rights. Right-click on the Command Prompt icon and choose «Run as administrator.«

3. Type the following command to set the NTP server:

`w32tm /config /syncfromflags:manual /manualpeerlist:«pool.ntp.org«`

This command specifies that the time synchronization will be manually configured using the NTP server pool.ntp.org. You can replace pool.ntp.org with any other reliable NTP server address.

4. Press Enter to execute the command.

5. Next, type the following command to update the configuration:

`w32tm /config /reliable:yes`

This command ensures that the time service will start automatically and remain reliable.

6. Press Enter to execute the command.

7. Now, restart the Windows Time service to apply the changes. Use the following command:

`net stop w32time && net start w32time`

This command stops and starts the Windows Time service.

8. Finally, check if the time synchronization is working correctly. Open the Command Prompt and enter:

`w32tm /query /status`

This command displays the detailed status of the Windows Time service.

Look for the «Source:» field, which should show the NTP server address you configured previously.

That’s it! You have successfully set NTP time on the domain controller. Ensure that the NTP server you choose is reliable and widely used for accurate time synchronization.

How do I know if my domain controller is NTP?

To determine if your domain controller is configured as a Network Time Protocol (NTP) server, you can follow these steps:

1. Open the command prompt on your domain controller. You can do this by pressing Windows Key + R, typing «cmd,» and pressing Enter.

2. In the command prompt, type the following command and press Enter:
«`
w32tm /query /configuration
«`

This command will display the configuration settings of the Windows Time service.

3. Look for the line that starts with «NtpServer.» If it includes the domain controller’s IP address or a valid NTP time server address, it means your domain controller is configured to synchronize time using NTP.

4. Check the «Type» field in the output. If it shows «NT5DS» or «NTP«, it indicates that the domain controller is using NTP as the time source.

5. Additionally, you can use the following command to check the NTP peers that your domain controller is synchronized with:
«`
w32tm /query /peers
«`

This command will display a list of NTP peers along with their status. If you see valid NTP server addresses in the output, it confirms that your domain controller is configured to synchronize time using NTP.

Remember, NTP synchronization is crucial for maintaining accurate time across your network and domain controllers. Ensuring proper time synchronization helps with security, authentication, and overall system integrity.

Configuring Network Time Protocol (NTP) in Windows Server 2019 is important for ensuring accurate time synchronization across domain-joined computers. Here are the steps to configure NTP in Windows Server 2019:

1. Open the command prompt with administrative privileges by right-clicking on the Start button and selecting «Command Prompt (Admin)«.

2. Start by checking the current time synchronization settings by running the command: `w32tm /query /status`

3. Identify the existing time source(s) listed under «Source» and note them down. If there are no time sources listed, it means the server is not configured for time synchronization.

4. Configure the NTP server by specifying the reliable time source(s) you want to use. For example, if you want to use «pool.ntp.org» as the time source, run the command: `w32tm /config /syncfromflags:manual /manualpeerlist:«pool.ntp.org» /reliable:yes`

5. Restart the Windows Time Service by running the command: `net stop w32time && net start w32time`

6. Finally, synchronize the time immediately by running the command: `w32tm /resync`

7. To verify the new configuration, run the command: `w32tm /query /status` again and check if the «Source» reflects the newly configured time source(s).

By following these steps, you can successfully configure NTP in Windows Server 2019 and ensure accurate time synchronization within your network.

How do I know if my domain controller is NTP server?

Determining if a domain controller is functioning as an NTP server involves checking various settings and configurations. Here’s a step-by-step guide to help you identify if your domain controller is serving as an NTP server:

1. Log in to your domain controller using administrative credentials.

2. Open the Command Prompt or PowerShell as an administrator.

3. Use the following command to check the NTP settings on your domain controller:
«`
w32tm /query /configuration
«`
This command will display the current configuration of the Windows Time service, including the NTP server settings.

4. Look for the «NtpServer» parameter in the command output. If the NtpServer parameter is present and configured, it means your domain controller is acting as an NTP server. The NtpServer value will indicate the NTP server address.

5. Optionally, you can use the following command to verify the time synchronization status between your domain controller and the configured NTP server:
«`
w32tm /stripchart /computer: /samples:
«`
Replace « with the NTP server address obtained in the previous step, and « with the desired number of time samples to be obtained.

By following these steps, you can determine if your domain controller is functioning as an NTP server and verify the time synchronization status.

Can you use domain controller as NTP server?

Yes, you can use a domain controller as an NTP (Network Time Protocol) server. The NTP is used to synchronize clocks on a network to a reference time source, ensuring that devices maintain accurate time and coordinate activities effectively.

Here are the steps to set up a domain controller as an NTP server:

1. Verify the domain controller’s time synchronization source: Before configuring the domain controller as an NTP server, it’s important to ensure that it is already synchronizing time with a reliable external time source. This could be an external NTP server or an authoritative time server on the internet.

2. Configure the domain controller as an NTP server: Once the domain controller has a reliable time source, you can configure it to serve as an NTP server for other devices on the network. This can be done through the Group Policy Management Editor by creating a new Group Policy Object (GPO) or by modifying an existing one.

a. Open the Group Policy Management Editor.
b. Navigate to the desired GPO or create a new one.
c. Go to Computer Configuration > Policies > Administrative Templates > System > Windows Time Service > Time Providers.
d. Enable the «Enable Windows NTP Server» policy and specify the desired NTP server as either a DNS name or an IP address.
e. Apply the GPO to the targeted domain controllers or organizational units.

3. Configure NTP client devices to use the domain controller: Once the domain controller is set up as an NTP server, you need to configure the client devices on the network to use it for time synchronization. This can be done through Group Policy or manually on individual devices.

a. Use Group Policy: Follow a similar process as in Step 2 to configure the «NTP Client» policy under the same GPO, specifying the domain controller’s DNS name or IP address as the NTP server. Apply the GPO to the desired client devices or organizational units.

b. Manual configuration: On individual devices, modify the NTP client settings through the operating system’s control panel or settings menu. Set the domain controller’s DNS name or IP address as the preferred NTP server.

By following these steps, you can effectively use a domain controller as an NTP server, ensuring accurate time synchronization across your network.



Maintaining accurate time on your server is critical largely because many services and IT applications rely on accurate time settings to function as expected. These include logging services, monitoring and auditing applications, and database replication to mention a few.

Time skew in servers, and any client systems for that matter, is undesirable and usually causes conflict in time-critical applications.  To maintain accurate time settings on your server and across the network by extension, it’s preferred to install and enable a NTP server on your server.

How to Install NTP Server on Windows Server 2019 image 1

What is an NTP server?

NTP, short for Network Time Protocol, is a protocol that synchronizes time across network devices. It listens on UDP port 123 and always ensures that time inconsistencies across the server and client systems are mitigated and that client systems are always in sync with the server.

NTP server refers to a network device or a service that fetches time from an external time source and syncs the time across the network using the NTP protocol. This guide will focus on installing NTP service on Windows server 2019.

How Does NTP Work ?

Being a protocol, NTP requires a client-server architecture. The NTP client residing on a Windows PC, for example, initiates a time request exchange with the NTP server.

A time-stamp data exchange happens between the server and client and this helps in adjusting the clock on client’s systems to the highest degree of accuracy to match the time on the NTP server. In this guide, we will walk you through the installation and configuration of NTP server on Windows Server 2019.

How to Install NTP Server on Windows Server 2019 image 2

There are several ways of setting up NTP server and we will look at each in turn.

In Windows Server environments, there is a special Windows time service that handles time synchronization between the server and the client systems. This is known as Windows Time service. PowerShell provides a command-line tool known as w32tm.exe and comes included in all versions of Windows from Windows XP and Windows Server 2008 to the latest versions of each OS.

Using the w32tm.exe utility, you can configure your Windows system to sync with online time servers. Usually, this is the tool of choice when setting up and monitoring time on your Windows Server system.

Using the command-line utility is quite straightforward.

For example, to set the Server to point to 2 different time servers, namely 0.us.pool.ntp.org  and  1.us.pool.ntp.org , launch  PowerShell as the Administrator and  run the command below

w32tm /config /syncfromflags:manual /manualpeerlist:”0.us.pool.ntp.org 1.us.pool.ntp.org” /update

Then restart Windows Time service using the commands:

Stop-Service w32time
Start-Service w32time

Here’s a snippet of the commands.

How to Install NTP Server on Windows Server 2019 image 3

You can thereafter confirm the values of NTP servers configured in the registry by running this command:

w32tm /dumpreg /subkey:parameters

How to Install NTP Server on Windows Server 2019 image 4

Configure NTP Server on Windows Server 2019 using Registry editor

The second method of installing and configuring the NTP server is using the registry editor. If you are not a fan of the Windows PowerShell, then this will truly come in handy.

To get started, open the registry editor. Press ‘Windows key + R’ and type ‘regedit’ and hit ENTER. The windows registry will be launched as shown below.

How to Install NTP Server on Windows Server 2019 image 5

Next, head over to the path shown below

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer

On the right pane. Be sure to find & double-click the file labelled ‘Enabled’ in the diagram shown below.

How to Install NTP Server on Windows Server 2019 image 6

Next, In the ‘value data’ text field, set the value to ‘1’ and click the ‘Ok’ button.

How to Install NTP Server on Windows Server 2019 image 7

Next, head over to the path:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config

In the right pane, double click the ‘Announce Flags’ file.

How to Install NTP Server on Windows Server 2019 image 8

Double-click the file and in the Value data text field, type the value ‘5’ and click ‘OK’.

How to Install NTP Server on Windows Server 2019 image 9

For the changes to come into effect, you need to reboot the NTP server by heading to the services Window. To achieve this, press ‘Windows key + R’ and type ‘services.msc’. Scroll and find ‘Windows Time’, right-click on it and select the ‘Restart’ option.

How to Install NTP Server on Windows Server 2019 image 10

Useful w32tm commands

Once you have set up your NTP server, you can use the following commands to verify various aspects of the server:

To check the status of the NTP server, run the command:

w32tm /query /status

How to Install NTP Server on Windows Server 2019 image 11

To reveal the current NTP pool being used to sync time with execute:

w32tm /query /source

How to Install NTP Server on Windows Server 2019 image 12

You can also display a list of NTP time servers along with their configuration status as shown.

w32tm /query /peers

How to Install NTP Server on Windows Server 2019 image 13

To display NTP server configuration settings, run the command:

w32tm /query /source

This shows quite a wealth of information.

How to Install NTP Server on Windows Server 2019 image 14

Final Take

We cannot stress enough how important it is to maintain accurate time and date settings on your server. As you have seen, setting up an NTP server on your Windows server instance is quite easy and straight forward.

Once you have configured the NTP service on your server, other domain controllers in your environment will sync with this server and the Windows clients in the domain will sync with the domain controllers. Hopefully, you can now install and configure NTP on Windows Server 2019.

Home » OS’s » Windows » Set NTP Server Windows 2016 or Windows 2019

Viewing-the-NTP-registry-values-that-are-configured-for-your-Windows-Server

Viewing-the-NTP-registry-values-that-are-configured-for-your-Windows-Server

There is no question about it, having accurate time in your environment set in critical infrastructure systems is a must. Many business-critical applications and infrastructure systems rely on accurate time synchronized between them to ensure the system functions as expected. Time skew can cause all kinds of weirdness when it is misconfigured or out of sync between different servers/systems. This is especially true in a Windows Server Active Directory domain. Having accurate time between a client computer and domain controllers is essential. Let’s take a look at how to set ntp server Windows 2016 or Windows 2019 to see how this can be easily carried out.

What is NTP?

Wen it comes to synchronizing time in most enviornments, Network Time Protocol (NTP) is the protocol that is used to ensure accurate time across your environent. In most environments, NTP servers, special time servers, are configured that provide an external time source for which your internal servers can synchronize with.

There are several widely known NTP IP addresses on the Internet that provide reliable time sources for your network. The NTP.org servers are one such set of time servers that provide an NTP source for configuration.
There are a few NTP values to be aware of:

  • NTP Server – This is a specialized server that is able to detremine the precise time from an external timing reference such as GPS and passes these precise time values on to your network
  • Offset – This is the difference in time between the external time server and the time on a local client computer. The larger the offset, the more inaccurate the timing source is.
  • Delay – This is the value of the round-trip time (latency) of the timing message between the client to the server and back again.

How Time is synchronized in a Windows Server domain

In a Windows domain, Microsoft has default configuration in place that takes care of a good portion of the NTP configuration. Starting with Windows 2000 Server, Windows clients are configured as NTP Clients. When configured as an NTP client, Windows computers only attempt to contact the domain controller for NTP synchronization or a manually specified NTP server.

Microsoft has made the domain controller the default in a Windows domain since it makes sense that clients already have a secure channel established with DCs for other types of communications. Additionally, accurate and synchronized time between domain controllers and clients is especially important for all kinds of things such as logins, group policy synchronization and other tasks/operations.

The order of operations or hierarchy in a Windows domain is as follows:

  • Domain members attempt to synchronize time with any domain controller located in the domain
  • Domain controllers synchronize with a more authoritative domain controller
  • The first domain controller that is installed in the environment is automatically configured to be a reliable time source.
  • Other than the first domain controller installed, the PDC emulator (if role has been moved from the first DC installed) generally holds the position of best time source.

An important point to consider and that comes into play when thinking about why we set ntp server in Windows 2016 or Windows 2019 is the authoritative domain controller must have a reliable source to synchronize with as well. This is generally an external time server outside of the domain hierarchy.

Now that we know how the domain hierarchy for time is configured, how is the external time source configured on your domain controller that is configured as the reliable source of time?

Configuring Windows Time Service with W32tm.exe

When it comes to Windows Server environments like Windows Server 2016 or Windows Server 2019, there is a special Windows service that controls the time synchronization of your Windows hosts. This is the Windows Time Service.

Microsoft provides a command line tool to interact with the Windows Time Service called W32tm.exe. This has been included in Windows operating systems since Windows XP/Windows 2003 and later. It can be used to configure Windows Time service parameters as well as diagnose time service problems. This is generally the tool of choice when it comes to configuring, monitoring, and administering Windows Time.

Using the W32tm.exe utility is fairly straightforward. It can be used from a normal command prompt as well as from a PowerShell prompt. There are several command parameters included that allow not only configuring the NTP servers you want to query, but also parameters that allow viewing the low level registry configuration as well as the synchronization status.

You can read the official Microsoft KB on the Windows Time service and the W32tm.exe utility here:

  • https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-time-service-tools-and-settings

However, there are a few commands I would like to show you for the purposes of configuring your Domain controller that is to be the reliable time source (PDC Emulator) for your domain.

The first command is the command line entry to specify your NTP servers, which in this case I am using the NTP.org servers to set as the source of my NTP synchronization.

w32tm /config /syncfromflags:manual /manualpeerlist:"0.us.pool.ntp.org 1.us.pool.ntp.org 2.us.pool.ntp.org 3.us.pool.ntp.org" /update

Stop-Service w32time
Start-Service w32time
Configuring-the-time-source-for-your-domain-with-the-w32tm-utility

Configuring the time source for your domain with the w32tm utility

If you want to view the status of the NTP synchronization on your server after you have configured the values and restarted the w32time service, you can use the following command:

w32tm /query /status
Querying-the-NTP-synchronization-status-of-your-Windows-Server-2016-or-2019-domain-controller

Querying the NTP synchronization status of your Windows Server 2016 or 2019 domain controller

You can also check the values configured in your registry key hkey local machine system currentcontrolset services w32time config using the commands below. You can drill into the configuration parameters using the /dumpreg /subkey command.

w32tm /dumpreg

w32tm /dumpreg /subkey:parameters
Viewing-the-NTP-registry-values-that-are-configured-for-your-Windows-Server

Viewing the NTP registry values that are configured for your Windows Server

Final Thoughts

As shown, you can easily set NTP Server Windows 2016 or Windows 2019 using the w32tm command utility that allows interacting with the time service in Windows Server.

In a Windows domain, you want to configure your authoritative time source domain controller, which by default is the PDC Emulator, to pull time information from an authoritative source like NTP.org or some other reliable NTP time server.

After configuring the time source, the other domain controllers will synchronize with this server and then the Windows clients joined to the domain will synchronize with the domain controllers that have the corrected time from the authoritative server.

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don’t have to.

Network Time Protocol (NTP) runs on the Transport Layer port 123 UDP and enables accurate time synchronization for network computers. This irons out time inconsistencies on servers and clients during file logging or replication of server databases among other resources. In this article, we’ll go through the process of installing, configuring, and querying an NTP server on Windows Server 2019 Datacenter.

NTP servers utilize the Network Time Protocol to send time signals to servers across the globe upon request. NTP servers use the Universal Time Coordinated (UTC) time source for time signal synchronization.The main purpose of NTP servers is to provide time synchronization for servers and computer networks with other major network servers and clients across the globe. In turn, this streamlines communications and transactions all over the world.

INSTALLING AND CONFIGURING AN NTP SERVER ON WINDOWS SERVER 2019

The process of installing, configuring, and querying an NTP Server on Windows Server 2019 is quite straightforward.

Set the NTP service to Automatic option

To start off, Hit Windows Key + R to launch the Run dialogue. Next, type services.msc and hit ENTER.

In the ‘Services’ window, locate the service ‘Windows Time’. Right-click and select the ‘Properties’ option as shown:

On the pop-up window, select the Startup type as ‘Automatic’.

Finally, click on ‘OK’ and then ‘Apply’.

CONFIGURING NTP SERVER USING REGISTRY EDITOR

As before, launch the run dialogue by pressing Windows Key + R. Then type ‘regedit’ and hit ENTER.

The Registry editor will be launched as shown:

Navigate to the path shown below:Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServerOn the right pane, locate and double-click the ‘Enabled’ file as shown:

Set the Value data to 1 and click OK.

Next, follow this path.

Computer>HKEY_LOCAL_MACHINE>SYSTEM>CurrentControlSet>Services>W32Time>Config

At the right pane locate the ‘Announce Flags’ file.

Double click on the file and set its value to 5 in the ‘Value Data’ section.

Finally, reboot the NTP server for the changes to take place. Head back to the services Window, right-click on ‘Windows Time’ and select ‘Restart

HOW TO CONFIGURE NTP SERVER ON WINDOWS 2019 USING WINDOWS POWERSHELL?

If you love working in Powershell, launch Powershell as Administrator and enable NTP server using the command:

Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\Services\w32time\TimeProviders\NtpServer” -Name “Enabled” -Value 1

Next, configure Announce Flags value as shown:

Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\services\W32Time\Config” -Name “AnnounceFlags” -Value 5

Finally, restart the NTP server using the command:

Restart-Service w32Time

Important Note: UDP port 123 must be open for the NTP server traffic to reach your Windows Server 2019. If the NTP servers are unreachable, you can check your firewall settings to fix this.

SOME USEFUL COMMANDS

  1. w32tm /query /configuration to check and shows the NTP server configuration.
  2. w32tm /query /peers for checking the list of NTP servers configured alongside their configuration status
  3. w32tm /resync /nowait to force-synchronize time with your NTP server.
  4. w32tm /query /source to show the source of the time.
  5. w32tm /query /status to reveal NTP time service status.

FINAL WORDS

Now your Windows Server 2019 clock is synchronized with time the NTP server’s pool.ntp.org and works as NTP client. You can achieve full network and accompanying infrastructure time synchronization by synchronizing all network workstations, servers, routers, hubs, and switches.

Since NTP servers operate over the UDP protocol using TCP/IP, these network infrastructures must be working efficiently for effective NTP server operation. In case you want to make time servers on windows server 2019 hosted on a virtual machine, you should disable the virtual machine time synchronization settings and sync their time with the domain Windows Server 2019.

Содержание

  1. Настройка ntp сервера windows server 2019
  2. Синхронизация времени в Active Directory
  3. Конфигурация NTP-сервера на корневом PDC
  4. Включение синхронизации внутренних часов с внешним источником
  5. Задание списка внешних источников для синхронизации
  6. Задание интервала синхронизации с внешним источником
  7. Установка минимальной положительной и отрицательной коррекции
  8. Все необходимое одной строкой
  9. Полезные команды
  10. Настройка NTP сервера и клиента групповой политикой
  11. Особенности виртуализированных контроллеров домена
  12. Настройка синхронизации времени по NTP с помощью групповых политик
  13. Настройка политики синхронизации NTP на контролере домена PDC
  14. Настройка синхронизации времени на клиентах домена
  15. Set NTP Server Windows 2016 or Windows 2019
  16. What is NTP?
  17. How Time is synchronized in a Windows Server domain
  18. Configuring Windows Time Service with W32tm.exe
  19. Final Thoughts
  20. Настройка NTP сервера в Windows
  21. Запуск NTP сервера
  22. Основные настройки NTP сервера

Настройка ntp сервера windows server 2019

Добрый день уважаемые читатели и гости блога pyatilistnik.org, как много люди говорят о времени, что оно быстро или медленно бежит, и все понимают, что оно бесценно и важно. Так и в инфраструктуре Active Directory, она является одним из важнейших факторов, правильного функционирования домена. В домене все друг другу доверяют, и один раз авторизовавшись и получив все тикеты от Kerberos, пользователь ходит куда угодно, ограничиваясь лишь своими доступными правами. Так вот если у вас не будет точного времени на ваших рабочих станциях к контроллеру домена, то можете считать, что у вас начинаются серьезные проблемы, о которых мы поговорим ниже и рассмотрим как их устранить с помощью настройки NTP сервера в Windows.

Синхронизация времени в Active Directory

Среди компьютеров, участвующих в Active Directory работает следующая схема синхронизация времени.

Корневой PDC может синхронизировать свое время как со внешним источником, так и с самим собой, последнее задано конфигурацией по умолчанию и является абсурдом, о чем периодически намекают ошибки в системном журнале.

Синхронизация клиентов корневого PDC может осуществятся как с его внутренних часов, так и с внешнего источника. В первом случае сервер времени корневого PDC объявляет себя как «надежный» (reliable).

Далее я приведу оптимальную с моей точки зрения конфигурацию сервера времени корневого PDC, при которой сам корневой PDC периодически синхронизирует свое время от достоверного источника в интернете, а время обращающихся к нему клиентов синхронизирует со своими внутренними часами.

Вводим netdom query fsmo. В моем примере, роль PDC и NTP сервера, принадлежит контроллеру dc7

Конфигурация NTP-сервера на корневом PDC

Конфигурирование сервера времени в Windows (NTP-сервера) может осуществляться как с помощью утилиты командной строки w32tm, так и через реестр. Где возможно, я приведу оба варианта. Но в начале посмотрите полностью ваши настройки на компьютере, делается это командой:

EventLogFlags: 2 (Локально)
AnnounceFlags: 10 (Локально)
TimeJumpAuditOffset: 28800 (Локально)
MinPollInterval: 6 (Локально)
MaxPollInterval: 10 (Локально)
MaxNegPhaseCorrection: 172800 (Локально)
MaxPosPhaseCorrection: 172800 (Локально)
MaxAllowedPhaseOffset: 300 (Локально)

FrequencyCorrectRate: 4 (Локально)
PollAdjustFactor: 5 (Локально)
LargePhaseOffset: 50000000 (Локально)
SpikeWatchPeriod: 900 (Локально)
LocalClockDispersion: 10 (Локально)
HoldPeriod: 5 (Локально)
PhaseCorrectRate: 7 (Локально)
UpdateInterval: 100 (Локально)

NtpClient (Локально)
DllName: C:\Windows\system32\w32time.dll (Локально)
Enabled: 1 (Локально)
InputProvider: 1 (Локально)
CrossSiteSyncFlags: 2 (Локально)
AllowNonstandardModeCombinations: 1 (Локально)
ResolvePeerBackoffMinutes: 15 (Локально)
ResolvePeerBackoffMaxTimes: 7 (Локально)
CompatibilityFlags: 2147483648 (Локально)
EventLogFlags: 1 (Локально)
LargeSampleSkew: 3 (Локально)
SpecialPollInterval: 3600 (Локально)
Type: NT5DS (Локально)

NtpServer (Локально)
DllName: C:\Windows\system32\w32time.dll (Локально)
Enabled: 1 (Локально)
InputProvider: 0 (Локально)
AllowNonstandardModeCombinations: 1 (Локально)

VMICTimeProvider (Локально)
DllName: C:\Windows\System32\vmictimeprovider.dll (Локально)
Enabled: 1 (Локально)
InputProvider: 1 (Локально)

Включение синхронизации внутренних часов с внешним источником

Объявление NTP-сервера в качестве надежного

NTP-сервер по умолчанию включен на всех контроллерах домена, однако его можно включить и на рядовых серверах.

Задание списка внешних источников для синхронизации

Флаг 0×8 на конце означает, что синхронизация должна происходить в режиме клиента NTP, через предложенные этим сервером интервалы времени. Для того, чтобы задать свой интервал синхронизации, необходимо использовать флаг 0×1.

Задание интервала синхронизации с внешним источником

Время в секундах между опросами источника синхронизации, по умолчанию 900с = 15мин. Работает только для источников, помеченных флагом 0×1.

Установка минимальной положительной и отрицательной коррекции

Максимальная положительная и отрицательная коррекция времени (разница между внутренними часами и источником синхронизации) в секундах, при превышении которой синхронизация не происходит. Рекомендую значение 0xFFFFFFFF, при котором коррекция сможет производиться всегда.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config]
«MaxPosPhaseCorrection»=dword:FFFFFFFF
«MaxNegPhaseCorrection»=dword:FFFFFFFF

Все необходимое одной строкой

w32tm.exe /config /manualpeerlist:»time.nist.gov,0x8 ntp1.imvp.ru,0x8 ntp2.imvp.ru,0x8 time.windows.com,0x8 pool.ntp.org,0x8″ /syncfromflags:manual /reliable:yes /update

Полезные команды

Настройка NTP сервера и клиента групповой политикой

Раз уж у нас с вами домен Active Directory, то глупо не использовать групповые политики, для массовой настройки серверов и рабочих станций, я покажу как настроить ваш NTP сервер в windows и клиента. Открываем оснастку «Редактор групповых политик». Перед тем как настроить наш NTP сервер в Windows, нам необходимо создать WMI фильтр, который будет применять политику, только к серверу мастера PDC.

Вводим имя запроса, пространство имен, будет иметь значение «root\CIMv2» и запрос «Select * from Win32_ComputerSystem where DomainRole = 5». Сохраняем его.

Затем вы создаете политику на контейнере Domain Controllers.

В самом низу политики применяете ваш созданный WMI фильтр.

Переходим в ветку: Конфигурация компьютера > Политики > Административные шаблоны > Система > Служба времени Windows > Поставщики времени.

Тут открываем политику «Настроить NTP-клиент Windows». Задаем параметры

Делаем отдельную групповую политику для клиентских рабочих машин, вот с такими параметрами.

Далее идем на клиента и обновляем групповые политики gpupdate /force и вводим команду w32tm /query /status

Особенности виртуализированных контроллеров домена

Контроллеры домена, работающие в виртуализированной среде, требуют к себе особенного отношения.

Источник

Настройка синхронизации времени по NTP с помощью групповых политик

Служба времени Windows, несмотря на кажущуюся простоту, является одной из основ, необходимых для нормального функционирования домена Active Directory. В правильно настроенной среде AD служба времени работает следующим образом: компьютеры пользователей получают точное время от ближайшего контроллера домена, на котором они зарегистрировались. Все контроллеры домена в свою очередь получают точное время от DC с FSMO ролью «Эмулятор PDC», а контролер PDC синхронизирует свое время с неким внешним источником времени. В качестве внешнего источника времени может выступать один или несколько NTP серверов, например time.windows.com или NTP сервер вашего Интернет-провайдера. Также нужно отметить, что по умолчанию клиенты в домене синхронизируют время с помощью службы времени Windows (Windows Time), а не с помощью протокола NTP.

Если вы столкнулись с ситуацией, когда время на клиентах и контроллерах домена различается, возможно, в вашем домене есть проблемы с синхронизацией времени и эта статья будет вам полезна.

Настройка синхронизации времени в домене с помощью групповых политик состоит из двух шагов:

1) Создание GPO для контроллера домена с ролью PDC
2) Создание GPO для клиентов (опционально)

Настройка политики синхронизации NTP на контролере домена PDC

Этот шаг предполагает настройку контроллера домена с ролью эмулятора PDC на синхронизацию времени с внешним NTP сервером. Т.к. теоретически роль эмулятора PDC может перемещаться между контроллерами домена, нам нужно сделать политику, которая применялась бы только к текущему владельцу роли PDC. Для этого в консоли управления Group Policy Management Console (GPMC.msc), создадим новый WMI фильтр групповых политик. Для этого в разделе WMI Filters создадим фильтр и именем PDC Emulator и WMI запросом: Select * from Win32_ComputerSystem where DomainRole = 5

Затем создайте новую GPO и назначьте ее на контейнер Domain Controllers.

Перейдите в режим редактирования политики и разверните следующий раздел политик: Computer Configuration->Administrative Templates->System->Windows Time Service->Time Providers

Нас интересуют три политики:

В настройках политики Configure Windows NTP Client укажите следующие параметры:

Примените созданный ранее фильтр PDC Emulator к данной политике.

Осталось обновить политики на контроллере PDC:
gpupdate /force

Вручную запустите синхронизацию времени:
w32tm /resync

Проверьте текущие настройки NTP:
w32tm /query /status

Настройка синхронизации времени на клиентах домена

В среде Active Directory по умолчанию клиенты домена синхронизируют свое время с контролерами домена (опция Nt5DS – синхронизировать время согласно иерархии домена). Как правило, эта схема работает и не требует перенастройки. Однако при наличии проблем с синхронизацией времени на клиентах домена, можно попробовать принудительно назначить сервер времени для клиентов с помощью GPO.

В качестве сервера NTP укажите имя или ip адрес PDC, например msk-dc1.winitpro.ru,0x9, а в качестве типа синхронизации — NT5DS

Обновите настройки групповых политик на клиентах и проверьте, что клиенты успешно синхронизировали свое время с PDC.

Источник

Set NTP Server Windows 2016 or Windows 2019

There is no question about it, having accurate time in your environment set in critical infrastructure systems is a must. Many business-critical applications and infrastructure systems rely on accurate time synchronized between them to ensure the system functions as expected. Time skew can cause all kinds of weirdness when it is misconfigured or out of sync between different servers/systems. This is especially true in a Windows Server Active Directory domain. Having accurate time between a client computer and domain controllers is essential. Let’s take a look at how to set ntp server Windows 2016 or Windows 2019 to see how this can be easily carried out.

What is NTP?

Wen it comes to synchronizing time in most enviornments, Network Time Protocol (NTP) is the protocol that is used to ensure accurate time across your environent. In most environments, NTP servers, special time servers, are configured that provide an external time source for which your internal servers can synchronize with.

There are several widely known NTP IP addresses on the Internet that provide reliable time sources for your network. The NTP.org servers are one such set of time servers that provide an NTP source for configuration.
There are a few NTP values to be aware of:

How Time is synchronized in a Windows Server domain

In a Windows domain, Microsoft has default configuration in place that takes care of a good portion of the NTP configuration. Starting with Windows 2000 Server, Windows clients are configured as NTP Clients. When configured as an NTP client, Windows computers only attempt to contact the domain controller for NTP synchronization or a manually specified NTP server.

Microsoft has made the domain controller the default in a Windows domain since it makes sense that clients already have a secure channel established with DCs for other types of communications. Additionally, accurate and synchronized time between domain controllers and clients is especially important for all kinds of things such as logins, group policy synchronization and other tasks/operations.

The order of operations or hierarchy in a Windows domain is as follows:

An important point to consider and that comes into play when thinking about why we set ntp server in Windows 2016 or Windows 2019 is the authoritative domain controller must have a reliable source to synchronize with as well. This is generally an external time server outside of the domain hierarchy.

Now that we know how the domain hierarchy for time is configured, how is the external time source configured on your domain controller that is configured as the reliable source of time?

Configuring Windows Time Service with W32tm.exe

When it comes to Windows Server environments like Windows Server 2016 or Windows Server 2019, there is a special Windows service that controls the time synchronization of your Windows hosts. This is the Windows Time Service.

Microsoft provides a command line tool to interact with the Windows Time Service called W32tm.exe. This has been included in Windows operating systems since Windows XP/Windows 2003 and later. It can be used to configure Windows Time service parameters as well as diagnose time service problems. This is generally the tool of choice when it comes to configuring, monitoring, and administering Windows Time.

Using the W32tm.exe utility is fairly straightforward. It can be used from a normal command prompt as well as from a PowerShell prompt. There are several command parameters included that allow not only configuring the NTP servers you want to query, but also parameters that allow viewing the low level registry configuration as well as the synchronization status.

You can read the official Microsoft KB on the Windows Time service and the W32tm.exe utility here:

However, there are a few commands I would like to show you for the purposes of configuring your Domain controller that is to be the reliable time source (PDC Emulator) for your domain.

The first command is the command line entry to specify your NTP servers, which in this case I am using the NTP.org servers to set as the source of my NTP synchronization.

Configuring the time source for your domain with the w32tm utility

If you want to view the status of the NTP synchronization on your server after you have configured the values and restarted the w32time service, you can use the following command:

Querying the NTP synchronization status of your Windows Server 2016 or 2019 domain controller

You can also check the values configured in your registry key hkey local machine system currentcontrolset services w32time config using the commands below. You can drill into the configuration parameters using the /dumpreg /subkey command.

Viewing the NTP registry values that are configured for your Windows Server

Final Thoughts

As shown, you can easily set NTP Server Windows 2016 or Windows 2019 using the w32tm command utility that allows interacting with the time service in Windows Server.

In a Windows domain, you want to configure your authoritative time source domain controller, which by default is the PDC Emulator, to pull time information from an authoritative source like NTP.org or some other reliable NTP time server.

After configuring the time source, the other domain controllers will synchronize with this server and then the Windows clients joined to the domain will synchronize with the domain controllers that have the corrected time from the authoritative server.

Источник

Настройка NTP сервера в Windows

Начиная с Windows 2000 все операционные системы Windows включают в себя службу времени W32Time. Эта служба предназначена для синхронизации времени в пределах организации. W32Time отвечает за работу как клиентской, так и серверной части службы времени, причем один и тот же компьютер может быть одновременно и клиентом и сервером NTP (Network Time Protocol).

По умолчанию служба времени в Windows сконфигурирована следующим образом:

• При установке операционной системы Windows запускает клиента NTP и синхронизируется с внешним источником времени;
• При добавлении компьютера в домен тип синхронизации меняется. Все клиентские компьютеры и рядовые сервера в домене используют для синхронизации времени контроллер домена, проверяющий их подлинность;
• При повышении рядового сервера до контроллера домена на нем запускается NTP-сервер, который в качестве источника времени использует контроллер с ролью PDC-эмулятор;
• PDC-эмулятор, расположенный в корневом домене леса, является основным сервером времени для всей организации. При этом сам он также синхронизируется с внешним источником времени.

Такая схема работает в большинстве случаев и не требует вмешательства. Однако структура сервиса времени в Windows может и не следовать доменной иерархии, и надежным источником времени можно назначить любой компьютер. В качестве примера я опишу настройку NTP-сервера в Windows Server 2008 R2, хотя со времен Windows 2000 процедура не особо изменилась.

Запуск NTP сервера

Сразу отмечу, что служба времени в Windows Server (начиная с 2000 и заканчивая 2012) не имеет графического интерфейса и настраивается либо из командной строки, либо путем прямой правки системного реестра. Лично мне ближе второй способ, поэтому идем в реестр.

Итак, первым делом нам надо запустить сервер NTP. Открываем ветку реестра
HKLM\System\CurrentControlSet\services\W32Time\TimeProviders\NtpServer.
Здесь для включения сервера NTP параметру Enabled надо установить значение 1.

Затем перезапускаем службу времени командой net stop w32time && net start w32time

Для того, чтобы NTP-сервер мог обслуживать клиентов, не забудьте на файерволле открыть UDP порт 123 для входящего и исходящего траффика.

Основные настройки NTP сервера

NTP сервер включили, теперь надо его настроить. Открываем ветку реестра HKLM\System\CurrentControlSet\services\W32Time\Parameters. Здесь в первую очередь нас интересует параметр Type, который задает тип синхронизации. Он может принимать следующие значения:

NoSync — NTP-сервер не синхронизируется с каким либо внешним источником времени. Используются часы, встроенные в микросхему CMOS самого сервера;
NTP — NTP-сервер синхронизируется с внешними серверами времени, которые указаны в параметре реестра NtpServer;
NT5DS — NTP-сервер производит синхронизацию согласно доменной иерархии;
AllSync — NTP-сервер использует для синхронизации все доступные источники.

Значение по умолчанию для компьютера, входящего в домен — NT5DS, для отдельно стоящего компьютера — NTP.

И параметр NtpServer, в котором указываются NTP-сервера, с которыми будет синхронизировать время данный сервер. По умолчанию в этом параметре прописан NTP-сервер Microsoft (time.windows.com, 0x1), при необходимости можно добавить еще несколько NTP-серверов, введя их DNS имена или IP адреса через пробел. Список доступных серверов времени можно посмотреть например здесь.

В конце каждого имени можно добавлять флаг (напр. ,0x1) который определяет режим для синхронизации с сервером времени. Допускаются следующие значения:

0x1 – SpecialInterval, использование специального интервала опроса ;
0x2 – режим UseAsFallbackOnly;
0x4 – SymmetricActive, симметричный активный режим;
0x8 – Client, отправка запроса в клиентском режиме.

При использовании флага SpecialInterval, необходимо установленное значение интервала в ключе SpecialPollInterval. При значении флага UseAsFallbackOnly службе времени сообщается, что данный сервер будет использоваться как резервный и перед синхронизацией с ним будут выполнятся обращения к другим серверам списка. Симметричный активный режим используется NTP-серверами по умолчанию, а клиентский режим можно задействовать в случае проблем с синхронизацией. Подробнее о режимах синхронизации можно посмотреть здесь, либо не морочиться и просто ставить везде ,0x1 (как советует Microsoft).

Еще один важный параметр AnnounceFlags находится в разделе реестра HKLM\System\CurrentControlSet\services\W32Time\Config. Он отвечает за то, как о себе заявляет NTP-сервер и может принимать следующие значения:

0x0 (Not a time server) — сервер не объявляет себя через NetLogon, как источник времени. Он может отвечать на NTP запросы, но соседи не смогут распознать его, как источник времени;
0x1 (Always time server) — сервер будет всегда объявлять о себе вне зависимости от статуса;
0x2 (Automatic time server) — сервер будет объявлять о себе только, если он получает надежное время от другого соседа (NTP или NT5DS);
0x4 (Always reliable time server) — сервер будет всегда заявлять себя, как надежный источник времени;
0x8 (Automatic reliable time server) — контроллер домена автоматически объявляется надежным если он PDC-эмулятор корневого домена леса. Этот флаг позволяет главному PDC леса заявить о себе как об авторизованном источнике времени для всего леса даже при отсутствии связи с вышестоящими NTP-серверами. Ни один другой контроллер или рядовой сервер (имеющие по умолчанию флаг 0x2) не может заявить о себе, как надежном источнике времени, если он не может найти источник времени для себя.

Значение AnnounceFlags составляет сумму составляющих его флагов, например:

10=2+8 — NTP-сервер заявляет о себе как о надежном источнике времени при условии, что сам получает время из надежного источника либо является PDC корневого домена. Флаг 10 задается по умолчанию как для членов домена, так и для отдельно стоящих серверов.

5=1+4 — NTP-сервер всегда заявляет о себе как о надежном источнике времени. Например, чтобы заявить рядовой сервер (не домен-контроллер) как надежный источник времени, нужен флаг 5.

Ну и настроим интервал между обновлениями. За него отвечает уже упоминавшийся выше ключ SpecialPollInterval, находящийся в ветке реестра HKLM\System\CurrentControlSet\services\W32Time\TimeProviders\NtpClient. Он задается в секундах и по умолчанию его значение равно 604800, что составляет 1 неделю. Это очень много, поэтому стоит уменьшить значение SpecialPollInterval до разумного значения, скажем до 1 часа (3600).

После настройки необходимо обновить конфигурацию сервиса. Сделать это можно командой w32tm /config /update. И еще несколько команд для настройки, мониторинга и диагностики службы времени:

w32tm /monitor – при помощи этой опции можно узнать, насколько системное время данного компьютера отличается от времени на контроллере домена или других компьютерах. Например: w32tm /monitor /computers:time.nist.gov
w32tm /resync – при помощи этой команды можно заставить компьютер синхронизироваться с используемым им сервером времени.
w32tm /stripchart – показывает разницу во времени между текущим и удаленным компьютером, причем может выводить результат в графическом виде. Например, команда w32tm /stripchart /computer:time.nist.gov /samples:5 /dataonly произведет 5 сравнений с указанным источником и выведет результат в текстовом виде.

w32tm /config – это основная команда, используемая для конфигурирования службы NTP. С ее помощью можно задать список используемых серверов времени, тип синхронизации и многое другое. Например, переопределить значения по умолчанию и настроить синхронизацию времени с внешним источником, можно командой w32tm /config /syncfromflags:manual /manualpeerlist:time.nist.gov /update
w32tm /query — показывает текущие настройки службы. Например команда w32tm /query /source покажет текущий источник времени, а w32tm /query /configuration выведет все параметры службы.

Ну и на крайний случай 🙁
w32tm /unregister — удаляет службу времени с компьютера.
w32tm /register – регистрирует службу времени на компьютере. При этом создается заново вся ветка параметров в реестре.

Источник

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Как отключить обновление на windows 7 максимальная
  • Не грузится загрузочная флешка windows 10
  • Эмулятор windows на флешку
  • Как посмотреть свойства монитора на windows 10
  • Пойдет ли сталкер тень чернобыля на windows 10