- Точное время в Windows Server 2016 Accurate Time for Windows Server 2016
- Иерархия доменов Domain Hierarchy
- Критические факторы для определения точного времени Critical Factors for Accurate Time
- Почему важно время? Why is time important?
- How to configure an authoritative time server in Windows Server
- Troubleshooting
- More information
- References
Точное время в Windows Server 2016 Accurate Time for Windows Server 2016
Применяется к: Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, Windows 10 или более поздних версий Applies to: Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, Windows 10 or later
Служба времени Windows — это компонент, использующий модель подключаемых модулей для клиентских и серверных поставщиков синхронизации времени. The Windows Time service is a component that uses a plug-in model for client and server time synchronization providers. В Windows есть два встроенных клиентских поставщика и доступны подключаемые модули сторонних поставщиков. There are two built-in client providers on Windows, and there are third-party plug-ins available. Один поставщик использует протокол NTP (RFC 1305) или MS-NTP для синхронизации локального системного времени с эталонным сервером, совместимым с этими протоколами. One provider uses NTP (RFC 1305) or MS-NTP to synchronize the local system time to an NTP and/or MS-NTP compliant reference server. Другой поставщик предназначен для Hyper-V и синхронизирует виртуальные машины с узлом Hyper-V. The other provider is for Hyper-V and synchronizes virtual machines (VM) to the Hyper-V host. Если есть несколько поставщиков, Windows выберет наилучшего поставщика, оценивая стратовый уровень, корневую задержку, корневую дисперсию, а затем смещение времени. When multiple providers exist, Windows will pick the best provider using stratum level first, followed by root delay, root dispersion, and finally time offset.
Краткий обзор службы времени Windows см. в этом видео. For a quick overview of Windows Time service, take a look at this high-level overview video.
В этом разделе мы обсудим темы по мере их влияния на точность времени: In this topic, we discuss . these topics as they relate to enabling accurate time:
- Улучшения Improvements
- Измерения Measurements
- Советы и рекомендации Best Practices
Дополнение, на которое ссылается статья о точном времени в Windows 2016, можно скачать здесь. An addendum referenced by the Windows 2016 Accurate Time article can be downloaded here. В этом документе содержатся дополнительные сведения о методологиях тестирования и измерения. This document provides more details about our testing and measurement methodologies.
Модель подключаемого модуля поставщика времени Windows описана в документации в TechNet. The windows time provider plugin model is documented on TechNet.
Иерархия доменов Domain Hierarchy
Доменная и автономная конфигурации работают по-разному. Domain and Standalone configurations work differently.
Участники домена используют безопасный протокол NTP для проверки подлинности, обеспечивающий безопасность и подлинность ссылки времени. Domain members use a secure NTP protocol, which uses authentication to ensure the security and authenticity of the time reference. Участники домена синхронизируются с главными часами, определенными иерархией доменов и системой оценки. Domain members synchronize with a master clock determined by the domain hierarchy and a scoring system. В домене существует иерархический уровень страт времени, где каждый контроллер домена указывает на родительский контроллер домена с более точной стратой времени. In a domain, there is a hierarchical layer of time strata, whereby each DC points to a parent DC with a more accurate time stratum. Иерархия разрешается в основной контроллер домена, контроллер домена в корневом лесу или контроллер домена с меткой домена GTIMESERV, которая обозначает лучший сервер времени для домена. The hierarchy resolves to the PDC or a DC in the root forest, or a DC with the GTIMESERV domain flag, which denotes a Good Time Server for the domain. См. раздел «Указание надежной локальной службы времени с помощью GTIMESERV» ниже. See the [Specify a Local Reliable Time Service Using GTIMESERV section below.
По умолчанию автономные компьютеры настроены использовать time.windows.com. Standalone machines are configured to use time.windows.com by default. Это имя разрешается DNS-сервером, который должен указывать на ресурс, принадлежащий корпорации Майкрософт. This name is resolved by your DNS Server, which should point to a Microsoft owned resource. Все удаленно размещенные ссылки времени могут создавать сетевые сбои, препятствующие синхронизации. Like all remotely located time references, network outages, may prevent synchronization. Нагрузка сетевого трафика и асимметричные сетевые пути могут уменьшить точность синхронизации времени. Network traffic loads and asymmetrical network paths may reduce the accuracy of the time synchronization. Если вам требуется точность времени до 1 мс, удаленные источники времени будут неэффективны. For 1 ms accuracy, you can’t depend on a remote time sources.
При работе в гостевом компьютере вы можете столкнуться с различным поведением домена или автономной среды, так как у гостевых машин Hyper-V будут по крайней мере два поставщика времени Windows на выбор — время узла и NTP. Since Hyper-V guests will have at least two Windows Time providers to choose from, the host time and NTP, you might see different behaviors with either Domain or Standalone when running as a guest.
Дополнительные сведения об иерархии доменов и системе оценки см. в записи блога, посвященной службе времени Windows. For more information about the domain hierarchy and scoring system, see the «What is Windows Time Service?» . blog post.
Страта — это концепция, используемая в поставщиках NTP и Hyper-V, и ее значение указывает расположение часов в иерархии. Stratum is a concept used in both the NTP and Hyper-V providers, and its value indicates the clocks location in the hierarchy. Страта 1 резервируется для часов самого высокого уровня, а Страта 0 — для оборудования, время которого считается точным с минимальной или отсутствующей задержкой, связанной с ним. Stratum 1 is reserved for the highest-level clock, and stratum 0 is reserved for the hardware assumed to be accurate and has little or no delay associated with it. Страта 2 обращается к серверам страты 1, страта 3 — к страте 2 и т. д. Stratum 2 talk to stratum 1 servers, stratum 3 to stratum 2 and so on. Хотя страты более низкого уровня часто указывают более точное время, случаются несоответствия. While a lower stratum often indicates a more accurate clock, it is possible to find discrepancies. Кроме того, служба W32Time принимает только время из страты 15 или ниже. Also, W32time only accepts time from stratum 15 or below. Чтобы просмотреть страту клиента, используйте w32tm /query /status. To see the stratum of a client, use w32tm /query /status.
Критические факторы для определения точного времени Critical Factors for Accurate Time
Во всех случаях для определения точного времени есть три важных фактора: In every case for accurate time, there are three critical factors:
- Физический источник времени — исходные часы в домене должны быть стабильными и точными. Solid Source Clock — The source clock in your domain needs to be stable and accurate. Обычно это означает установку устройства GPS или указание на источник страты 1 с учетом страты 3. This usually means installing a GPS device or pointing to a Stratum 1 source, taking #3 into account. Аналогия такова: если у вас есть две лодки в воде и вы пытаетесь измерить высоту одной по сравнению с другой, точность будет правдивой, если исходная лодка очень стабильна и не движется. The analogy goes, if you have two boats on the water, and you are trying to measure the altitude of one compared to the other, your accuracy is best if the source boat is very stable and not moving. То же самое касается времени. Если исходные часы нестабильны, то влияние распространится на всю цепь синхронизации времени, усиливаясь на каждом этапе. The same goes for time, and if your source clock isn’t stable, then the entire chain of synchronized clocks is affected and magnified at each stage. Источник времени должен быть доступен, так как нарушения соединения могут помешать синхронизации времени. It also must be accessible because disruptions in the connection will interfere with time synchronization. И наконец, источник должен быть безопасным. And finally, it must be secure. Если источник ссылки времени обслуживается неправильно или им управляет потенциально вредоносная сторона, домен может подвергаться атакам на основе времени. If the time reference is not properly maintained, or operated by a potentially malicious party, you could expose your domain to time based attacks.
- Стабильные клиентские часы — часы, которые гарантируют, что естественное смещение осциллятора не будет критичным. Stable client clock — A stable client clocks assures that the natural drift of the oscillator is containable. NTP использует несколько выборок, возможно из нескольких серверов NTP, для настройки и согласования часов в ваших локальных компьютерах. NTP uses multiple samples from potentially multiple NTP servers to condition and discipline your local computers clock. Это не шаг изменения времени, а скорее замедление или ускорение местных часов, что позволяет гарантировать точность времени и обеспечить точность среди NTP-запросов. It does not step the time changes, but rather slows or speeds up the local clock so that you approach the accurate time quickly and stay accurate between NTP requests. Тем не менее, если осциллятор часов клиентского компьютера нестабилен, то могут возникнуть дополнительные отклонения между настройками и алгоритмы, используемые Windows для настройки часов, не будут работать точно. However, if the client computer clock’s oscillator is not stable, then more fluctuations in between adjustments can occur and the algorithms Windows uses to condition the clock don’t work accurately. В некоторых случаях для обеспечения точности времени могут потребоваться обновления встроенного ПО. In some cases, firmware updates might be needed for accurate time.
- Симметричное NTP-подключение — очень важно, чтобы подключение по протоколу NTP было симметричным. Symmetrical NTP communication — It is critical that the connection for NTP communication is symmetrical. NTP использует вычисления для корректировки времени, которые предполагают, что сетевой путь симметричен. NTP uses calculations to adjust the time that assume the network path is symmetrical. Если путь, по которому пакет NTP передается на сервер, возвращается за другой период времени, это повлияет на точность. If the path the NTP packet takes going to the server takes a different amount of time to return, the accuracy is affected. Например, путь может измениться из-за изменений в топологии сети или пакетов, направляемых через устройства с разными скоростями интерфейсов. For example, the path could change due to changes in network topology, or packets being routed through devices that have different interface speeds.
Для устройств с питанием от аккумулятора, как мобильных, так и переносимых, необходимо учитывать разные стратегии. For battery powered devices, both mobile and portable, you must consider different strategies. Мы советуем поддерживать точность времени, обеспечивая корректировку часов единожды в секунду, что соотносится с частотой обновления часов. As per our recommendation, keeping accurate time requires the clock to be disciplined once a second, which correlates to the Clock Update Frequency. Эти настройки будут требовать большего потребления энергии аккумулятора, чем ожидалось, и могут отрицательно влиять на режимы энергосбережения, доступные в Windows для таких устройств. These settings will consume more battery power than expected and can interfere with power saving modes available in Windows for such devices. В устройствах с питанием от аккумулятора также есть определенные режимы энергопитания, в которых останавливается работа всех приложений, что препятствует способности W32Time корректировать часы и поддерживать точность времени. Battery powered devices also have certain power modes which stop all applications from running, which interferes with W32time’s ability to discipline the clock and maintain accurate time. Кроме того, часы в мобильных устройствах могут быть изначально неточными. Additionally, clocks in mobile devices may not be very accurate to begin with. Условия окружающей среды влияют на точность часов, и мобильное устройство может попадать из одних условий в другие, что может помешать его способности поддерживать точность времени. Ambient environmental conditions affect clock accuracy and a mobile device can move from one ambient condition to the next which may interfere with its ability to keep time accurately. Поэтому мы не советуем выбирать для мобильных устройств с питанием от аккумулятора параметры высокой точности. Therefore, Microsoft does not recommend that you set up battery powered portable devices with high accuracy settings.
Почему важно время? Why is time important?
Есть множество различных причин, по которым может потребоваться точное время. There are many different reasons you might need accurate time. Типичным случаем для Windows является Kerberos, где для работы требуется 5-минутная точность между клиентом и сервером. The typical case for Windows is Kerberos, which requires 5 minutes of accuracy between the client and server. Тем не менее есть множество других областей, в которых важна точность времени, в том числе: However, there are many other areas that can be affected by time accuracy including:
- правительственное управление, к примеру Government Regulations like:
- 50 мс для FINRA в США; 50 ms accuracy for FINRA in the US
- 1 мс для Европейской организации по ценным бумагам и рынкам (Директива Евросоюза «O рынках финансовых инструментов») в ЕС; 1 ms ESMA (MiFID II) in the EU.
- алгоритмы шифрования; Cryptography Algorithms
- распределенные системы, такие как кластеры, SQL, Exchange и Document DB; Distributed systems like Cluster/SQL/Exchange and Document DBs
- платформа Блокчейн для биткойн-транзакций; Blockchain framework for bitcoin transactions
- распределенные журналы и анализ угроз; Distributed Logs and Threat Analysis
- Репликация Active Directory AD Replication
- отрасль платежных карт (сейчас требуется точность до 1 с). PCI (Payment Card Industry), currently 1 second accuracy
How to configure an authoritative time server in Windows Server
This article describes how to configure the Windows Time service and troubleshoot when the Windows Time service doesn’t work correctly.
Original product version: В Windows Server 2012 Standard, Windows Server 2012 Essentials
Original KB number: В 816042
To configure an internal time server to synchronize with an external time source, use the following method:
To configure the PDC in the root of an Active Directory forest to synchronize with an external time source, follow these steps:
Change the server type to NTP. To do this, follow these steps:
Select Start > Run, type regedit, and then select OK.
Locate and then select the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
In the pane on the right, right-click Type, and then select Modify.
In Edit Value, type NTP in the Value data box, and then select OK.
Set AnnounceFlags to 5. To do this, follow these steps:
Locate and then select the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config
In the pane on the right, right-click AnnounceFlags, and then select Modify.
In Edit DWORD Value, type 5 in the Value data box, and then select OK.
- If an authoritative time server that is configured to use an AnnounceFlag value of 0x5 does not synchronize with an upstream time server, a client server may not correctly synchronize with the authoritative time server when the time synchronization between the authoritative time server and the upstream time server resumes. Therefore, if you have a poor network connection or other concerns that may cause time synchronization failure of the authoritative server to an upstream server, set the AnnounceFlag value to 0xA instead of to 0x5.
- If an authoritative time server that is configured to use an AnnounceFlag value of 0x5 and to synchronize with an upstream time server at a fixed interval that is specified in SpecialPollInterval , a client server may not correctly synchronize with the authoritative time server after the authoritative time server restarts. Therefore, if you configure your authoritative time server to synchronize with an upstream NTP server at a fixed interval that is specified in SpecialPollInterval , set the AnnounceFlag value to 0xA instead of 0x5.
Enable NTPServer. To do this, follow these steps:
Locate and then select the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer
In the pane on the right, right-click Enabled, and then select Modify.
In Edit DWORD Value, type 1 in the Value data box, and then select OK.
Specify the time sources. To do this, follow these steps:
Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
In the pane on the right, right-click NtpServer, and then select Modify.
In Edit Value, type Peers in the Value data box, and then select OK.
Peers is a placeholder for a space-delimited list of peers from which your computer obtains time stamps. Each DNS name that is listed must be unique. You must append ,0x1 to the end of each DNS name. If you do not append ,0x1 to the end of each DNS name, the changes that you make in step 5 will not take effect.
Configure the time correction settings. To do this, follow these steps:
Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config
In the pane on the right, right-click MaxPosPhaseCorrection, and then select Modify.
In Edit DWORD Value, click to select Decimal in the Base box.
In Edit DWORD Value, type TimeInSeconds in the Value data box, and then select OK.
TimeInSeconds is a placeholder for a reasonable value, such as 1 hour (3600) or 30 minutes (1800). The value that you select will depend on the poll interval, network condition, and external time source.
The default value of MaxPosPhaseCorrection is 48 hours in Windows Server 2008 R2 or later.
Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config
In the pane on the right, right-click MaxNegPhaseCorrection, and then select Modify.
In Edit DWORD Value, click to select Decimal in the Base box.
In Edit DWORD Value, type TimeInSeconds in the Value data box, and then select OK.
TimeInSeconds is a placeholder for a reasonable value, such as 1 hour (3600) or 30 minutes (1800). The value that you select will depend on the poll interval, network condition, and external time source.
The default value of MaxNegPhaseCorrection is 48 hours in Windows Server 2008 R2 or later.
Close Registry Editor.
At the command prompt, type the following command to restart the Windows Time service, and then press Enter:
Troubleshooting
For the Windows Time service to function correctly, the networking infrastructure must function correctly. The most common problems that affect the Windows Time service include the following:
- There is a problem with TCP/IP connectivity, such as a dead gateway.
- The Name Resolution service is not working correctly.
- The network is experiencing high volume delays, especially when synchronization occurs over high-latency wide area network (WAN) links.
- The Windows Time service is trying to synchronize with inaccurate time sources.
We recommend that you use the Netdiag.exe utility to troubleshoot network-related issues. Netdiag.exe is part of the Windows Server 2003 Support Tools package. See Tools Help for a complete list of command-line parameters that you can use with Netdiag.exe. If your problem is still not solved, you can turn on the Windows Time service debug log. Because the debug log can contain very detailed information, we recommend that you contact Microsoft Customer Support Services when you turn on the Windows Time service debug log.
In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.
More information
Windows Server includes W32Time, the Time Service tool that is required by the Kerberos authentication protocol. The Windows Time service makes sure that all computers in an organization that are running the Microsoft Windows 2000 Server operating system or later versions use a common time.
To guarantee appropriate common time usage, the Windows Time service uses a hierarchical relationship that controls authority, and the Windows Time service does not allow for loops. By default, Windows-based computers use the following hierarchy:
- All client desktop computers nominate the authenticating domain controller as their in-bound time partner.
- All member servers follow the same process that client desktop computers follow.
- All domain controllers in a domain nominate the primary domain controller (PDC) operations master as their in-bound time partner.
- All PDC operations masters follow the hierarchy of domains in the selection of their in-bound time partner.
In this hierarchy, the PDC operations master at the root of the forest becomes authoritative for the organization. We highly recommend that you configure the authoritative time server to obtain the time from a hardware source. When you configure the authoritative time server to sync with an Internet time source, there is no authentication. We also recommend that you reduce your time correction settings for your servers and stand-alone clients. These recommendations provide more accuracy and security to your domain.
References
For more information about Windows Time service, see:
For more information about the Windows Time service, see Windows Time Service (W32Time).