Configuring Network Time (NTP) on Solaris

md040511

Summary: A Solaris machine is used to connect with an external time source. Solaris clients are configured to talk to this server. "Nettime" can be installed on Windows machines (runs as service, disable the built-in w32time in service).


Configure a Server (to be the internal reference for other clients)

  1. Edit Server /etc/inet/ntp.conf

  2. Starting & Stopping the Service

Configure the Client

  1. Edit Client /etc/inet/ntp.conf

  2. Starting & Stopping the Service





  1. Edit Server /etc/inet/ntp.conf

# @(#)ntp.server 1.5 99/09/21 SMI

#

# /etc/inet/ntp.server

#

# An example file that could be copied over to /etc/inet/ntp.conf and

# edited; it provides a configuration template for a server that

# listens to an external hardware clock, synchronizes the local clock,

# and announces itself on the NTP multicast net.

#


# This is the external clock device. The following devices are

# recognized by xntpd 3-5.93e:

#

# XType Device RefID Description

# -------------------------------------------------------

# 1 local LCL Undisciplined Local Clock

# 2 trak GPS TRAK 8820 GPS Receiver

# 3 pst WWV PSTI/Traconex WWV/WWVH Receiver

# 4 wwvb WWVB Spectracom WWVB Receiver

# 5 true TRUE TrueTime GPS/GOES Receivers

# 6 irig IRIG IRIG Audio Decoder

# 7 chu CHU Scratchbuilt CHU Receiver

# 8 parse ---- Generic Reference Clock Driver

# 9 mx4200 GPS Magnavox MX4200 GPS Receiver

# 10 as2201 GPS Austron 2201A GPS Receiver

# 11 arbiter GPS Arbiter 1088A/B GPS Receiver

# 12 tpro IRIG KSI/Odetics TPRO/S IRIG Interface

# 13 leitch ATOM Leitch CSD 5300 Master Clock Controller

# 15 * * TrueTime GPS/TM-TMD Receiver

# 17 datum DATM Datum Precision Time System

# 18 acts ACTS NIST Automated Computer Time Service

# 19 heath WWV Heath WWV/WWVH Receiver

# 20 nmea GPS Generic NMEA GPS Receiver

# 22 atom PPS PPS Clock Discipline

# 23 ptb TPTB PTB Automated Computer Time Service

# 24 usno USNO USNO Modem Time Service

# 25 * * TrueTime generic receivers

# 26 hpgps GPS Hewlett Packard 58503A GPS Receiver

# 27 arc MSFa Arcron MSF Receiver

#

# * All TrueTime receivers are now supported by one driver, type 5.

# Types 15 and 25 will be retained only for a limited time and may

# be reassigned in future.

#

# Some of the devices benefit from "fudge" factors. See the xntpd

# documentation.


# Either a peer or server. Replace "XType" with a value from the

# table above.


#server 127.127.XType.0 prefer

#fudge 127.127.XType.0 stratum 0


# FIREWALL: allow UDP port 123 inbound from 195.82.108.100 & 130.88.203.12 (for this UK time source)

# stratum 0
server ntp.mailbox.co.uk

# stratum 1
server ntp2d.mcc.ac.uk

# I switched this off since I want my client machines to poll.

#broadcast 224.0.1.1 ttl 4


enable auth monitor


# create the following file using  touch /var/ntp/ntp.drift

driftfile /var/ntp/ntp.drift

statsdir /var/ntp/ntpstats/

filegen peerstats file peerstats type day enable

filegen loopstats file loopstats type day enable

filegen clockstats file clockstats type day enable


# I changed the numbers in the following from 0 to some random number to prevent warning msg's in /var/adm/messages
# I also created this other file with 
touch /etc/inet/ntp.keys

keys /etc/inet/ntp.keys
trustedkey 568445
requestkey 4545765
controlkey 455709


  1. Starting & Stopping the Service

Once /etc/inet/ntp.conf has been created then the ntp client/server service will auto-start from /etc/rc2.d/S74xntpd which is hardlinked to /etc/init.d/xntpd

To start and stop the service interactively:

/etc/init.d/xntpd start

or

/etc/init.d/xntpd stop

To monitor status:

tail -50f /var/adm/messages

for activity:

snoop | grep -i ntp

or

snoop port 123
 


  1. Edit Client /etc/inet/ntp.conf

cp /etc/inet/ntp.client to /etc/inet/ntp.conf

# ident "@(#)ntp.client 1.3     00/07/17 SMI"
#
# /etc/inet/ntp.client
#
# An example file that could be copied over to /etc/inet/ntp.conf; it
# provides a configuration for a host that passively waits for a server
# to provide NTP packets on the ntp multicast net.
#

multicastclient 224.0.1.1

For this multicast ensure the server's ntp.conf has the following setting enabled:

#broadcast 224.0.1.1 ttl 4

You may not want server multicast packets distributing all over your network so you may configure the client to regularly call the server instead:

# @(#)ntp.client        1.2     96/11/06 SMI
#
# /etc/inet/ntp.client
#
# An example file that could be copied over to /etc/inet/ntp.conf; it
# provides a configuration for a host that passively waits for a server
# to provide NTP packets on the ntp multicast net.
#
server ntptimeserver
#multicastclient 224.0.1.1

Once you're happy with the configuration with or without multicast then start the service.