Index.
06-Nov-2011: fixed IPv6 syntax. 24-Jun-2011: initial release.
Introduction.
There are several services that need good time synchronization. On the Home Server host we will install the NTP daemon that will synchronize with a pool of timeservers on the Internet, and provide the time service on the local networks. In theory there is no need for time synchronization in the virtual servers, but depending on the kernel version they still drift.
Configuration.
Install the NTP package:
[root@homsrv etc]# pacman -S ntp resolving dependencies... looking for inter-conflicts... Targets (1): ntp-4.2.6.p3-3 Total Download Size: 0.39 MB Total Installed Size: 1.39 MB Proceed with installation? [Y/n] :: Retrieving packages from extra... ntp-4.2.6.p3-3-i686 397.9K 429.5K/s 00:00:01 [######################] 100% (1/1) checking package integrity [######################] 100% (1/1) checking for file conflicts [######################] 100% (1/1) installing ntp [######################] 100% [root@homsrv etc]#
Then, edit /etc/ntp.conf:
# Name of the servers ntpd should sync with # Please respect the access policy as stated by the responsible person. server pool.ntp.org # Don't serve time or stats to anyone else by default (more secure) restrict default noquery nomodify # Allow localhost restrict 127.0.0.1 restrict -6 ::1 # To allow machines within your network to synchronize # their clocks with your server, but ensure they are # not allowed to configure the server or used as peers # to synchronize against, uncomment this line. # restrict 10.126.160.0 mask 255.255.248.0 nomodify nopeer notrap restrict 2001:1af8:fecf:: mask ffff:ffff:ffff:: nomodify nopeer notrap # you should not need to modify the following paths driftfile /var/lib/ntp/ntp.drift
Note the different syntax on the restrict lines for IPv6. The documentation isn’t very clear on this, but the notation is different for a single address and a network address.
Now start with the command: /etc/rc.d/ntpd start and add ntpd to the DAEMONS=() array in /etc/rc.conf. You can check your server with the ntptrace command:
[root@homsrv etc]# ntptrace localhost.localdomain: stratum 16, offset 0.000000, synch distance 0.000000 [root@homsrv etc]# ntptrace localhost.localdomain: stratum 3, offset -0.009879, synch distance 0.019221 damiana-ext-bge0.toolserver.org: stratum 2, offset 0.000870, synch distance 0.008379 time.ure.cas.cz: stratum 1, offset -0.000005, synch distance 0.002198, refid 'ATOM' [root@homsrv etc]#
The first time it didn’t show the clock is synchronized, it takes a few minutes before that is the case. The second example shows that it is in sync.
Download.
Here is the updated scripts and configuration archive.
