System Administration Guide: Network Services

Chapter 3 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:

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.

ProcedureHow to Set Up an NTP Server

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Create the ntp.conf file.

    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
    
  3. Start the xntpd daemon.


    # svcadm enable network/ntp
    

ProcedureHow to Set Up an NTP Client

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Create the ntp.conf file.

    To activate the xntpd daemon, the ntp.conf file must first be created.


    # cd /etc/inet
    # cp ntp.client ntp.conf
    
  3. Start the xntpd daemon.


    # svcadm enable network/ntp
    

Using Other Time-Related Commands (Tasks)

The following procedure can be used to update the current time when ever needed, without having to setup NTP.

ProcedureHow to Synchronize Date and Time From Another System

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. 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

  3. 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 3–1 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 

/etc/inet/ntp.conf

Lists configuration options for NTP. 

/etc/inet/ntp.client

Sample configuration file for NTP clients. 

/etc/inet/ntp.server

Sample configuration file for NTP servers. 

/etc/inet/ntp.drift

Sets the initial frequency offset on NTP servers. 

/etc/inet/ntp.keys

Contains the NTP authentication keys. 

/usr/lib/inet/xntpd

NTP daemon. See xntpd(1M) for more information.

/usr/sbin/ntpdate

Utility to set the local date and time, based on NTP. See ntpdate(1M) for more information.

/usr/sbin/ntpq

NTP query program. See ntpq(1M) for more information.

/usr/sbin/ntptrace

Program to trace NTP hosts back to the master NTP server. See ntptrace(1M) for more information.

/usr/sbin/xntpdc

NTP query program for the xntpd daemon. See xntpdc(1M) for more information.

/var/ntp/ntpstats

Directory for holding NTP statistics.