NTP
Installation
_$: apt-get install ntpdate ntp
ntpdate
runs once at boot time. After that, ntpd
synchronizes the clock. It is, therefore, not necessary to periodically run ntpdate
to fix the clock (i.e: don’t use cron
and ntpdate
to do what is already doing ntp
).
Configuration (NTP)
/etc/default/ntp:
-----------------
NTPD_OPTS='-g'
/etc/ntp.conf:
--------------
...
# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com
server es.pool.ntp.org
Check
_$: ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
+vps01.roethof.n 178.251.120.16 3 u 71 128 377 60.305 -0.617 14.724
-118.Red-81-47-1 193.224.65.146 3 u 69 128 377 18.640 -3.304 29.192
*81.184.154.182. 158.227.98.15 2 u 86 128 377 33.284 0.218 1.281
+julio.masbytes. 158.227.98.15 2 u 100 128 377 41.766 1.802 0.999
-golem.canonical 131.188.3.220 2 u 105 128 377 50.969 -3.227 39.546
Force synchronization
When the clock drifts from the real time more than 1000 seconds (~16 minutes) ntp
stops working. Synchronization must be forced then:
_$: service ntp stop
_$: ntpdate -s 0.ubuntu.pool.ntp.org
_$: service ntp start
_$: service ntp status
_$: date