Network Time Protocol (NTP). |
|
According to the ntp home page, "NTP is a protocol designed to synchronize the clocks of computers over a network." It is different to and more accurate that the time and daytime services referred to in /etc/inetd.conf. You will of course need to have the ntp package installed, under Slackware 9.x & 10.x it is not installed by default, but can be selected as a package under expert installation. Or just install it with "installpkg <path/to/package.tgz>".
|
ntp.confThe operation of ntpd is controlled by the configuration file /etc/ntpd.conf. Most of this is well documented under the documentation section of the www.ntp.org web site, so I will not repeat it here. Two points that I have had trouble with are:-
lithium:/# ntpdate -b ntp.your.fav.ntpserverBut using ntpdate more than once (eg. in a cron job) is a bad idea, get ntpd to work properly. Also remember to sync the hardware clock (hwclock -w). |
![]() ntp hierachyThe illustration to the right shows our logical configuration. Tick & tock are directly connected to the internet, all other devices are behind nat and cannot see the internet. Tick & tock are clients of public stratum 2 servers and also peer with each other. Internally, the network devices on our 20 site wan are clients of the core routers and switch (Cisco 2610, 3750 & 2950) which peer and themselves are clients of tick & tock and some client accessible servers. All user workstations are clients of the internal servers, either using ntp for linux computers or using ncp for windows computers logging in to Novell Netware 6.5 servers (set station time=on). Testing ntpTesting ntp is important because it verifies all is working correctly. Part of the ntp package are two utilities for doing this:-
|
Sample ntp.confserver ntp0.cis.strath.ac.uk server phobos.mediahub.co.uk server deimos.mediahub.co.uk driftfile /etc/ntp/drift # server 127.127.1.0 server tick.mediahub.ac.uk prefer # prefer this server peer 172.1.28.14 # local peer peer 172.1.28.1 # local peer # local clock # fudge 127.127.1.0 stratum 10 multicastclient # listen on default 224.0.1.1 broadcastdelay 0.008 # Trust ourselves. :-) restrict 127.0.0.1 restrict tick.mediahub.ac.uk restrict 172.1.28.14This may not be the best ntp.conf file, if you have any suggestions for improvements, please email me on "suggestions at rainsbrook dot co dot uk". Below is a sample startup script for Slackware, by default if you install ntp, no mechanism is provided to start it automatically. Sample rc.ntpd#!/bin/sh # Start/stop/restart ntpd time server: if [ "$1" = "stop" ]; then echo "Stopping ntpd..." killall ntpd elif [ "$1" = "restart" ]; then echo "Restarting ntpd..." killall ntpd sleep 1 /usr/sbin/ntpd else # assume $1 = start: echo "Starting ntpd: /usr/sbin/ntpd" /usr/sbin/ntpdate 192.168.1.21 /usr/sbin/ntpd fiDownload rc.ntpd. Having proceeded this far, you actually need to run rc.ntpd, the best way is to put a line /etc/rc.d/rc.ntpd startin /etc/rc.local, of course you can run it from the command line as well. If it doesn't want to run check that you have x permission (chmod o+x rc.ntpd). |