Настройка ntpd помогите

Обсуждение настройки и работы сервисов, резервирования, сетевых настроек и вопросов безопасности ОС.

Модераторы: SLEDopit, Модераторы разделов

Arthes
Сообщения: 282
ОС: OS X Yosemite and CentOS

Настройка ntpd помогите

Сообщение Arthes »

На данный момент синхронизирую время с пом крон каждую минуту.
Но по идее правильнее делать это с пом ntpd.

Вот ntp.conf

Код: Выделить всё

[root@localhost etc]# cat ntp.conf
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).

#broadcast 192.168.1.255 autokey        # broadcast server
#broadcastclient                        # broadcast client
#broadcast 224.0.1.1 autokey            # multicast server
#multicastclient 224.0.1.1              # multicast client
#manycastserver 239.255.254.254         # manycast server
#manycastclient 239.255.254.254 autokey # manycast client

# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
#server 127.127.1.0     # local clock
#fudge  127.127.1.0 stratum 10

# Enable public key cryptography.
#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys

# Specify the key identifiers which are trusted.
#trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.
#requestkey 8

# Specify the key identifier to use with the ntpq utility.
#controlkey 8

# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats
##server 0.fedora.pool.ntp.orgx dynamic
##server 1.fedora.pool.ntp.orgx dynamic
##server 2.fedora.pool.ntp.orgx dynamic
server 0.ru.pool.ntp.org dynamic


И есчо

Код: Выделить всё

[root@localhost etc]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 petrel.telecom. 192.36.143.150   2 u   22   64   77   24.895  191794. 124241.


Во первых не совсем понятно почему pertel.telecom когда выствлен совсем другой адрес...
А во вторых время стало отставать! Как же мне сделать чтобы оно с пом ntpd синхронизировалось каждую минуту?
Спасибо сказали:
skor
Сообщения: 419
ОС: RTFM-OS v127.0.0.1

Re: Настройка ntpd помогите

Сообщение skor »

Код: Выделить всё

$ host ru.pool.ntp.org
ru.pool.ntp.org has address 217.172.21.161
ru.pool.ntp.org has address 77.108.65.40
ru.pool.ntp.org has address 85.21.78.6
ru.pool.ntp.org has address 88.212.197.86
ru.pool.ntp.org has address 194.33.191.69

Код: Выделить всё

host 217.172.21.161
161.21.172.217.in-addr.arpa domain name pointer telemost.zx.pp.ru.
Спасибо сказали:
Arthes
Сообщения: 282
ОС: OS X Yosemite and CentOS

Re: Настройка ntpd помогите

Сообщение Arthes »

хорошо... Но как тогда задать переодичность синхронизации?

P.S. адрес все равно этого не вижу в выводе данной команды.
Спасибо сказали:
Аватара пользователя
SyCraft
Сообщения: 8
ОС: ubuntu

Re: Настройка ntpd помогите

Сообщение SyCraft »

у меня так

Сервер linux


/etc/ntp.conf

Код: Выделить всё

server europe.pool.ntp.org
server europe.pool.ntp.org
server europe.pool.ntp.org
server europe.pool.ntp.org
server europe.pool.ntp.org

driftfile /var/lib/ntp/drift
logfile /var/log/ntp.log

restrict 127.0.0.1
restrict 192.168.x.x mask 255.255.255.0 nomodify notrap


Клиент linux

/etc/ntp.conf

Код: Выделить всё

server 192.168.0.1
restrict default ignore
restrict 127.0.0.1
restrict 192.168.0.1 mask 255.255.255.255 nomodify notrap noquery
driftfile /var/lib/ntp/drift
logfile /var/log/ntp.log


Клиент Windows

go.cmd

Код: Выделить всё

net stop w32time
net time /setsntp:192.168.0.1
net time /querysntp
regedit /s run.reg
net start w32time
sc config w32time start = auto
w32tm /resync
net start w32time


run.reg

Код: Выделить всё

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers]
@="1"
"1"="192.168.0.1"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config]
"UpdateInterval"=dword:00057e40

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters]
"NtpServer"="192.168.0.1"
"Type"="NTP"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient]
"Enabled"=dword:00000001
"SpecialPollInterval"=dword:00000384

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer]
"Enabled"=dword:00000001
Сделай то что хочешь из того что нравится!
Спасибо сказали:
skor
Сообщения: 419
ОС: RTFM-OS v127.0.0.1

Re: Настройка ntpd помогите

Сообщение skor »

Arthes писал(а):
18.05.2009 15:00
хорошо... Но как тогда задать переодичность синхронизации?

P.S. адрес все равно этого не вижу в выводе данной команды.

minpoll x
maxpoll x

где x значит:
4 - 16 sec
5 - 32 sec
6 - 64 sec (дефолтное minpool)
7 - 128 sec
8 - 256 sec
9 - 512 sec
10 - 1024 sec (дефолтное maxpool)
11 - 2048 sec
12 - 4096 sec
13 - 8192 sec
14 - 16384 sec
Зачем вам менять эти значения то?
NTP подстраивает скорость часов так чтоб они шли синхронно с сервером, чем синхронее время у клиента и сервера, тем больше время между запросами.
Если надо сразу засинхроинизровать время ("скачком", а не как ntpd - плавным регулированием скорости хода часов) то используйте команду ntpdate ru.pool.ntp.org (предварительно остановив ntpd)

попробуйте запускать команду ntpq с ключем -n (чтоб видеть адреса в числовом виде, и уже поискать сервера по адресам а не по именам)
Спасибо сказали:
Аватара пользователя
KiWi
Бывший модератор
Сообщения: 2521
Статус: статус, статус, статус

Re: Настройка ntpd помогите

Сообщение KiWi »

Arthes писал(а):
18.05.2009 15:00
P.S. адрес все равно этого не вижу в выводе данной команды.

Сервера переходят из пула в пул, так что адреса могут меняться каждый день(мб, чаще/реже)... Мой сервер, например, прямо сейчас обитает в 0.ru.pool.ntp.org, хотя раньше обитал в других...
К тому же -- ru.pool.ntp.org & 0.ru.pool.ntp.org -- разные адреса.
Спасибо сказали: