NTP através de uma rede local

0

Eu tenho um servidor: 192.168.0.40 e 4 clientes: 192.168.0.61-192.168.0.64. Os clientes são Raspberry Pis e, portanto, não têm relógio em tempo real. Portanto, o tempo está sempre errado.

Eu segui as instruções aqui para criar arquivos ntp.conf:

servidor:

restrict default nomodify notrap noquery
restrict 127.0.0.1 

# -- CLIENT NETWORK -------
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap

# --- OUR TIMESERVERS ----- 
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 127.127.1.0

# --- NTP MULTICASTCLIENT ---

# --- GENERAL CONFIGURATION ---

# Undisciplined Local Clock.
fudge   127.127.1.0 stratum 9

# Drift file.
driftfile /var/lib/ntp/drift
broadcastdelay  0.008

# Keys file.
keys /etc/ntp/keys

cliente:

restrict default nomodify notrap noquery
restrict 127.0.0.1 

# -- CLIENT NETWORK -------

# --- OUR TIMESERVERS ----- 
# 192.168.1.2 is the address for my timeserver,
# use the address of your own, instead:
server 192.168.0.40 iburst
server  127.127.1.0

# --- NTP MULTICASTCLIENT ---

# --- GENERAL CONFIGURATION ---

# Undisciplined Local Clock.
fudge   127.127.1.0 stratum 12

# Drift file.
driftfile /var/lib/ntp/drift
broadcastdelay  0.008

# Keys file.
keys /etc/ntp/keys

No entanto, o tempo nos clientes ainda está errado (inalterado de antes). Quando tento conectar especificamente ao servidor, o cliente não consegue encontrá-lo. Eles são 100% na mesma sub-rede e os endereços IP estão corretos, pois eu não posso ter problemas.

O resultado do ntpq -c lpeer é:

localhost: timed out, nothing received
***Request timed out

Editar:

sudo ntpdate -u 192.168.0.40:

12 Dec 07:45:09 ntpdate[12815]: no server suitable for synchronization found

Editar 2:

Os clientes estão em uma sub-rede na ethernet e o servidor está conectado em wi-fi. O sistema funciona quando o wifi está desativado. Existe uma maneira de contornar isso?

    
por user2290362 09.02.2015 / 15:05

1 resposta

1

O NTP provavelmente precisa ser reiniciado se você alterar as configurações de rede (o SSH também o faz, por exemplo). Você pode testar se o NTP está ativo e ouvindo usando netstat no servidor e ntpdate no cliente

No servidor:

$ sudo netstat -unlp | grep ntp
udp        0      0 192.168.122.1:123       0.0.0.0:*                 2786/ntpd          
udp        0      0 127.0.0.1:123           0.0.0.0:*                 2786/ntpd       
udp        0      0 0.0.0.0:123             0.0.0.0:*                 2786/ntpd       
udp6       0      0 fe80::4e72:b9ff:fe4:123 :::*                      2786/ntpd       
udp6       0      0 ::1:123                 :::*                      2786/ntpd       
udp6       0      0 :::123                  :::*                      2786/ntpd     

No cliente:

sudo ntpdate <server-ip/hostname>
    
por muru 09.02.2015 / 15:50