4

Let us assume we have a number of systems connected in a local network and is not connected to the internet. What can be best way to ensure that each of these clocks are in sync? It is not necessary that they be in sync with the UTC time but is enough to be in sync amongst themselves.

I had thought of using NTP, by setting up NTP server in one of the systems. But I need advise as to if that would be much more cumbersome compared to the requirement. Also is it advisable to try to manually compute the round trip time and the server time using TCP sockets?

AvisekS
  • 86
  • 1
  • 5

1 Answers1

0

Solution for a small local network to be synchronized to each other even using an undisciplined local clock of one of the machines can be done in a simple NTP peer network with one setup with the local clock as backup if all real time sources fail.

One example of a multi-server/peer ntp network. Notice how each ntp does not have the same servers listed. This is for better use of the peer sync. So peer sync can match against different time results.

1a  1b     1c  1d     1e  1f      outside
. \ / ...... \ / ...... \ / ..............
   2a ---p--- 2b ---p--- 2c        inside
  /|\        /|\        /|\
 / | \      / | \      / | \
3a 3b 3c   3e 3f 3g   3h 3i 3j

Key: 1 = stratum-1, 2 = stratum-2, 3 = stratum-3, p = peer

Diagram + more info: http://www.ntp.org/ntpfaq/NTP-s-config-adv.htm

ntp server A (myntp.server.a)

# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server 127.127.1.0
fudge 127.127.1.0 stratum 10

server 0.pool.ntp.org iburst 
server 1.pool.ntp.org iburst 
peer myntp.server.b
peer myntp.server.c

ntp server B (myntp.server.b)

server 2.pool.ntp.org iburst 
server 3.pool.ntp.org iburst
peer myntp.server.a
peer myntp.server.c

If ONE server (e.g. myntp.server.a) ran a local clock, everything would sync to that - however bad - but at least the clocks on the network would stay together.

Should also consider OrphanMode as a means of keeping an isolated group of servers synchronized. It was added to ntp-4.2.2.

CodeMonkey
  • 22,825
  • 4
  • 35
  • 75