Ferramentas do usuário

Ferramentas do site


infra-estrutura:linux:ntp:instalando_configurando_ntp_stratum_zero

Essa é uma revisão anterior do documento!


Instalando e configurando NTP Stratum Zero

Esses dias estava eu navegando na internet visto que vejo o anúncio de um GPS USB, me veio a mente vou comprar para testar construir um servidor NTP com stratum zero. Então comprei chegou hoje da uma olhada na foto do mesmo. :)

Para montagem desse ambiente iremos utilizar o Ubuntu 18.04.1 LTS

Instalando gpsd

Para utilizar esse gps no ntp precisamos instalar o gpsd

apt-get install ntpd gpsd-clients gpsd gpsd-clients

Logo em seguida altere o arquivo /etc/default/gpsd e Altere a seguinte linha

# Other options you want to pass to gpsd
GPSD_OPTIONS=""

Para

# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"

Testando o gps

Para teste do GPS existe um utilitário cgps.

Configurando serviço NTP

Adicione a seguinte linha no arquivo de configuração do NTP (/etc/ntp.conf).

# GPS Serial data reference
server 127.127.28.0 minpoll 4 maxpoll 4
fudge 127.127.28.0 time1 0.0 refid GPS

# GPS PPS reference
server 127.127.28.1 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.1 refid PPS

Logo após adicionar reinicie o serviço NTP

root@cerberus:~# /etc/init.d/ntp restart
[ ok ] Restarting ntp (via systemctl): ntp.service.
root@cerberus:~#

Testando o servidor NTP

Para verificar se o NTP subiu utilize o comando ntpq.

root@cerberus:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.004
 1.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.004
 2.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.004
 3.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.004
 ntp.ubuntu.com  .POOL.          16 p    -   64    0    0.000    0.000   0.004
 SHM(0)          .GPS.            0 l    -   16    0    0.000    0.000   0.004
 SHM(1)          .PPS.            0 l    -   16    0    0.000    0.000   0.004
root@cerberus:~#

Repare as linhas SHM(0) e SHM(1) como .GPS e .PPS com stratum 0. :)