Time-Related Services
Keeping system clocks synchronized within a network is required for many databases and authentication services. The following topics are covered in this chapter.
Clock Synchronization (Overview)
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 xntpd daemon sets and maintains the system time-of-day. The xntpd daemon is a complete implementation of the version 3 standard, as defined by RFC 1305.
The xntpd daemon reads the /etc/inet/ntp.conf file at system startup. See xntpd(1M) for information about configuration options.
Remember the following when using NTP in your network:
The xntpd daemon uses minimal system resources.
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.
Another way to synchronize clocks is to run rdate while using cron.
Managing Network Time Protocol (Tasks)
The following procedures show how to set up and use the NTP service.
How to Set Up an NTP Server
Become superuser.
To ensure proper execution of the xntpd daemon, the ntp.conf file must first be created. The ntp.server file can be used as a template.
# cd /etc/inet # cp ntp.server ntp.conf
# /etc/init.d/xntpd start
How to Set Up an NTP Client
Become superuser.
To activate the xntpd daemon, the ntp.conf file must first be created.
# cd /etc/inet # cp ntp.client ntp.conf
# /etc/init.d/xntpd start
Using Other Time-Related Commands (Tasks)
How to Synchronize Date and Time From Another System
Reset the date and time to synchronize with another system, by using the rdate command.
# rdate another-system
another-system
Name of the another system
Verify that you have reset your system's date correctly by using the date command.
The output should show a date and time that matches that of the other system.
Example--Synchronizing Date and Time From Another System
The following example shows how to use rdate to synchronize the date and time of one system with another. In this example, the system earth, running several hours behind, is reset to match the date and time of the server starbug.
earth# date Tue Jun 5 11:08:27 MDT 2001 earth# rdate starbug Tue Jun 5 14:06:37 2001 earth# date Tue Jun 5 14:06:40 MDT 2001 |
Network Time Protocol (Reference)
The following files are needed for the NTP service to run.
Table 3-1 NTP Files
File Name | Function |
---|---|
Lists configuration options for NTP. | |
Sample configuration file for NTP clients. | |
Sample configuration file for NTP servers. | |
Sets the initial frequency offset on NTP servers. | |
Sample configuration file for NTP servers. | |
NTP startup script run when a host is booted. | |
NTP daemon. See xntpd(1M) for more information. | |
Utility to set the local date and tim,e based on NTP. See ntpdate(1M) for more information. | |
NTP query program. See ntpq(1M) for more information. | |
Program to trace NTP hosts back to the master NTP server. See ntptrace(1M) for more information. | |
NTP query program for the xntpd daemon. See xntpdc(1M) for more information. | |
Directory for holding NTP statistics. |