NTP Configuration without Internet

17.2k views Asked by At

I am trying to setup a local NTP Server without Internet Connection.

Below is my ntp.conf on Server

# Server 
server 127.127.1.0
fudge 127.127.1.0 stratum 5
broadcast 10.108.190.255

Below is my ntp.conf on Clients

# Clients
server 10.108.190.14
broadcastclient

but my clients are not sync with the server. Output to ntpq -p on Clients show that they are not taking time from the server, and server ip is show at stratum 16

Could any one please help in this issue.

3

There are 3 answers

0
Erikw On BEST ANSWER

The server should use its local clock as the source. A better set up is to use orphan mode for isolated networks which gives you fail-over. Check out the documentation:

http://www.eecis.udel.edu/~mills/ntp/html/orphan.html

0
dfc On

You need to configure the clients with th e prefer keyword. ntpd tries its hardest not to honor local undisciplined clocks in order to prevent screwups.

server 10.108.190.14 prefer

For more information see: http://www.ntp.org/ntpfaq/NTP-s-config-adv.htm#AEN3658

This is all assuming that you have included the full and entire ntp.con and did not leave out any bits about restrict lines.

3
GPrathap On

How about using chrony?

Steps

  1. Install chrony in both your devices

    sudo apt install chrony
    
  2. Let's assume the server IP address 192.168.1.87 then client configuration (/etc/chrony/chrony.conf) as follows:

    server 192.168.1.87 iburst

    keyfile /etc/chrony/chrony.keys

    driftfile /var/lib/chrony/chrony.drift

    log tracking measurements statistics

    logdir /var/log/chrony

  3. Server configuration (/etc/chrony/chrony.conf), assume your client IP is 192.168.1.14

    keyfile /etc/chrony/chrony.keys

    driftfile /var/lib/chrony/chrony.drift

    log tracking measurements statistics

    logdir /var/log/chrony

    local stratum 8

    manual

    allow 192.0.0.0/24 allow 192.168.1.14

  4. Restart chrony in both computers

    sudo systemctl stop chrony

    sudo systemctl start chrony

5.1 Checking on the client-side,

sudo systemctl status chrony

 `**output**:

            июн 24 13:26:42 op-desktop systemd[1]: Starting chrony, an NTP client/server...

            июн 24 13:26:42 op-desktop chronyd[9420]: chronyd version 3.2 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SECHASH +SIGND +ASYNCDNS +IPV6 -DEBUG)

            июн 24 13:26:42 op-desktop chronyd[9420]: Frequency -6.446 +/- 1.678 ppm read from /var/lib/chrony/chrony.drift

            июн 24 13:26:43 op-desktop systemd[1]: Started chrony, an NTP client/server.

            июн 24 13:26:49 op-desktop chronyd[9420]: Selected source 192.168.1.87`

5.1 chronyc tracking output:

        Reference ID    : C0A80157 (192.168.1.87)
        Stratum         : 9
        Ref time (UTC)  : Thu Jun 24 10:50:34 2021
        System time     : 0.000002018 seconds slow of NTP time
        Last offset     : -0.000000115 seconds
        RMS offset      : 0.017948076 seconds
        Frequency       : 5.491 ppm slow
        Residual freq   : +0.000 ppm
        Skew            : 0.726 ppm
        Root delay      : 0.002031475 seconds
        Root dispersion : 0.000664742 seconds
        Update interval : 65.2 seconds
        Leap status     : Normal