Сложности с синхронизацией по NTP

Автор Nyancat, 20 ноября 2017, 15:45:10

« назад - далее »

0 Пользователи и 1 гость просматривают эту тему.

Nyancat

Здравствуйте.
Пытаюсь уже длительное время настроить ntpdate.
Собственно несколько недель назад установил apt-get install ntp ntpdate
И вот вроде по всем инструкциям всё максимально просто, но в результате не могу убедиться, нормально ли оно работает.
ntp.conf:
Открыть содержимое (спойлер)

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift

# Enable this if you want statistics to be logged.
statsdir /var/log/ntpstats/

logfile /var/log/ntp.log

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable


# You do need to talk to an NTP server or two (or three).
#server ntp.your-provider.example

# pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
# pick a different set every time it starts up.  Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>

server 0.ru.pool.ntp.org iburst
server 1.ru.pool.ntp.org iburst
server 2.ru.pool.ntp.org iburst
server 3.ru.pool.ntp.org iburst


# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Needed for adding pool entries
restrict source notrap nomodify noquery

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient
[свернуть]
ntp.log:
Открыть содержимое (спойлер)

15 Nov 11:03:21 ntpd[818]: Listen and drop on 0 v6wildcard [::]:123
15 Nov 11:03:21 ntpd[818]: Listen and drop on 1 v4wildcard 0.0.0.0:123
15 Nov 11:03:21 ntpd[818]: Listen normally on 2 lo 127.0.0.1:123
15 Nov 11:03:21 ntpd[818]: Listen normally on 3 eth0 192.168.88.250:123
15 Nov 11:03:21 ntpd[818]: Listen normally on 4 lo [::1]:123
15 Nov 11:03:21 ntpd[818]: Listen normally on 5 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
15 Nov 11:03:21 ntpd[818]: Listening on routing socket on fd #22 for interface updates
15 Nov 11:05:06 ntpd[1371]: unable to bind to wildcard address :: - another process may be running - EXITING
15 Nov 11:05:15 ntpd[1374]: unable to bind to wildcard address :: - another process may be running - EXITING
15 Nov 11:33:36 ntpd[2172]: unable to bind to wildcard address :: - another process may be running - EXITING
15 Nov 11:46:00 ntpd[818]: ntpd exiting on signal 15 (Terminated)
15 Nov 11:46:00 ntpd[818]: 216.239.35.0 local addr 192.168.88.250 -> <null>
15 Nov 11:46:01 ntpd[2406]: Listen and drop on 0 v6wildcard [::]:123
15 Nov 11:46:01 ntpd[2406]: Listen and drop on 1 v4wildcard 0.0.0.0:123
15 Nov 11:46:01 ntpd[2406]: Listen normally on 2 lo 127.0.0.1:123
15 Nov 11:46:01 ntpd[2406]: Listen normally on 3 eth0 192.168.88.250:123
15 Nov 11:46:01 ntpd[2406]: Listen normally on 4 lo [::1]:123
15 Nov 11:46:01 ntpd[2406]: Listen normally on 5 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
15 Nov 11:46:01 ntpd[2406]: Listening on routing socket on fd #22 for interface updates
15 Nov 11:46:18 ntpd[2406]: ntpd exiting on signal 15 (Terminated)
15 Nov 11:46:18 ntpd[2406]: 216.239.35.0 local addr 192.168.88.250 -> <null>
15 Nov 11:47:17 ntpd[698]: Listen and drop on 0 v6wildcard [::]:123
15 Nov 11:47:17 ntpd[698]: Listen and drop on 1 v4wildcard 0.0.0.0:123
15 Nov 11:47:17 ntpd[698]: Listen normally on 2 lo 127.0.0.1:123
15 Nov 11:47:17 ntpd[698]: Listen normally on 3 eth0 192.168.88.250:123
15 Nov 11:47:17 ntpd[698]: Listen normally on 4 lo [::1]:123
15 Nov 11:47:17 ntpd[698]: Listen normally on 5 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
15 Nov 11:47:17 ntpd[698]: Listening on routing socket on fd #22 for interface updates
15 Nov 23:41:37 ntpd[7600]: unable to bind to wildcard address :: - another process may be running - EXITING
16 Nov 00:17:42 ntpd[698]: Deleting interface #3 eth0, 192.168.88.250#123, interface stats: received=109, sent=109, dropped=0, active_time=45024 secs
16 Nov 00:17:42 ntpd[698]: 216.239.35.0 local addr 192.168.88.250 -> <null>
16 Nov 00:17:42 ntpd[698]: Deleting interface #5 eth0, fe80::92fb:a6ff:fee6:603e%2#123, interface stats: received=0, sent=0, dropped=0, active_time=45024 secs
16 Nov 00:27:24 ntpd[698]: ntpd exiting on signal 15 (Terminated)
16 Nov 00:27:24 ntpd[8194]: Listen and drop on 0 v6wildcard [::]:123
16 Nov 00:27:24 ntpd[8194]: Listen and drop on 1 v4wildcard 0.0.0.0:123
16 Nov 00:27:24 ntpd[8194]: Listen normally on 2 lo 127.0.0.1:123
16 Nov 00:27:24 ntpd[8194]: Listen normally on 3 lo [::1]:123
16 Nov 00:27:24 ntpd[8194]: Listening on routing socket on fd #20 for interface updates
16 Nov 08:15:38 ntpd[8194]: Listen normally on 4 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
16 Nov 08:15:56 ntpd[8194]: Deleting interface #4 eth0, fe80::92fb:a6ff:fee6:603e%2#123, interface stats: received=0, sent=0, dropped=0, active_time=18 secs
16 Nov 08:16:03 ntpd[8194]: Listen normally on 5 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
16 Nov 08:18:32 ntpd[8194]: ntpd exiting on signal 15 (Terminated)
16 Nov 08:18:32 ntpd[10372]: Listen and drop on 0 v6wildcard [::]:123
16 Nov 08:18:32 ntpd[10372]: Listen and drop on 1 v4wildcard 0.0.0.0:123
16 Nov 08:18:32 ntpd[10372]: Listen normally on 2 lo 127.0.0.1:123
16 Nov 08:18:32 ntpd[10372]: Listen normally on 3 eth0 192.168.88.250:123
16 Nov 08:18:32 ntpd[10372]: Listen normally on 4 lo [::1]:123
16 Nov 08:18:32 ntpd[10372]: Listen normally on 5 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
16 Nov 08:18:32 ntpd[10372]: Listening on routing socket on fd #22 for interface updates
16 Nov 21:53:58 ntpd[10372]: Deleting interface #3 eth0, 192.168.88.250#123, interface stats: received=106, sent=106, dropped=0, active_time=48926 secs
16 Nov 21:53:58 ntpd[10372]: 216.239.35.0 local addr 192.168.88.250 -> <null>
16 Nov 21:53:58 ntpd[10372]: Deleting interface #5 eth0, fe80::92fb:a6ff:fee6:603e%2#123, interface stats: received=0, sent=0, dropped=0, active_time=48926 secs
16 Nov 21:54:01 ntpd[10372]: Listen normally on 6 eth0 192.168.88.250:123
16 Nov 21:54:01 ntpd[10372]: Listen normally on 7 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
16 Nov 21:54:18 ntpd[10372]: Deleting interface #6 eth0, 192.168.88.250#123, interface stats: received=0, sent=1, dropped=0, active_time=17 secs
16 Nov 21:54:18 ntpd[10372]: 216.239.35.0 local addr 192.168.88.250 -> <null>
16 Nov 21:54:18 ntpd[10372]: Deleting interface #7 eth0, fe80::92fb:a6ff:fee6:603e%2#123, interface stats: received=0, sent=0, dropped=0, active_time=17 secs
16 Nov 21:54:26 ntpd[10372]: Listen normally on 8 eth0 192.168.88.250:123
16 Nov 21:54:26 ntpd[10372]: Listen normally on 9 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
16 Nov 23:46:51 ntpd[10372]: ntpd exiting on signal 15 (Terminated)
16 Nov 23:46:51 ntpd[10372]: 216.239.35.0 local addr 192.168.88.250 -> <null>
16 Nov 23:47:51 ntpd[678]: Listen and drop on 0 v6wildcard [::]:123
16 Nov 23:47:51 ntpd[678]: Listen and drop on 1 v4wildcard 0.0.0.0:123
16 Nov 23:47:51 ntpd[678]: Listen normally on 2 lo 127.0.0.1:123
16 Nov 23:47:51 ntpd[678]: Listen normally on 3 lo [::1]:123
16 Nov 23:47:51 ntpd[678]: Listen normally on 4 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
16 Nov 23:47:51 ntpd[678]: Listening on routing socket on fd #21 for interface updates
16 Nov 23:47:54 ntpd[678]: ntpd exiting on signal 15 (Terminated)
16 Nov 23:47:54 ntpd[767]: Listen and drop on 0 v6wildcard [::]:123
16 Nov 23:47:54 ntpd[767]: Listen and drop on 1 v4wildcard 0.0.0.0:123
16 Nov 23:47:54 ntpd[767]: Listen normally on 2 lo 127.0.0.1:123
16 Nov 23:47:54 ntpd[767]: Listen normally on 3 eth0 192.168.88.250:123
16 Nov 23:47:54 ntpd[767]: Listen normally on 4 lo [::1]:123
16 Nov 23:47:54 ntpd[767]: Listen normally on 5 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
16 Nov 23:47:54 ntpd[767]: Listening on routing socket on fd #22 for interface updates
17 Nov 01:06:58 ntpd[767]: Deleting interface #3 eth0, 192.168.88.250#123, interface stats: received=53, sent=53, dropped=0, active_time=4744 secs
17 Nov 01:06:58 ntpd[767]: 216.239.35.0 local addr 192.168.88.250 -> <null>
17 Nov 01:06:58 ntpd[767]: Deleting interface #5 eth0, fe80::92fb:a6ff:fee6:603e%2#123, interface stats: received=0, sent=0, dropped=0, active_time=4744 secs
17 Nov 01:13:39 ntpd[767]: ntpd exiting on signal 15 (Terminated)
17 Nov 01:13:39 ntpd[2494]: Listen and drop on 0 v6wildcard [::]:123
17 Nov 01:13:39 ntpd[2494]: Listen and drop on 1 v4wildcard 0.0.0.0:123
17 Nov 01:13:39 ntpd[2494]: Listen normally on 2 lo 127.0.0.1:123
17 Nov 01:13:39 ntpd[2494]: Listen normally on 3 lo [::1]:123
17 Nov 01:13:39 ntpd[2494]: Listening on routing socket on fd #20 for interface updates
17 Nov 10:22:04 ntpd[2494]: Listen normally on 4 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
17 Nov 10:22:21 ntpd[2494]: Deleting interface #4 eth0, fe80::92fb:a6ff:fee6:603e%2#123, interface stats: received=0, sent=0, dropped=0, active_time=17 secs
17 Nov 10:22:29 ntpd[2494]: Listen normally on 5 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
17 Nov 10:27:03 ntpd[2494]: ntpd exiting on signal 15 (Terminated)
17 Nov 10:27:03 ntpd[4935]: Listen and drop on 0 v6wildcard [::]:123
17 Nov 10:27:03 ntpd[4935]: Listen and drop on 1 v4wildcard 0.0.0.0:123
17 Nov 10:27:03 ntpd[4935]: Listen normally on 2 lo 127.0.0.1:123
17 Nov 10:27:03 ntpd[4935]: Listen normally on 3 eth0 192.168.88.250:123
17 Nov 10:27:03 ntpd[4935]: Listen normally on 4 lo [::1]:123
17 Nov 10:27:03 ntpd[4935]: Listen normally on 5 eth0 [fe80::92fb:a6ff:fee6:603e%2]:123
17 Nov 10:27:03 ntpd[4935]: Listening on routing socket on fd #22 for interface updates
17 Nov 20:39:45 ntpd[4935]: ntpd exiting on signal 15 (Terminated)
17 Nov 20:39:45 ntpd[4935]: 216.239.35.0 local addr 192.168.88.250 -> <null>
20 Nov 02:13:17 ntpd[3121]: unable to bind to wildcard address :: - another process may be running - EXITING
20 Nov 08:16:56 ntpd[4910]: unable to bind to wildcard address :: - another process may be running - EXITING
[свернуть]

При вводе
ntpq -p
выводит:

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*time1.google.co .GOOG.           1 u  363 1024  377  138.223   -0.967   1.697


Вот всё бы ок, но только нигде на сервере я не прописывал гугловский ntp сервер, а в конфиге прописаны только:

server 0.ru.pool.ntp.org iburst
server 1.ru.pool.ntp.org iburst
server 2.ru.pool.ntp.org iburst
server 3.ru.pool.ntp.org iburst


Почему же он показывает только один сервер гугла, вместо четырёх перечисленных?

Время то вроде правильное на сервере, но всё равно  работает всё как-то подозрительно.

Спустя несколько дней вспомнил, что вводил этот адрес ntp сервера в роутер Microtik. Скриншот во вложении. Мб оттуда берёт адрес? О_о

Вопросы:
Почему он не использует адреса из конфига?
Что значат ошибки в конце лога?
Как понять, работает ли автоматическая синхронизация вообще, и будет ли дальше стабильно работать?

ОС Debain 9

Заранее благодарен за ответы.

[offtopic]Впервые столкнулся с проблемой в Debain,
которую не смог решить с помощью гугла :( [/offtopic]

yoric

#1
Эти ntp[d|date] очень капризные в настройке были в моё время, то то не того, то того не этого. И с документацией глухо. Гораздо проще настроить systemd-шный встроенный ntp-клиент, или если раздавать надо, openntpd.

Вот конфиг openntpd и сервера для разнообразия:
# $OpenBSD: ntpd.conf,v 1.3 2015/05/18 11:10:03 dtucker Exp $
# sample ntpd configuration file, see ntpd.conf(5)

# Addresses to listen on (ntpd does not listen by default)
#listen on *

# sync to a single server
#server ntp.example.org

# use a random selection of NTP Pool Time Servers
# see http://support.ntp.org/bin/view/Servers/NTPPoolServers
#servers pool.ntp.org

# use a specific local timedelta sensor (radio clock, etc)
#sensor nmea0

# use all detected timedelta sensors
#sensor *

# get the time constraint from a well-known HTTPS site
#constraints from "https://www.google.com/"

# Choose servers announced from Gentoo NTP Pool
#servers 0.gentoo.pool.ntp.org
#servers 1.gentoo.pool.ntp.org
servers 2.gentoo.pool.ntp.org
#servers 3.gentoo.pool.ntp.org

servers 2.debian.pool.ntp.org
servers ntp21.vniiftri.ru
servers ntp1.aas.ru
servers 1.pool.ntp.org
servers ntp.mobatime.ru