1

I'd like to synch time on all my laptops inside my local network which use a router but it has no access to public internet so I can't use remote time servers.

I would like to use a laptop to act like a NTP server and make all the other laptops to synch to this NTP server.

I'm trying to use ntp and my ntp.conf file is this one:

# /etc/ntp.conf, file di configurazione for ntpd

# File nel quale scrivere la frequenza di scostamento dal clock di sistema.
driftfile /var/lib/ntp/ntp.drift

# Statistiche
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

#server 2.it.pool.ntp.org iburst
#server 1.europe.pool.ntp.org iburst
#server 3.europe.pool.ntp.org iburst

server 192.168.1.11 #my NTP server IP address

# È permesso "dialogare" con chiunque (via ipv4 e via ipv6) ma non sono autorizzate configurazioni
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Utenti locali
restrict 127.0.0.1
restrict ::1

but when I run ntpq -p on the NTP server laptop it seems it isn't working:

 sudo ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 Evangelion01    .INIT.          16 u    -   64    0    0.000    0.000   0.000

Can you help me, please? I tried to solve this problem for the whole day by looking on google, but I found nothing useful, unfortunately.

Thank you

12
  • Take a look at chrony. It seems a much friendlier solution.
    – Jos
    Jun 17, 2016 at 15:33
  • I tried to study chrony yesterday, but i didn't understand how to configure it. Do I have to create a configuration file with a set of parameters or do I have to use the default one? Jun 17, 2016 at 15:35
  • consider using your router as a NTP server
    – pfeiffep
    Jun 17, 2016 at 15:38
  • I've read this: chrony.tuxfamily.org/doc/2.3/manual.html#Isolated-networks about chrony but I didn't understand where I have to specify that instructions. Jun 17, 2016 at 15:38
  • 1
    @MarcusBarnet yes you need to edit the configuration file located at /etc/chrony/chrony.conf. I would think that the most relevant lines in your case would be server offline and local stratum 10 to indicate that you want chronyd to act as an independent time server, which clients are allowed to poll over the local network.
    – Jos
    Jun 17, 2016 at 15:45

1 Answer 1

1

This seem to work. The example uses a C-Network on 192.168.x.x the server being 192.168.0.11

You create the following files /etc/npt.conf

  1. on the server

    driftfile /var/lib/ntp/ntp.drift
    server 127.127.0.1    
    fudge  127.127.0.1  stratum 2
    
  2. on all others

    driftfile /var/lib/ntp/ntp.drift
    server 192.168.0.11    
    fudge  127.127.0.1 stratum 3
    

Then restart the service with

 sudo service ntp restart

You set the time on the server only with sudo date --date="15:30 01 jan 2020"

for me that worked fine. A new client needs a few minutes to pick up the time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.