[39f01ca] | 1 | <sect2>
|
---|
[1c36436] | 2 | <title>Configuring <application><acronym>NTP</acronym></application></title>
|
---|
[39f01ca] | 3 |
|
---|
| 4 | <sect3><title>Config files</title>
|
---|
| 5 | <para><filename>/etc/ntp.conf</filename></para>
|
---|
| 6 | </sect3>
|
---|
| 7 |
|
---|
| 8 | <sect3><title>Configuration Information</title>
|
---|
| 9 |
|
---|
| 10 | <para>The following configuration file defines various <acronym>NTP</acronym>
|
---|
[135e27c] | 11 | stratum 2 servers with open access from different continents. It also
|
---|
[39f01ca] | 12 | creates a drift file where <command>ntpd</command> stores the frequency
|
---|
[1c36436] | 13 | offset. Since the documentation included with the package is sparse,
|
---|
| 14 | visit the <acronym>NTP</acronym> website at
|
---|
[39f01ca] | 15 | <ulink url="http://www.ntp.org/"/> for more information.</para>
|
---|
| 16 |
|
---|
[e8889a20] | 17 | <screen><userinput><command>cat > /etc/ntp.conf << "EOF"</command>
|
---|
[135e27c] | 18 | # Africa
|
---|
| 19 | server tock.nml.csir.co.za
|
---|
| 20 |
|
---|
| 21 | # Asia
|
---|
| 22 | server ntp.shim.org
|
---|
| 23 |
|
---|
| 24 | # Australia
|
---|
| 25 | server ntp.saard.net
|
---|
| 26 |
|
---|
| 27 | # Europe
|
---|
| 28 | server ntp.tuxfamily.net
|
---|
| 29 |
|
---|
| 30 | # North America
|
---|
| 31 | server clock.psu.edu
|
---|
| 32 |
|
---|
[e8889a20] | 33 | driftfile /var/cache/ntp.drift
|
---|
| 34 | <command>EOF</command></userinput></screen>
|
---|
[39f01ca] | 35 | </sect3>
|
---|
| 36 |
|
---|
| 37 | <sect3><title>Synchronizing the time</title>
|
---|
| 38 |
|
---|
| 39 | <para>There are two options. Option one is to use run <command>ntpd</command>
|
---|
[9491ec6b] | 40 | continuously and allow it to synchronize the time in a gradual manner. The other
|
---|
[39f01ca] | 41 | option is to run <command>ntpd</command> periodically (using cron)
|
---|
| 42 | and update the time each time <command>ntpd</command> is scheduled.</para>
|
---|
| 43 |
|
---|
| 44 | <para>If you choose Option one, then create the bootscript
|
---|
| 45 | <filename>/etc/rc.d/init.d/ntp</filename> and put the start and
|
---|
| 46 | stop symlinks:</para>
|
---|
[1c36436] | 47 |
|
---|
[3332aad] | 48 | <screen><userinput><command>cat > /etc/rc.d/init.d/ntp << "EOF"</command>
|
---|
[369af35a] | 49 | #!/bin/sh
|
---|
[39f01ca] | 50 | # Begin $rc_base/init.d/ntp
|
---|
[369af35a] | 51 | . /etc/sysconfig/rc
|
---|
| 52 | . $rc_functions
|
---|
[39f01ca] | 53 | case "$1" in
|
---|
| 54 | start)
|
---|
| 55 | echo "Starting ntpd..."
|
---|
| 56 | loadproc ntpd
|
---|
| 57 | ;;
|
---|
| 58 | stop)
|
---|
| 59 | echo "Stopping ntpd..."
|
---|
| 60 | killproc ntpd
|
---|
| 61 | ;;
|
---|
| 62 | restart)
|
---|
| 63 | $0 stop
|
---|
| 64 | sleep 1
|
---|
| 65 | $0 start
|
---|
| 66 | ;;
|
---|
| 67 | status)
|
---|
| 68 | statusproc ntpd
|
---|
| 69 | ;;
|
---|
| 70 | *)
|
---|
| 71 | echo "Usage: $0 {start|stop|restart|status}"
|
---|
| 72 | exit 1
|
---|
| 73 | ;;
|
---|
| 74 | esac
|
---|
[3332aad] | 75 | # End $rc_base/init.d/ntp
|
---|
| 76 | <command>EOF
|
---|
[3150274] | 77 | chmod 755 /etc/rc.d/init.d/ntp &&
|
---|
[3332aad] | 78 | cd /etc/rc.d/init.d &&
|
---|
| 79 | ln -sf ../init.d/ntp ../rc0.d/K46ntp &&
|
---|
| 80 | ln -sf ../init.d/ntp ../rc1.d/K46ntp &&
|
---|
| 81 | ln -sf ../init.d/ntp ../rc2.d/K46ntp &&
|
---|
| 82 | ln -sf ../init.d/ntp ../rc3.d/S26ntp &&
|
---|
| 83 | ln -sf ../init.d/ntp ../rc4.d/S26ntp &&
|
---|
| 84 | ln -sf ../init.d/ntp ../rc5.d/S26ntp &&
|
---|
| 85 | ln -sf ../init.d/ntp ../rc6.d/K46ntp</command></userinput></screen>
|
---|
[39f01ca] | 86 |
|
---|
| 87 | <para>If you prefer to start ntpd periodically, add the following command to
|
---|
| 88 | the root's <filename>crontab</filename>:</para>
|
---|
| 89 | <screen><userinput>ntpd -q</userinput></screen>
|
---|
| 90 |
|
---|
| 91 | </sect3>
|
---|
| 92 |
|
---|
| 93 | </sect2>
|
---|