Installing NTP (time synchronisation)
- Set timezone (optional)
- create symbolical link from
/usr/share/zoneinfo/...to/etc/localtime:
ln -sf /usr/share/zoneinfo/Europe/Brussels /etc/localtime
- Set UTC mode (optional)
- if your hardware clock runs in UTC (Universal Coordinated Time) mode, add
UTC=true
to the/etc/sysconfig/clockfile - Make sure
ntpdis not running - Use
service ntpd stopto stop it. - Choose the NTP server you will get your time from
- it can be an internal server that has the NTP service open for clients, or an public NTP server. To be sure, use 2 servers. To check if you can access it, run
ntpdate timeserver.ntp.ch - Edit the
/etc/ntp.conffile -
Rename the current file to
ntp.bak.confand make a small new one:restrict default ignore server timeserver.ntp.ch # Swiss time server ntp.ucsd.edu # Univ of California, San Diego restrict timeserver.ntp.ch mask 255.255.255.255 nomodify notrap noquery restrict ntp.ucsd.edu mask 255.255.255.255 nomodify notrap noquery server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10 #so it only takes over if the rest fails restrict 127.0.0.1 driftfile /etc/ntp/drift broadcastdelay 0.008 authenticate no - Set your system clock right
- Run the following command a couple of times:
ntpdate -u timeserver.ntp.ch # or whatever server you want to use
You will see the initial diffence in time go away afer the 2nd or 3rd time. - Set hardware clock
/sbin/hwclock --systohc- Run the
ntpddaemon service ntpd start- Add
ntpdto the services started at boot time chkconfig ntpd on- Check the NTP results
-
ntpd -p
will show you what the difference is between your clock and that of the servers you added. You are looking for lines likeremote refid st t when poll reach delay offset jitter ========================================================================== LOCAL LOCAL 10 l 30 64 377 0.000 0.000 0.004 * 192.168.246.107 192.168.246.88 3 u 41 128 177 0.313 5.598 0.345and not lines like
remote refid st t when poll reach delay offset jitter ========================================================================== 192.168.246.126 LOCAL 11 u 37 128 375 0.204 6082.02 6069.84Jitter is too high!