System: NTP: setting up(last edit: 2001-04-12)
NTP stands for Network Time Protocol and is used to set the time on your system.
There are two programs which you must use:
Ntpdate sets the time and exits and thus it won't keeps setting the time, for this you have
to start ntpd.
Ntpdate should be started with the following options:
-b Force the time to be stepped using the settimeofday(2) system
call, rather than slewed (default) using the adjtime(2) system
call. This option should be used when called from a startup file
at boot time.
-s Divert logging output from the standard output (default) to the
system syslog(3) facility. This is designed primarily for conve-
nience of cron(8) scripts.
Don't use the '-s' option when starting from the commandline.
Mon Jan 1 01:52:39 GMT 2001
root@hosts:~#>ntpdate -b ntp.demon.nl ntp.demon.co.uk
12 Apr 13:48:51 ntpdate: step time server 188.8.131.52 offset 8769368.344914 sec
Thu Apr 12 13:48:53 GMT 2001
As you might notice this is GMT (or now called UTC) time and you probaley live in a different
Changing your timezone
You can change your timezone with 'sysinstall', with 'tzsetup' and like a good unix is
supposed to be by hand.
I haven't veriefied but I pretty sure 'sysinstall' starts the 'tzsetup' program when you
select 'configure | timezone'.
When you start 'tzsetup' it will ask you a few simple questions and it will set your timezone.
What it actually does is copy a timezone from '/usr/share/zoneinfo' to the file '/etc/localtime'
and updates the system date.
I you want to do it your self then you copy the required timezone over the '/etc/localtime'
file and you execute 'adjkerntz -a':
Thu Apr 12 14:12:21 CEST 2001
root@host:/#cp /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
Thu Apr 12 16:12:21 CEST 2001
Ntpd sets the system date AND maintains it. It uses a config file named '/etc/ntp.conf'.
This file should look something like this:
From the ntp documentation ('/usr/share/doc/ntp'):
Note the inclusion of a driftfile declaration. One of the things the NTP daemon does when
it is first started is to compute the error in the intrinsic frequency of the clock
on the computer it is running on. It usually takes about a day or so after the daemon is
started to compute a good estimate of this (and it needs a good estimate to synchronize
closely to its server). Once the initial value is computed, it will change only by
relatively small amounts during the course of continued operation. The driftfile
declaration indicates to the daemon the name of a file where it may store the current
value of the frequency error so that, if the daemon is stopped and restarted, it can
reinitialize itself to the previous estimate and avoid the day's worth of time it will
take to recompute the frequency estimate. Since this is a desirable feature, a driftfile
declaration should always be included in the configuration file.
If you want all these nice things to happen when you boot your machine then add these to
the '/etc/rc.conf' file:
ntpdate_flags="-bs ntp.demon.nl ntp.demon.co.uk"
NOTE: although I've been using ntp.demon.nl through this document you should realy find a
good ntp server near you (probaley ntp.provider.blabla)
Click here to go back to the index.