I had the same issue and finally resolved it this morning. Here is what I did:
Have a look in the registry (all hives and keys in HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesW32Time) on both the server with the time issue and another member server that is syncing ntp correctly.
I found a few discrepancies and exported the required keys hives from the working server to the broken one. The following keys had been messed up, here is the good keys I exported from the working box onto the broken one. Please note that these values may not be the same as yours so please dont use the keys below:
The security Hive was missing so I recreated with this:
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesW32TimeSecurity]
"Security"=hex:01,00,04,80,84,00,00,00,90,00,00,00,00,00,00,00,14,00,00,00,02,
00,70,00,05,00,00,00,00,00,14,00,fd,01,02,00,01,01,00,00,00,00,00,05,12,00,
00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,
00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,04,00,00,00,00,00,14,00,
8d,01,02,00,01,01,00,00,00,00,00,05,06,00,00,00,00,00,14,00,9d,01,02,00,01,
01,00,00,00,00,00,05,13,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00,01,01,
00,00,00,00,00,05,12,00,00,00
And noticed that the NtpServer hive had missing keys, this was fixed by importing:
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesW32TimeTimeProvidersNtpServer]
"DllName"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,00,
74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,77,
00,33,00,32,00,74,00,69,00,6d,00,65,00,2e,00,64,00,6c,00,6c,00,00,00
"Enabled"=dword:00000000
"InputProvider"=dword:00000000
"AllowNonstandardModeCombinations"=dword:00000001
"EventLogFlags"=dword:00000000
"ChainEntryTimeout"=dword:00000010
"ChainMaxEntries"=dword:00000080
"ChainMaxHostEntries"=dword:00000004
"ChainDisable"=dword:00000000
"ChainLoggingRate"=dword:0000001e
I then amended the following existing keys to reduce phase:
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesW32TimeConfig]
"MaxAllowedPhaseOffset"=dword:00000001
"SpecialPollInterval"=dword:00000005
"SpecialInterval"=dword:00000001
Once you are sure the registry is correct, Issue the following commands via Command Line as Administrator:
w32tm /config /manualpeerlist:"YOURNTPSERVER-OR-DCHERE.YOURDOMAIN.COM,0x01" /syncfromflags:MANUAL /update
net stop w32time && net start w32time
w32tm /resync /computer:YOURNTPSERVER-OR-DCHERE.YOURDOMAIN.COM /rediscover
Waited a few minutes then checked sync
w32tm /monitor /computers:YOURNTPSERVER-OR-DCHERE.YOURDOMAIN.COM
It should look a bit like this:
YOURNTPSERVER-OR-DCHERE.YOURDOMAIN.COM[IPOFYOUR.NTP.OR.DC:123]:
ICMP: 0ms delay
NTP: +0.0496804s offset from local clock
RefID: YOURNTPSERVER-OR-PDCHERE [IPOFYOUR.NTP.OR.PDC]
Stratum: 3
Then check phase:
w32tm /stripchart /computer:YOURNTPSERVER-OR-DCHERE.YOURDOMAIN.COM
It should look like this:
10:08:42 d:+00.0000000s o:+00.0139224s [ * ]
10:08:44 d:+00.0000000s o:-00.0015659s [ * ]
10:08:46 d:+00.0000000s o:-00.0014534s [ * ]
10:08:48 d:+00.0000000s o:-00.0013418s [ * ]
10:08:50 d:+00.0000000s o:-00.0012421s [ * ]
Hope this helps!
0 / 0 / 0 Регистрация: 03.03.2014 Сообщений: 16 |
|
1 |
|
Server 2008 18.03.2014, 13:01. Показов 24048. Ответов 12
Доброго времени суток. Подскажите решение проблемы. EventLogFlags: 2 (Локально) FrequencyCorrectRate: 4 (Локально) [TimeProviders] NtpClient (Локально) NtpServer (Локально) VMICTimeProvider (Локально)
__________________
0 |
81 / 81 / 7 Регистрация: 07.12.2012 Сообщений: 540 |
|
18.03.2014, 17:39 |
2 |
На КД cmd от админа net stop w32time Смотрите с кем синхронизируетесь, должно быть одно из ”0.pool.ntp.org, 1.pool.ntp.org, 2.pool.ntp.org” w32tm /resync /rediscover и еще раз w32tm /query /configuration Если снова не кажет, выведите снова w32tm /query /configuration и копи паст сюды
0 |
0 / 0 / 0 Регистрация: 03.03.2014 Сообщений: 16 |
|
18.03.2014, 19:30 [ТС] |
3 |
Я уже проходил подобный алгоритм действий. Не помогло. А конфиг что скинул это как раз после ввода команд по настройки синхронизации с внешним NTP. w32tm /config /syncfromflags:manual /manualpeerlist:”0.pool.ntp.org, 1.pool.ntp.org, 2.pool.ntp.org” дает следующий результат: C:Windowssystem32>w32tm /config /syncfromflags:manual /manualpeerlist:»0.pool. Что это означает? То что у меня проходит синхронизация с «0.pool.ntp.org»?
0 |
81 / 81 / 7 Регистрация: 07.12.2012 Сообщений: 540 |
|
18.03.2014, 19:33 |
4 |
Вы можете посмотреть, ваши списки НТП серверов через w32tm /query /configuration Так же, нормально должна отработаться команда w32tm /resync /rediscover После чего можно просмотреть текущий нтп сервер
0 |
0 / 0 / 0 Регистрация: 03.03.2014 Сообщений: 16 |
|
18.03.2014, 19:42 [ТС] |
5 |
Проверил работу команд, что Вы мне написали в последнем сообщении. Вот что получилось. C:Windowssystem32>w32tm /query /configuration EventLogFlags: 2 (Локально) FrequencyCorrectRate: 4 (Локально) [TimeProviders] NtpClient (Локально) NtpServer (Локально) VMICTimeProvider (Локально) C:Windowssystem32>w32tm /query /source C:Windowssystem32>w32tm /resync /rediscover
0 |
81 / 81 / 7 Регистрация: 07.12.2012 Сообщений: 540 |
|
18.03.2014, 19:48 |
6 |
VM IC Time Synchronization Provider
0 |
0 / 0 / 0 Регистрация: 03.03.2014 Сообщений: 16 |
|
18.03.2014, 19:50 [ТС] |
7 |
Так же нашел в Событиях следующее сообщение: NTP-клиент поставщика времени получает действительные данные о времени от time.windows.com,0x9 (ntp.m|0x9|0.0.0.0:123->65.55.56.206:123). Тем не менее время отставало на 37 минут от реального, так и отстает.
0 |
81 / 81 / 7 Регистрация: 07.12.2012 Сообщений: 540 |
|
18.03.2014, 19:50 |
8 |
Сначала надо w32tm /resync /rediscover
0 |
0 / 0 / 0 Регистрация: 03.03.2014 Сообщений: 16 |
|
18.03.2014, 19:51 [ТС] |
9 |
Да, именно Hyper-V.
0 |
81 / 81 / 7 Регистрация: 07.12.2012 Сообщений: 540 |
|
18.03.2014, 19:53 |
10 |
Да, в сетингах в низу там есть галочки системные, одна из них отвечает за Time Sync как то так, нет под рукой Hyper-V, но там это есть
0 |
0 / 0 / 0 Регистрация: 03.03.2014 Сообщений: 16 |
|
18.03.2014, 19:55 [ТС] |
11 |
Да, нашел. В параметрах виртуалки, во вкладке «службы интеграции», пункт «синхронизация времени».
0 |
81 / 81 / 7 Регистрация: 07.12.2012 Сообщений: 540 |
|
18.03.2014, 19:58 |
12 |
РешениеДа Останавливаем службу w32tm /resync /rediscover Проверяем источник w32tm /query /source Добавлено через 50 секунд
0 |
0 / 0 / 0 Регистрация: 03.03.2014 Сообщений: 16 |
|
18.03.2014, 20:06 [ТС] |
13 |
Да, все получилось.
0 |
First short description of AD time source hierarchy:
All members of an Active Directory domain are capable of synchronizing their clock to a domain controller -> Domain controller synchronize their clocks with the domain controller which holds the PDCe role in their domain -> PDCe’s in child domain synchronize their clock with the PDCe of the root domain of the forest.
Windows Time service is responsible for keeping a computer’s clock synchronized and can be controlled/configured by w32tm command line tool.
To force a computer to synchronize:
w32tm.exe /resync /rediscover /no_wait
To check if a computer is synchronizing:
w32tm /monitor
To check where the computer is getting its time:
w32tm /query /source
- “Local CMOS Clock”: The computer is using the hardware clock on the computer as its time source. If you are using VMware, this means that the virtual machine is synchronizing to the VMware host.
- “Free Running System Clock”: The computer is not using any external source, but depending on the time tick generated by the System Idle Process running on the computer.
- “A hostname of a domain controller in the AD forest”: The computer is using a domain controller as either an NTP server or as the time source via Active Directory. To determine which, see “/query /configuration”, discussed later.
- “A hostname of a computer running a NTP server”: The computer is using a non-Active Directory server running an NTP server as its time source.
- “VM IC Time Synchronization Provider”: In this case, the computer is using Hyper-V virtualization services as its time source. Best practices from Microsoft recommend that you never use virtualization services (regardless of your hypervisor provider) as a time source for domain-joined computer; instead, you should depend on typical Active Directory synchronization methods.
To check the time source:
w32tm /query /configuration
- “NTP”: the external time source is the NTP server specified by the NtpServer key
- “NT5DS”: the external time source is the domain hierarchy
- “NoSync”: there is no external time source
- “AllSync”: the computer should use both the domain hierarchy and the manually specified NTP server as external time sources
The appropriate PDCe configuration is setting external peers:
w32tm /config /manualpeerlist:pool.ntp.org /syncfromflags:manual
w32tm /config /update
net stop w32time
net start w32time
w32tm /resync /rediscover
For an alternate NTP configuration you can modify this key : HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeParametersNtpServer
adding some special flags to NTP source:
- 0x01 SpecialInterval
- 0x02 UseAsFallbackOnly
- 0x04 SymmatricActive
- 0x08 Client
Example:
time.windows.com,0x9 pool.ntp.org,0xa
The primary NTP server (flag 0x9) is Client (0x08) + SpecialInterval (0x01)
The second NTP server (flag 0xa) is Client (0x08) + UseAsFallbackOnly (0x02)
The PDCe has now to sources; the second one with flag “UseAsFallbackOnly” will be queried only if all other time server is not working.
If you use “SpecialInterval” you can overwrite the W32Time poll specifying a static interval using this key: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeTimeProvidersNtpClientSpecialPollInterval
For all domain-joined computer, the appropriate configuration is:
w32tm /config /syncfromflags:domhier
w32tm /config /update
net stop w32time
net start w32time
W32tm /resync /rediscover
VIA: https://support.microsoft.com/en-us/kb/816042, https://technet.microsoft.com/en-us/library/cc778879(v=ws.10).aspx, https://technet.microsoft.com/en-us/library/cc773263(v=ws.10).aspx
Очень удобно, когда все сервера и рабочие станции в AD имеют одинаковое время. Это избавляет от кучи проблем в структуре Active Directory.
Требования для статьи:
Будем считать, что у нас есть отдельные груповые политики для контроллера домена (или другого сервера, который будет выполнять эту роль) и для все остальных серверов и рабочих станций.
Синхронизацию сервера времени настраиваем с внешним сервером. Поэтому для сервера, который является центральным сервером времени, нужно открыть вовне порт 123, а так же для все остальных серверов и ПК должен быть открыт порт 123 во внутренней сети (NTP работает по этому порту).
Для того, чтобы это сделать открываем групповые политики
gpedit.msc
Поставшики времени
И переходим Конфигурация компьютера->Административные шаблоны->Система->Службы времени Windows->Поставшики времени
Теперь нам нужно настроить 3 параметра.
Включить NTP клиент Windows – включено (для всех политик).
Включить NTP сервер Windows – включено (только в политике для локального сервера времени).
Настроить NTP клиент Windows (сервер времени)
Настроить NTP клиент Windows (все остальные)
Настроить NTP клиент Windows – Включаем и настраиваем параметры:
NtpServer: для локального сервера времени – time.windows.com,0x9 для всех остальных – имя сервера времени в нашей сети.
Type: для локального сервера времени – NTP для всех остальных – NT5DS.
Теперь дожидаемся применения политики, или применяем ее принудительно, командой:
gpupdate /force
w32tm
командой:
w32tm /query /status
проверяем какие сервера используются (параметр Источник)
Для сервера он будет – time.windows.com,0x9
Для всех остальных – имя локального сервера времени.
На этом настройка синхронизации часов в домене завершена.
Заказать создание и поддержку безопасной IT-инфраструктуры любой сложности
Быть уверенным в своей IT-инфраструктуре – это быть уверенным в завтрашнем дне.
Для того, чтобы сделать заказ:
Безопасные и надежные IT решения
Вы можете столкнуться с ошибкой синхронизации времени в Windows, когда ваш компьютер не может автоматически синхронизировать свое время с серверами времени time.microsoft.com в Интернете. Из-за некорректного времени на компьютере у вас может возникать ошибка «
Your clock is ahead/ Ваши Часы спешат (отстают)
» при открытии HTTPS сайтов Chrome (и в других браузерах), не корректно работать сторонние программы, и появляться различные другие неприятности.
Если попытаться вручную выполнить синхронизацию времени из панели управления Windows (Control Panel -> Date and Time -> Internet Time -> Change Settings -> Update now), появляется ошибка:
An error occurred while windows was synchronizing with time.windows.com. The peer is unreachable.
Также здесь может быть ошибка:
The peer is unresolved.
Проверьте, что у вас настроена автоматическая синхронизация времени с NTP серверами в Интернете. Перейдите в раздел Settings -> Time and Language -> Date and Time (можно перейти в этот раздел с помощью команды быстрого доступа по URI:
ms-settings:dateandtime
). Проверьте, что здесь включена опцию Set time automatically и выполните синхронизацию, нажав кнопку Sync now в разделе Additional settings.
Если синхронизация времени с Интернетом не работает, проверьте, с какого внешнего NTP сервера должен получить время ваш компьютер. Выполните команду:
w32tm /query /peers
По умолчанию компьютеры в рабочих группах (не присоединенные к домену Active Directory) настроены на получение времени с серверов time.windows.com.
Если при запуске этой команды появилась ошибка “The following error occurred: The service has not been started. (0x80070426)”, проверьте состояние службы Windows Time. Она должна быть настроена на автоматический или ручной запуск. Можете проверить состояние службы с помощью PowerShell или консоли services.msc:
Get-Service w32time| Select DisplayName,Status, ServiceName,StartType
Перезапустите службу:
Restart-Service -Name w32time
Если служба отключена, включите ее.
Проверьте, что с вашего компьютера доступен хост time.microsoft.com.
Сначала проверьте, что ваш компьютер может разрешить это имя в IP адрес:
nslookup time.windows.com
Если ваш компьютер не может отрезолвить это имя в IP адрес (ошибка синхронизации времени The peer is unresolved), значит в настройках сетевого адаптера вашего компьютера указан DNS сервер, который не доступен, или изолирован от интернета. Попробуйте сменить адрес первичного DNS сервера на DNS сервер Google (8.8.8.8). Можно изменить настройки DNS для сетевого адаптера в Windows с помощью PowerShell.
Вывести список сетевых интерфейсов:
Get-NetAdapter
Изменить настройки DNS для сетевого адаптера с ifIndex 10:
Set-DNSClientServerAddress –InterfaceIndex 10 –ServerAddresses 8.8.8.8
Проверьте доступность сервера с помощью ping:
ping time.windows.com
И затем проверьте, что сервер времени Microsoft доступен по порту NTP (UDP 123). Для проверки доступности UDP порта можно использовать утилиту portquery или можно напрямую обратиться к серверу и запросить у него текущее время:
w32tm /stripchart /computer:time.windows.com
Если команда вернет ошибку error: 0x800705B4, значить указанный NTP сервер не доступен. Проверьте, что в Windows открыт исходящий порт UDP/123 для протокола NTP (по умолчанию порт должен быть открыт). Вы можете принудительно открыть порт в Windows Defender Firewall с помощью PowerShell:
New-NetFirewallRule -DisplayName "AllowOutNTP" -Direction Outbound -Protocol UDP -RemotePort 123 -Action Allow
Enable-NetFirewallRule -DisplayName AllowOutNTP
Также убедитесь, что исходящий NTP трафик не блокируется на сетевом уровне (провайдера, вашего файервола или другими сетевыми устройствами).
Если этот NTP сервер не доступен, вы можете использовать другой NTP сервер.
Можно указать
time.nist.gov
или ближайший к вам NTP сервер, который можно получить на сайте
https://www.ntppool.org
.
Можно изменить адрес вашего NTP сервера с помощью командной строки:
w32tm /config /manualpeerlist:time.nist.gov,0x1 /syncfromflags:manual /reliable:yes /update
Перезапустите службу времени (в данном примере вы запустим несколько команд в одну строку):
net stop w32time && net start w32time
Затем выполните синхронизацию времени:
w32tm /config /update
w32tm /resync
Проверьте, что ваш компьютер успешно получил время с нового источника времени (NTP сервера):
w32tm /query /status
Если ничего не помогло, попробуйте полностью сбросить настройки службы Windows Time:
net stop w32time
w32tm /unregister
w32tm /register
net start w32time
Выполните синхронизацию времени:
w32tm /resync
Также вы можете добавить NTP сервер в список серверов времени и выполнить синхронизацию из панели управления Windows. Перейдите в Settings -> Time & language -> Date & time -> Additional clocks –> Internet Time
Убедитесь, что включена опцию Synchronize with an Internet time, добавьте новый сервер time.nist.gov и нажмите кнопку Update Now.
Вы можете добавить NTP сервера в этот список через реестр HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionDateTimeServers.
Для автоматической синхронизации времени в Windows используется отдельно задание в планировщике Task Scheduler. Запустите консоль taskschd.msc и перейдите в раздел Task Scheduler (Local) -> Task Scheduler Library -> Microsoft -> Windows -> Time Synchronization. Проверьте, что задание SynchronizeTime включено.
Также вы можете проверить состояние задания Task Scheduler с помощью PowerShell:
Get-ScheduledTask SynchronizeTime
Чтобы включить его:
Get-ScheduledTask SynchronizeTime|Enable-ScheduledTask
The performance of the w32time
(“Windows Time”) service as NTP client depends strongly on the w32time
software version, which in turn depends on the Windows version it was shipped with.
Only w32time
versions shipped with Windows Server 2016, Windows 10 version 1607, or later can achieve an accuracy that sounds reasonable.
If a Windows machine gets the time from an NTP server on the network, it acts just as a client of that server, and should send normal NTP “client” request packets to the server, so that the server sends an NTP “server” response packet back.
However, by default some older w32time
services (e.g. the ones shipped with Windows XP and Server 2003) send NTPv3 “symmetric active peer” packets instead of “client” mode packets, and normally the NTP daemon (ntpd
) as an NTP server should not even reply to such packets, unless the “symmetric active” packet really comes from an authenticated peer.
So back in 2002 a workaround was implemented in ntpd
where it doesn’t mobilize a peer association unless the request comes from an authenticated peer, but anyway sends a reply, just to satisfy those w32time
clients.
In June 2018 there was a change in the source code of ntpd
to fix a different problem, and this change unintentionally disabled the workaround mentioned above. Once this had been noticed by users, the workaround was enabled again, and thus the subsequent patch release ntp-4.2.8p12
works again as it has been for many years.
The version of ntpd
where the workaround for w32time
clients was unintentionally disabled was shipped with LANTIME firmware versions 6.24.013 and 6.24.014. So this should work properly with all older LANTIME firmware versions, and with LANTIME firmware version 6.24.015 or newer.
Anyway, the proper fix would be to configure the w32time
service on the Windows machines in a way that it sends “client” requests to the server, as expected by the NTP standards.
This is described in the next chapter.
w32time
is the name of the service shipped with Windows, which is normally configured automatically to query the time from a domain controller in an Active Directory domain,
if the machine is a member of an AD domain, or from one of Microsoft’s public NTP servers which can be accessed via time.microsoft.com
,
if the machine is a standalone machine or an AD domain controller.
The w32tm
command, however, is an utility program that can be run in a console (cmd) window with administrator privileges to configure and monitor the w32time
service.
The following commands can be used to specify the host name or IP address of an external NTP server to be queried, and check the current settings.
When specifying an NTP server, it may be required to add a specific flag to the host name or IP address, even though this is poorly documented by Microsoft.
According to the Microsoft documentation at
the following flags are supported:
0x1 | SpecialInterval | Wait the for the special interval instead of the standard interval before sending the next query, see Registry Settings |
---|---|---|
0x2 | UseAsFallbackOnly | Use the specified NTP server as fallback only |
0x4 | SymmatricActive | Force sending symmetric active peer requests to the specified NTP server |
0x8 | Client | Force sending client requests to the specified NTP server |
As already mentioned above, some versions of w32time
used to send symmetric active peer
requests to NTP servers by default, but if the NTP server runs the standard NTP software (ntpd
),
the server may not reply to such unauthenticated peer requests at all. The normal behavior is to send client
requests to a server, in which case the server
sends a server
reply.
So it’s safe to use flag 0x8
, or a combination of other flags with 0x8
, if required. E.g., 0x8
and 0x1
would result in a flag 0x9
.
So actually the following command can be used to specify a single server:
w32tm /config /manualpeerlist:[server],0x8 /syncfromflags:MANUAL /update
Of course the IP address or the DNS hostname of the NTP server has to be entered instead of [server], and the flag 0x8
is appended after a comma, as explained above.
If several servers are to be configured for redundancy then the servers specified by /manualpeerlist
have to be
separated by a space, so the whole parameter has to be enclosed in double quotes:
w32tm /config /manualpeerlist:“[server1],0x8 [server2],0x8” /syncfromflags:MANUAL /update
The parameter /update
makes sure the changes immediately become effective.
The following command can be used e.g. on Windows 7 / Server 2012 and later to check the list of servers (actually always labelled peers
) that are currently in use:
w32tm /query /peers
The output of this command also shows a mode
for each specified server/peer, which should be 3 (Client)
in most cases.
For other options of the w32tm
command please see the usage information displayed if the command is run without any parameter.
In Windows XP and Server 2003 a different command had to be used to check the configured NTP servers:
net time /querysntp
The following settings are required on every node that runs w32time
to achieve the best results:
Registry Key | Value |
---|---|
MinPollInterval | 6 |
MaxPollInterval | 6 |
UpdateInterval | 100 |
SpecialPollInterval | 64 |
FrequencyCorrectRate | 2 |
These parameters are determined by registry settings, or via the some group policies. See the WARNING section on this web page:
which contains links to
Also:
The problem that w32time
sends “symmetric active” requests by default has been brought up by Dave Mills in the NTP news group back in 2002:
In another post of that thread, Dave Mills said he had implemented a workaround in ntpd
:
The problem was discussed once more in 2008, where Dave Mills said that
ntpd
should just send a “symmetric passive” reply back to such clients, but
should not mobilize an association:
— Martin Burnicki martin.burnicki@meinberg.de, last updated 2022-08-17