<chapter id="time-1"><title>Time-Related Services</title><highlights><para>Keeping system clocks synchronized within a network is required for
many databases and authentication services. The following topics are covered
in this chapter.</para><itemizedlist><listitem><para><olink targetptr="time-2" remap="internal">Clock Synchronization (Overview)</olink></para>
</listitem><listitem><para><olink targetptr="time-20" remap="internal">Managing Network Time Protocol
(Tasks)</olink></para>
</listitem><listitem><para><olink targetptr="time-21" remap="internal">Using Other Time-Related Commands
(Tasks)</olink></para>
</listitem><listitem><para><olink targetptr="time-22" remap="internal">Network Time Protocol (Reference)</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="time-2"><title>Clock Synchronization (Overview)</title><para>The Network Time Protocol (NTP) public domain software from the University
of Delaware is included in the Solaris software from Solaris 2.6 release forward.
The <literal>xntpd</literal> daemon sets and maintains the system time-of-day.
The <literal>xntpd</literal> daemon is a complete implementation of the version
3 standard, as defined by RFC 1305.</para><para>The <literal>xntpd</literal> daemon reads the <filename>/etc/inet/ntp.conf</filename> file
at system startup. See <olink targetdoc="refman1m" targetptr="xntpd-1m" remap="external"><citerefentry><refentrytitle>xntpd</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> for
information about configuration options.</para><itemizedlist><para>Remember the following when using NTP in your network:</para><listitem><para>The <literal>xntpd</literal> daemon uses minimal
system resources.</para>
</listitem><listitem><para>An NTP client synchronizes automatically with an NTP server
when it boots. If the client becomes unsynchronized, the client resynchronizes
again when the client contacts a time server.</para>
</listitem>
</itemizedlist><para>Another way to synchronize clocks is to run <command>rdate</command> while
using <command>cron</command>.</para>
</sect1><sect1 id="time-20"><title>Managing Network Time Protocol (Tasks)</title><para>The following procedures show how to set up and use the NTP service.</para><task id="time-4"><title>How to Set Up an NTP Server</title><procedure>&rolestepA;<step id="time-step-7"><para>Create the <filename>ntp.conf</filename> file.</para><para>To
ensure proper execution of the <command>xntpd</command> daemon, the <filename>ntp.conf</filename> file must first be created. The <filename>ntp.server</filename> file
can be used as a template.</para><screen># <userinput>cd /etc/inet</userinput>
# <userinput>cp ntp.server ntp.conf</userinput></screen>
</step><step id="time-step-8"><para>Start the <command>xntpd</command> daemon.</para><screen># <userinput>svcadm enable network/ntp</userinput></screen>
</step>
</procedure>
</task><task id="time-9"><title>How to Set Up an NTP Client</title><procedure>&rolestepA;<step id="time-step-12"><para>Create the <filename>ntp.conf</filename> file.</para><para>To
activate the <command>xntpd</command> daemon, the <filename>ntp.conf</filename> file
must first be created.</para><screen># <userinput>cd /etc/inet</userinput>
# <userinput>cp ntp.client ntp.conf</userinput></screen>
</step><step id="time-step-13"><para>Start the <literal>xntpd</literal> daemon.</para><screen># <userinput>svcadm enable network/ntp</userinput></screen>
</step>
</procedure>
</task>
</sect1><sect1 id="time-21"><title>Using Other Time-Related Commands (Tasks)</title><para>The following procedure can be used to update the current time when
ever needed, without having to setup NTP.</para><task id="time-14"><title>How to Synchronize Date and Time From Another System</title><procedure>&rolestepA;<step id="time-step-17"><para>Reset the date and time to synchronize with another system, by
using the <command>rdate</command> command. </para><screen># <userinput>rdate</userinput> <replaceable>another-system</replaceable></screen><variablelist><varlistentry><term><replaceable>another-system</replaceable></term><listitem><para>Name of the another system</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="time-step-18"><para>Verify that you have reset your system's date
correctly by using the <command>date</command> command.</para><para>The output
should show a date and time that matches that of the other system.</para>
</step>
</procedure><example><title>Synchronizing Date and Time From Another System</title><para>The following example shows how to use <command>rdate</command> to
synchronize the date and time of one system with another. In this example,
the system <literal>earth</literal>, running several hours behind, is reset
to match the date and time of the server <literal>starbug</literal>.  </para><screen>earth# <userinput>date</userinput>
Tue Jun  5 11:08:27 MDT 2001
earth# <userinput>rdate starbug</userinput>
Tue Jun  5 14:06:37 2001
earth# <userinput>date</userinput>
Tue Jun  5 14:06:40 MDT 2001</screen>
</example>
</task>
</sect1><sect1 id="time-22"><title>Network Time Protocol (Reference)</title><para>The following files are needed for the NTP service to run.</para><table frame="topbot" id="time-tbl-23"><title>NTP Files</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colnum="1" colname="column1" colwidth="3*"/><colspec colnum="2" colname="column2" colwidth="6*"/><thead><row rowsep="1"><entry><para>File Name</para>
</entry><entry><para>Function</para>
</entry>
</row>
</thead><tbody><row><entry><para><filename>/etc/inet/ntp.conf</filename> </para>
</entry><entry><para>Lists configuration options for NTP.</para>
</entry>
</row><row><entry><para><filename>/etc/inet/ntp.client</filename> </para>
</entry><entry><para>Sample configuration file for NTP clients.</para>
</entry>
</row><row><entry><para><filename>/etc/inet/ntp.server</filename> </para>
</entry><entry><para>Sample configuration file for NTP servers.</para>
</entry>
</row><row><entry><para><filename>/etc/inet/ntp.drift</filename> </para>
</entry><entry><para>Sets the initial frequency offset on NTP servers.</para>
</entry>
</row><row><entry><para><filename>/etc/inet/ntp.keys</filename> </para>
</entry><entry><para>Contains the NTP authentication keys.</para>
</entry>
</row><row><entry><para><filename>/usr/lib/inet/xntpd</filename> </para>
</entry><entry><para>NTP daemon. See <olink targetdoc="refman1m" targetptr="xntpd-1m" remap="external"><citerefentry><refentrytitle>xntpd</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> for
more information.</para>
</entry>
</row><row><entry><para><filename>/usr/sbin/ntpdate</filename> </para>
</entry><entry><para>Utility to set the local date and time, based on NTP. See <olink targetdoc="refman1m" targetptr="ntpdate-1m" remap="external"><citerefentry><refentrytitle>ntpdate</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> for more information.</para>
</entry>
</row><row><entry><para><filename>/usr/sbin/ntpq</filename> </para>
</entry><entry><para>NTP query program. See <olink targetdoc="refman1m" targetptr="ntpq-1m" remap="external"><citerefentry><refentrytitle>ntpq</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> for
more information.</para>
</entry>
</row><row><entry><para><filename>/usr/sbin/ntptrace</filename> </para>
</entry><entry><para>Program to trace NTP hosts back to the master NTP server. See <olink targetdoc="refman1m" targetptr="ntptrace-1m" remap="external"><citerefentry><refentrytitle>ntptrace</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> for more
information.</para>
</entry>
</row><row><entry><para><filename>/usr/sbin/xntpdc</filename> </para>
</entry><entry><para>NTP query program for the <command>xntpd</command> daemon. See <olink targetdoc="refman1m" targetptr="xntpdc-1m" remap="external"><citerefentry><refentrytitle>xntpdc</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> for more information.</para>
</entry>
</row><row><entry><para><filename>/var/ntp/ntpstats</filename> </para>
</entry><entry><para>Directory for holding NTP statistics.</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
</chapter>