Eu preciso criar um dispositivo (atualmente baseado no Raspberry Pi 3) que declara como NTP Server, ele não tem conexão com a Internet e o NTP deve ler o tempo real do relógio do sistema local (esse relógio é definido a partir do aplicativo). Meu /etc/ntp.conf é:
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
restrict ::1
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 1
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log
Ao testar a conexão (após service ntp restart
) com o comando ntpdate -du localhost
, recebo esta saída:
transmit(::1)
receive(::1)
transmit(127.0.0.1)
receive(127.0.0.1)
transmit(::1)
receive(::1)
transmit(127.0.0.1)
receive(127.0.0.1)
transmit(::1)
receive(::1)
transmit(127.0.0.1)
receive(127.0.0.1)
transmit(::1)
receive(::1)
transmit(127.0.0.1)
receive(127.0.0.1)
::1: Server dropped: strata too high
127.0.0.1: Server dropped: strata too high
server ::1, port 123
stratum 16, precision -20, leap 11, trust 000
refid [::1], delay 0.02573, dispersion 0.00000
transmitted 4, in filter 4
reference time: 00000000.00000000 Thu, Feb 7 2036 6:28:16.000
originate timestamp: ddbf0da9.473a860b Tue, Nov 21 2017 20:40:09.278
transmit timestamp: ddbf0da9.47320583 Tue, Nov 21 2017 20:40:09.278
filter delay: 0.02579 0.02573 0.02574 0.02573
0.00000 0.00000 0.00000 0.00000
filter offset: 0.000018 -0.00001 -0.00000 -0.00001
0.000000 0.000000 0.000000 0.000000
delay 0.02573, dispersion 0.00000
offset -0.000011
server 127.0.0.1, port 123
stratum 16, precision -20, leap 11, trust 000
refid [127.0.0.1], delay 0.02570, dispersion 0.00000
transmitted 4, in filter 4
reference time: 00000000.00000000 Thu, Feb 7 2036 6:28:16.000
originate timestamp: ddbf0da9.7a812105 Tue, Nov 21 2017 20:40:09.478
transmit timestamp: ddbf0da9.7a7990a1 Tue, Nov 21 2017 20:40:09.478
filter delay: 0.02571 0.02570 0.02570 0.02570
0.00000 0.00000 0.00000 0.00000
filter offset: -0.00000 -0.00001 -0.00001 -0.00001
0.000000 0.000000 0.000000 0.000000
delay 0.02570, dispersion 0.00000
offset -0.000013
21 Nov 20:40:09 ntpdate[1181]: no server suitable for synchronization found
O que estou fazendo de errado? Por que ntp
não recebe tempo do relógio do sistema?