NTP: Server Time Sync

From Kolmisoft Wiki
Jump to navigationJump to search

Installing NTP client

To sync time on server , you need ntpdate utility.

On Centos: yum install ntp

On debian: apt-get install ntpdate


So we can sync time with public NTP server: ntpdate pool.ntp.org


Make periodically sync time:

touch /var/log/ntpdate.log
crontab -e

and insert:

04 0,8,16 * * * root ntpdate pool.ntp.org >>/var/log/ntpdate.log <Press ENTER>

And save. That's all



NOTE: Special script installs all this when MOR is installed.


Troubleshooting

Please ensure that both TCP and UDP protocols have port 123 opened.

Try to run ntpdate in debug mode:

ntpdate -d pool.ntp.org

In normal case output should be:

[root@node01 ~]# ntpdate -d pool.ntp.org
18 Mar 14:16:40 ntpdate[30259]: ntpdate 4.2.2p1@1.1570-o Sat Dec 19 00:58:17 UTC 2009 (1)
Looking for host pool.ntp.org and service ntp
host found : ns2.telecom.lt
transmit(212.59.0.2)
receive(212.59.0.2)
transmit(212.59.0.2)
receive(212.59.0.2)
transmit(212.59.0.2)
receive(212.59.0.2)
transmit(212.59.0.2)
receive(212.59.0.2)
transmit(212.59.0.2)
transmit(88.222.88.11)
receive(88.222.88.11)
transmit(88.222.88.11)
receive(88.222.88.11)
transmit(88.222.88.11)
receive(88.222.88.11)
transmit(88.222.88.11)
receive(88.222.88.11)
transmit(88.222.88.11)
server 212.59.0.2, port 123
stratum 4, precision -20, leap 00, trust 000
refid [212.59.0.2], delay 0.02950, dispersion 0.00000
transmitted 4, in filter 4
reference time:    d1330728.fc987987  Tue, Mar 22 2011 13:31:52.986
originate timestamp: d1330c2e.7f1e006f  Tue, Mar 22 2011 13:53:18.496
transmit timestamp:  d12dcba9.135147f1  Fri, Mar 18 2011 14:16:41.075
filter delay:  0.03065  0.02950  0.03056  0.03056 
        0.00000  0.00000  0.00000  0.00000 
filter offset: 344197.4 344197.4 344197.4 344197.4
        0.000000 0.000000 0.000000 0.000000
delay 0.02950, dispersion 0.00000
offset 344197.417828

server 88.222.88.11, port 123
stratum 2, precision -20, leap 00, trust 000
refid [88.222.88.11], delay 0.03140, dispersion 0.00000
transmitted 4, in filter 4
reference time:    d13307fd.89b3ce29  Tue, Mar 22 2011 13:35:25.537
originate timestamp: d1330c2e.c91d6139  Tue, Mar 22 2011 13:53:18.785
transmit timestamp:  d12dcba9.4e73e681  Fri, Mar 18 2011 14:16:41.306
filter delay:  0.04402  0.03140  0.03856  0.04202 
        0.00000  0.00000  0.00000  0.00000 
filter offset: 344197.4 344197.4 344197.4 344197.4
        0.000000 0.000000 0.000000 0.000000
delay 0.03140, dispersion 0.00000
offset 344197.462460

18 Mar 14:16:41 ntpdate[30259]: step time server 88.222.88.11 offset 344197.462460 sec