ntpd não atualiza o horário correto

3

Tentando configurar meu servidor Ubuntu para sincronizar com o pool.ntp.org. Seguindo este guia link .

Eu configurei meu ntp.conf da seguinte forma

cat /etc/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/

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 0.north-america.pool.ntp.org
server 1.north-america.pool.ntp.org
server 2.north-america.pool.ntp.org
server 3.north-america.pool.ntp.org


# 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
restrict -6 default kod notrap nomodify nopeer noquery

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

# 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

Depois atualizei o sistema para longe

date -s "2 OCT 2006 18:00:00"

E tentou reiniciar o ntpd e a hora ainda é 2006.

ntpq --peers; date
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 dev1-c.sje007.i 209.81.9.7       2 b   48   64  177   80.623  1205991 1100914
 ox.eicat.ca     139.78.135.14    2 b   18   64  377   24.743  1205991 1019249
 ntp1.Housing.Be 169.229.128.214  3 b   62   64  177   94.714   -5.160 6962796
 ns1.your-site.c 10.1.5.2         3 b   26   64  177   10.913   -9.521 6962796
Mon Oct  2 18:02:29 UTC 2006

Por que o ntp não se comporta?

    
por Maxim Veksler 29.07.2010 / 15:46

2 respostas

4

Acima de uma certa diferença entre a hora local e a hora da piscina, o ntp irá "executar" a atualização, ou seja, realizar pequenas alterações o tempo todo. Isso é para que o comportamento do seu sistema não salte completamente dos blocos. Aqui está um extrato da página man:

 -x     Normally, the time is slewed if the offset is less than the step threshold, which is 128 ms by default, and stepped if above the threshold.
              This  option sets the threshold to 600 s, which is well within the accuracy window to set the clock manually.  Note: Since the slew rate of
              typical Unix kernels is limited to 0.5 ms/s, each second of adjustment requires an amortization interval of 2000 s.  Thus, an adjustment as
              much  as 600 s will take almost 14 days to complete.  This option can be used with the -g and -q options.  Note: The kernel time discipline
              is disabled with this option.

Com a sua diferença de horário atual, levará muito tempo para recuperar o atraso. Sugiro que você faça uma alteração manual para uma diferença menor e observe se isso está funcionando.

    
por 29.07.2010 / 16:20
0

Talvez o ntpd ajuste o tempo devagar ou haja algumas errores, procure em /var/log/daemon.log ou / var / log / syslog ( grep -i ntpd /var/log/daemon.log ).

Uma solução rápida é adicionar um trabalho agendado ntpdate 0.pool.ntp.org

    
por 29.07.2010 / 15:51

Tags