Настройка ntp клиента windows

Эта публикация отнесена в архив. Она неактуальна.

OS: Windows 2000/XP/2003/Vista/2008/7.

Задача: настроить Windows системы для получения показателей точного времени с определённых NTP серверов.

Наши NTP серверы будут поддерживать протокол версий 3 (три) и 4 (четыре).
Служба точного времени работает на порту udp:123. Обеспечиваем видимость наших NTP серверов по указанному порту.
Авторизацию при запросе клиентом точного времени у NTP сервера проводить не будем; отношения в сети достаточно доверительные, да и парк активных устройств разномастен — далеко не все могут поддерживать что-то ещё, кроме простого запроса показателей времени.

Пользователям операционных систем Windows XP/2003/2008 придётся проделать ряд манипуляций.

Указать на применяемые NTP серверы (где ntp.local, ntp1.local и так далее — наши NTP серверы):

# w32tm /config /syncfromflags:manual /manualpeerlist:ntp.local,ntp1.local,…,ntpX.local
# w32tm /config /update

Далее, отдать в командной строке указания о выборе приоритетного NTP сервера, перезапуске службы точного времени и принудительной синхронизации времени в NTP сервером:

# net time /setsntp:ntp.local
# net stop w32time && net start w32time
# w32tm /resync

В результате должны получить нечто вроде этого:

Команда синхронизации отправлена на local computer…
Команда выполнена успешно.

Через некоторое время можно проверить журнал событий системы. Если все настроено и отработало верно, то в журнале будет информационное сообщение от источника W32Time с кодом (ID) 35 и текстом «Служба времени выполняет синхронизацию системного времени с источником времени». Если возникли какие-то проблемы, то в журнал будут записаны ошибки с кодами. Поисковая система поможет и в этом.

Для локализации проблемы в командной строке можно выполнить запрос информации о используемом NTP сервере:

# net time /querysntp

Для определения величины расхождения локального времени и времени любого компьютера в сети, можно использовать следующую команду:

# w32tm /stripchart /computer:computer.name

Иногда помогает вульгарная перерегистрация службы времени Windows:

# w32tm /unregister
# w32tm /register

Как вариант, можно настроить синхронизацию времени с помощью графического интерфейса.

Можно указать на применяемые NTP серверы с помощью утилиты regedit.exe:

Запуск утилиты редактирования системного реестра Windows.

Запуск утилиты редактирования системного реестра Windows.

Необходимо пройти в ветку (если её нет — создать) «HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers»:

Переход к ветке параметров синхронизации системного времени Windows.

Переход к ветке параметров синхронизации системного времени Windows.

Создать или изменить строковые параметры с именами «0» и «1» указав в них доменные имена или IP адреса наших NTP серверов:

Корректировка параметров синхронизации системного времени Windows.

Корректировка параметров синхронизации системного времени Windows.

В диалоговом окне настроки параметров даты и времени снять «галочку» инициирования сервиса синхронизации времени, тем самым останавливая соответствующую системную службу:

Отключение службы синхронизации системного времени Windows.

Отключение службы синхронизации системного времени Windows.

Заново активировать систему синхронизации времени и попытаться его синхронизировать с указанными серверами:

Включение службы синхронизации системного времени Windows.

Включение службы синхронизации системного времени Windows.

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

NTP synchronizes clocks on the network.

The network time protocol (NTP) is used on networks to sync the Windows client machine clocks to a server’s clock. This keeps every client computer on your network synchronized with the same network time. It’s beneficial for network administrators who oversee time applications such as employee time cards and scheduling software. You can use the Windows command prompt to set the NTP settings for a client machine on your network.

Step 1

Click the Windows Start button and select «Run.» Enter «cmd» to start the Windows command prompt.

Step 2

Type «net time /querysntp» to view your current network time server. You can resynchronize with this server or add a new server.

Step 3

Type «net time /setsntp:» into the command prompt. Replace «» with your network time server. This is given to you by the network administrator.

Step 4

Type «net stop w32time && net start w32time» into the command prompt. This restarts the time service and synchronizes with your configured time server.

Короткая заметка про настройку NTP клиента в Windows.

Для настройки вручную из cmd можно воспользоваться командами:

C:\>net time /setsntp:<IP-адрес или FQDN-имя NTP-сервера локальной сети>
The command completed successfully.
C:\>net stop w32time
The Windows Time service is stopping.
The Windows Time service was stopped successfully.
C:\>net start w32time
The Windows Time service is starting.
The Windows Time service was started successfully.
C:\>net time /querysntp
The current SNTP value is: <IP-адрес или FQDN-имя NTP-сервера локальной сети>
The command completed successfully.

Или объединить их в bat или cmd скрипт:

@ECHO OFF

:: IP-адрес или FQDN-имя NTP-сервера локальной сети.
SET "NTP_SRV=ntp.domain.ltd"

net time /setsntp:%NTP_SRV%
net stop w32time
net start w32time
net time /querysntp

Ссылки по теме:

  1. NTP Server на Linux (ntpd)

Настройка NTP клиента WINDOWS

net stop w32time 

w32tm /config /syncfromflags:manual /manualpeerlist:»ntp.time.in.ua» 

w32tm /config /reliable:yes 

net start w32time

ntp.time.in.ua — сервер времени

w32tm /resync — синхронизация времени ( если проходит, значит все настроено правильно)

w32tm /query /status — посмотреть настройки

Популярные сообщения из этого блога

Автоматическое обновление Mikrotik

Изображение

  Как все мы знаем, каждое новое обновление mikrotik,  кроме новых функций, также латает дыры в безопастности. Поэтому иметь самую свежую  прошивку, жизненно необходимо. Меня посетила мысль — а можно ли обновлять автоматически? Возможно у кого-то есть более простой способ, буду рад если поделитесь. Вот, что я нашел: заходим и ставим галочку Auto Upgrade Дальше заходим в планировщик и создаем таск по плюсику Добавляем действия system  package  update  set  channel = stable system  package  update check — for — updates system  package  update download system  package  update install Выставляем планировщик раз в сутки. Теперь раз в сутки mikrotik сам будет проверять обновления и, если такие есть, сам установит.

Максимальное количество VPN подключений в Windows

Совсем недавно узнал что в windows есть ограничение по количеству VPN подключений. Открываем PowerShell netsh ras show wanports Получаем что-то вроде: Свойство портов Wan —————— Устройство             : WAN Miniport (SSTP) Используется для           : Номер телефона       : Максимальное число портов      : 2 Свойство портов Wan —————— Устройство             : WAN Miniport (IKEv2) Используется для           : Номер телефона       : Максимальное число портов      : 2 Свойство портов Wan —————— Устройство             : WAN Miniport (L2TP) Используется для           : Номер телефона       : Максимальное число портов      : 2 Свойство портов Wan —————— Устройство         …

Смена раскладки для всех пользователей RDP

  Windows Registry Editor Version 5.00 ; Ветка реестра, отвечающая за языки пользователя, вошедшего в систему. (1- по умолчанию) [HKEY_CURRENT_USER\Keyboard Layout\Preload]  «1»=»00000409″ //английский «2»=»00000419″ //русский «3»=»00000422″  //украинский ; Ветка реестра, отвечающая за сочетания клавиш при переключении языков [HKEY_CURRENT_USER\Keyboard Layout\Toggle]  ; Смeнa coчeтания клaвиш пepeключeния мeжду языкaми ввoдa. (2-CTRL+SHIFT; 1-ALT(слева)+SHIFT; 3-отключен) «Language Hotkey»=»2»  ; Смeнa coчeтания клaвиш пepeключения pacклaдки клaвиaтуpы и переключения между языками «Hotkey»=»2»   ; Смeнa coчeтания клaвиш пepeключения pacклaдки клaвиaтуpы. «Layout Hotkey»=»3»  ; Ветка реестра, отвечающая за языки при входе в систему (ввод логина\пароля) [HKEY_USERS\.DEFAULT\Keyboard Layout\Preload]  «2»=»00000419″ //русский «3»=»000…

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

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Qbittorrent не устанавливается на windows 10
  • Последняя версия windows на сегодняшний день
  • Neutron music player для windows 10
  • Как установить windows 7 с флешки с сохранением данных
  • Gpo windows update server