ntp server on Solaris 7

To configure the server, you should already have some knowledge of Unix, Solaris, a Sparc or equivalent, and you are competent at using vi or textedit.

Sign in as root.

Verify that ntp is installed:
$ pkginfo | grep -i ntpa
system SUNWntpr NTP, (Root)
system SUNWntpu NTP, (Usr)

Open /etc/inet/ntp.server. That is only a template and you will not require it in its entirety. Using vi or textedit, create /etc/inet/ntp.conf.

# /etc/inet/ntp.conf
#
# Undisciplined local clock
server 127.127.1.0

This entry specifies your machine's own clock as a source. It is unsynchronized with any other time sources or machines. Next, write the entry for the driftfile:

# driftfile
driftfile /var/ntp/ntp.drift

Enable logging and specify the log files and location:

# logging
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
Reboot the Sparc. If their are errors in ntp.conf, you'll see an "xntpd" error message during boot as the services are enabled. If there are no messages, you're ok.

Verify the ntp is running:

#ps -ef | grep ntp
root 682 1 0 22:32:12 acts1 0:02 /usr/lib/inet/xntpd

Now, using ntptrace to check the time source:

#ntptrace
localhost: stratum 16, offset 0.000000, synch distance 0.000000

Congratulations! You are now successfully running a stratum 16 ntp server at the bottom of the food chain.

I also configured the machine to poll NIST ACTS by modem. This is not required, but is a good idea if*none* of the internet time servers are available (to be added later), either by a network failure remotely (a backhoe hits their T1) or locally (your cat jumps on the ethernet to DSL bridge and it crashes to the floor, disconnecting the power) and you don't notice the trouble for a few hours.

As the modem polls ACTS, your server will eventually move up through the strata. If you want to volunteer your server for the NTP server pool, it is advisable to run at stratum 2.

Add the following after the local clock entry and uncomment either the server *and* phone entries for Colorado *or* Hawaii but *not* for both locations.:

# Colorado NIST ACTS
#server 127.127.18.1
#phone atdt13034944774
# Hawaii NIST ACTS
#server 127.127.18.1
#phone atdt18083354721

Oh, yeah - you'll need a modem. Use a Hayes compatible 1200-9600 bps modem. I use either an MT224 or MT932. You can get them off of ebay for a song. You'll need a serial cable as well, and configure the sparc box for asynchronous dial-up service.

Alternately, you can use the US Naval Observatory time service at 1200 baud 8N1/

Add the following after the local clock entry and uncomment either the server *and* phone entries for Washington *or* Colorado Springs but *not* for both locations:

# Washington NAVOBS
#server 127.127.18.1
#phone atdt12027621594
# Colorado Springs NAVOBS
#server 127.127.18.1
#phone atdt17195676743

If in OpenWindows or CDE, start AdminTool, then Browse--->Serial Ports--->Port a. In the Template drop-down menu, select "Terminal - Hardwired". Make sure "Service Enable" is checked. Set "Baud Rate" to the your modem's rate. Select "Apply" then "OK".

Once the modem is connected and configured, test the connection to modem on serial port a.

# tip /dev/cua/a
connected
atdt <-------type this command and watch for the response on the modem's status lights.
Type ~. or close Command Tool.

A symbolic link is now required for xntpd to access the modem /dev/cua/a. From the command line:

#ln -s /dev/cua/a /dev/acts1

Note "acts1" corresponds to the last number in "server 127.127.18.1". Power cycle the modem, then reboot the Sparc. If all goes well, no xntpd error messages will appear and the modem will dial NIST ACTS and receive time data.

Now let's see what the time sources are (output redacted):

$ ntpq -c peers localhost
remote refid st poll
LOCAL(0) LOCAL(0) 3 64
ACTS_MODEM(1) .ACTS. 0 1024

You now have an undisciplined local clock at stratum 3 (column "st") polling itself every 64 seconds (column "poll") and a server designated as stratum 1 polled every 1024 seconds.

So far, /etc/inet/ntp.conf looks like:

# /etc/inet/ntp.conf
#
# Undisciplined local clock
server 127.127.1.0
# Colorado NIST ACTS
server 127.127.18.1
phone atdt13034944774
# driftfile
driftfile /var/ntp/ntp.drift
# logging
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

Adding "prefer" (without quotes) at the end of the NIST ACTS server entry will instruct xntpd to use the modem time as the preferred source. Instead of rebooting the Sparc, stop then start xntpd:

# /etc/init.d/xnptd stop
# /etc/init.d/xnptd start

NOTE: If you're *not* going to be a stratum 2 time source, this set up is ok. If you *are* going to be a stratum 2 time source, it's no good.

Next: How to upgrade your server to Stratum 2.

You need to access Stratum 1 servers. Choose at least two that allow access, whether based upon geographical area, by permission, or by latency. Select your server pool using more than one source, that is, GPS, WWV, Cesium clock, etc. DO NOT poll the servers at intervals less than 4 seconds.

Examples of open access servers not requiring written permission for use in Minnesota are:

ntp2.usno.navy.mil
ntp.okstate.edu
navobs1.wustl.edu (CNAME ntp-wustl.usno.navy.mil)
tick.uh.edu (CNAME ntp-uh.usno.navy.mil)
time.nist.gov
wwv.nist.gov
time-a.nist.gov
time-b.nist.gov
tick.usnogps.navy.mil

Add the servers you want to poll to /etc/inet/ntp.conf so it now looks like:

# /etc/inet/ntp.conf
#
# Undisciplined local clock
server 127.127.1.0
# Colorado NIST ACTS
server 127.127.18.1
phone atdt13034944774
# Stratum 1 servers
server ntp.okstate.edu
server ntp2.usno.navy.mil
server time-a.nist.gov
server time-b.nist.gov
# driftfile
driftfile /var/ntp/ntp.drift
# logging
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

Stop then start xntpd:

# /etc/init.d/xnptd stop
# /etc/init.d/xnptd start

Query "ntpq -c peers localhost" again. Note your ntp client hasn't decided which of your polled Stratum 1servers to select. Check "ntpq -c peers localhost" at regular intervals until an asterisk * appears next to a Stratum 1 server. You are now a Stratum 2 server.

If you can spare the resources, don't forget to add your server to the NTP pool project. :-)

Oct 9, 2011 @ 12:36