Typo
[linux_from_scratch_hints.git] / OLD / ntp.txt
blob3146103cb19894e103e54fe9a197d855c0a852c5
1 TITLE:          NTP (Time server) hint
2 LFS VERSION:    any (?)
3 AUTHOR:         Eric Konopka <ekonopka@konopka.org>
5 SYNOPSIS:
6         This describes a basic setup and configuration of a network
7         time server
9 HINT:
11 A network time server can be used to synchronize all your workstations
12 and servers to a common, "official" time.
14 Basically there are a few main time servers.  These are usually owned
15 and/or operated by NIST, the National Institute of Standards and
16 Technology, who keeps track of the official time using very precise
17 equipment.
19 An NTP server is given a stratum.  The main NTP servers have a stratum
20 of 1.  Any server that gets its time information from a main server is
21 of stratum 2, etc.  It is recommended that the servers your server
22 uses are of a lower stratum (2, 3, etc.) but you can have it link
23 to a stratum 1 server.  I usually use time-a.nist.gov and/or
24 time-b.nist.gov with a few others for backup.
26 The NTP package I use is available from:
27 http://www.eecis.udel.edu/~ntp/
29 The version I used for this hint is 4.1.1a.
31 I recommend going through some of the documentation to get a better
32 idea of how the software actually works.
34 INSTALLATION
35 ------------
37 Installation is simple.
39 I use the path /opt/ntp for my ntp server, but you can use whatever
40 you like.
42 ./configure --prefix=/opt/ntp --exec-prefix=/opt/ntp &&
43 make &&
44 make install &&
45 mkdir /opt/ntp/etc/
47 The last mkdir is necessary to install the ntp.conf file, unless
48 you want to put it in /etc or some other directory.  I usually put
49 it in that directory, though.
51 CONFIGURATION
52 -------------
54 A simple configuration will be placed in /opt/ntp/etc/ntp.conf (or
55 whatever path you choose).
57 To setup NTP, you need to choose the servers you want to designate as
58 your peers (the servers you will connect to for time information).
59 A list of peers is available from:
61 http://www.eecis.udel.edu/~mills/ntp/servers.htm
63 Choose as many peers as you want.  You will designate one as preferred
64 over all the others, but the others will be available for backup.
66 For my setup, I issue:
68 cat > /opt/ntp/etc/ntp.conf << "EOF"
69 server time-a.nist.gov prefer
70 server time-b.nist.gov
71 server tick.mit.edu
72 server ntp.ourconcord.net
73 server timeserver.cs.umb.edu
74 server ntp-0.cso.uiuc.edu
76 driftfile /opt/ntp/etc/ntp.drift
77 EOF
79 The bottom line:  for each server, add a line "server xxx.x.xxx".  Append
80 "prefer" after the server you want to designated as the default.  The NTP
81 server will use that one if possible.
83 The drift file is used to report the frequency of error.  It's ok if it
84 doesn't exist by default.  The server will create it after about an hour.
86 STARTING
87 --------
89 To start the NTP daemon:
91 /opt/ntp/bin/ntpd -c /opt/ntp/etc/ntp.conf
93 The -c flag gives the location of the configuration file.  This should
94 point to whereever your ntp.conf file is.
96 To look at the status of your NTP server, you can use the ntpq command.
97 This pulls up a terminal that allows you to issue some basic commands
98 to query the running NTP server.  The one I mostly use is "peers", which
99 lists all the peers the server is connected to.  If there is no list of
100 peers, try restarting ntpd.
102 I've noticed that after I start ntpd, there are initially two instances
103 showing in ps, but about a second after that one disappears.  This seems
104 to be fine.
106 CONFIGURING CLIENTS
107 -------------------
109 The idea behind setting up your own NTP server is, I assume, to allow
110 your local computers to synchronize time with it.
112 On any UNIX/Linux machine install the same package as for ntpd.  Any
113 time you want to synchronize the date, run:
115 /opt/ntp/bin/ntpdate xxx.xxx.xxx
117 Where "xxx.xxx.xxx" is the hostname for your local server.  This command
118 can be added to a crontab to update the time periodically.
120 For Windows, I found a package called Automachron that serves as an NTP
121 client.  Try searching for it.  On Windows XP the system time utility
122 includes NTP functionality.  Double-click the clock and go to "Internet Time".
123 Then enter your server name.