0

I would like to synchronize the clocks on 10 Ubuntu 16.04 servers all with no internet access. Based on my internet searches, ntp does not seem to be designed for this. What is the easiest way to do this?

2
  • 4
    Using internally a server as a NTP server is ok, like a domain controller provide time for all workstation under it, so choose a important server to host your NTP's role on it. I would choose a server that host a samba/ldap role, to be sure it's the primary server that sync other
    – yagmoth555
    Dec 10, 2019 at 21:34
  • That is exactly why NTP was created. It will keep everything synchronized, but they will all drift the same amount as your master if your master has no better stratum from which it receives time. There are many products that will serve as a good time source for your master, generally from GPS.
    – Ron Maupin
    Dec 11, 2019 at 1:16

3 Answers 3

4

There are radio clock receivers and GPS devices that connect to a PC using a serial connection. You can then use them for time sync. One example of this is here: http://www.rjsystems.nl/en/2100-ntpd-garmin-gps-18-lvc-gpsd.php

2
  • Thank you, but that (new hardware) is not an option. I don't actually need the times to be correct, I just want them to be in sync (so Makefiles work properly).
    – user551744
    Dec 10, 2019 at 21:27
  • 1
    we are not Support enduser. set the time manually with the commands which your os has or let the System go online to use ntp or use a other device with ntp server and sNc from that device
    – djdomi
    Dec 10, 2019 at 21:33
2

I would suggest implementing a ntp server and elect one of your machine as the master for the nine other clients.

For that purpose, chrony is a very nice and lightweight NTP server with tons of options, especially one which is particularly suited for your use: manually entering the time on the server (look after manual ; settime ; smoothtime in the docs).


Installation steps for manual, taken from here:

  1. Install chrony on every machine

    sudo apt install chrony
    
  2. Choose the master host that you set up as a NTP server.

  3. On the server, edit /etc/chrony.conf and make sure it has the following lines:

    driftfile /var/lib/chrony/drift
    local stratum 8
    manual
    allow 192.168.165
    

    Address in allow field is the network or subnet address from which the clients are allowed to connect.

  4. On the clients: edit /etc/chrony.conf and make sure it has the following lines:

    server master iburst
    driftfile /var/lib/chrony/drift
    logdir /var/log/chrony
    log measurements statistics tracking
    
  5. Start and enable chronyd on each host:

    systemctl start chronyd 
    systemctl enable chronyd
    
1
  • The OP is using Ubuntu 16.04, which is a superseded (but still supported) LTS release, and has an old version of chrony which doesn't receive security updates (it's in universe rather than main). So it's better from a support perspective to use ntpd on 16.04. They changed this in Ubuntu 18.04 to make chrony preferred and moved ntp to universe.
    – Paul Gear
    Dec 12, 2019 at 3:49
1

At the risk of repeating the 5 near-identical questions in the related posts list to the right, your Internet research is 100% correct: NTP is not designed for this (because that's not how computer clocks work). Use a stratum 0 clock (probably a GPS receiver, per @Bert's answer) or have bad time.

If you decide to go the route of having bad time, you can use the local clock driver (which is deprecated) and fudge the stratum to be low, as follows:

server 127.127.1.1
fudge 127.127.1.1 stratum 1
3
  • Actually, I had probably solved this multiple times by reading the posts on the right. But! I assumed I was restarting the ntpd daemon when I did "/etc/init.d/ntp restart". That was not the case. I had to list all processes with "ps aux" and manually kill the ntpd process ID, then restart the ntpd daemon. When I finally did that, it worked. Does that many any sense?
    – user551744
    Dec 10, 2019 at 22:24
  • The command you used should restart ntpd just fine, although there were some bugs in this around 16.04 timeframes - are you up-to-date with the latest Ubuntu patches?
    – Paul Gear
    Dec 12, 2019 at 3:50
  • I'm not update with any patches newer then circa 2018-Sep.
    – user551744
    Dec 17, 2019 at 20:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .