How to Configure NTP Server and Client in Solaris 10

The Network Time Protocol (NTP) is an internet protocol that is useful to synchronize system clocks to coordinate with Universal Time (UTC) over the network. One System can be an NTP Server or NTP client. NTP client uses the NTP protocol to synchronize its clock timing with the NTP server which is sync with public internet which is widely available for NTP time synchronization purposes.

NTP Client –> Sync with NTP server –> Sync with Public Network

NTP clients can function with NTP servers in 3 ways:

  • in a client-server basis
  • in a peer to peer mode
  • sending the time using broadcast/multicast

xnptd is daemon of NTP service. When xnptd starts, it will check the NTP configuration file /etc/ntp.conf to determine synchronization sources and also checks the frequency file /etc/ntp/drift which contains the latest estimate of clock frequency delay. If specified, it will also check the file /etc/ntp/keys which containing the authentication keys.

Important NTP files

Files Descriptions
/etc/ntp.conf Default configuration file.
/etc/ntp.drift Default drift file which contains latest estimate of clock frequency error. (i.e difference between your clock and the data provided by NTP server)
/etc/ntp.keys Default key file which contains authentication keys

NTP Server Configuration Steps

Let we can configure NTP server with using the pubilc network NTP time synchronization services which are following “server 3.in.pool.ntp.org, server 3.asia.pool.ntp.org, server 2.asia.pool.ntp.org”

# cp /etc/inet/ntp.server /etc/inet/ntp.conf
# vi /etc/inet/ntp.conf

Adding the NTP time synchronization servers:

# Either a peer or server.  Replace "XType" with a value from the
# table above.
server 3.in.pool.ntp.org
server 3.asia.pool.ntp.org
server 2.asia.pool.ntp.org

broadcast 224.0.1.1 ttl 4

enable auth monitor
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

Then we have to create the drift file and start the NTP services:

# touch /var/ntp/ntp.drift
#
# svcs ntp
STATE          STIME    FMRI
disabled       Jul_25   svc:/network/ntp:default
# svcadm enable svc:/network/ntp:default
#
# svcs ntp
STATE          STIME    FMRI
online       23:47:06 svc:/network/ntp:default
#

Now we can check the NTP service status by using ntpq command.

# ntpq -pn
     remote           refid      st t when poll reach   delay   offset    disp
==============================================================================
 224.0.1.1       0.0.0.0         16 u    -   64    0     0.00    0.000 16000.0
*120.88.47.10    128.4.1.1        2 u  481  512  377    28.06  -40.717    9.61
+220.130.158.72  220.130.158.70   2 u  507  512  375   121.20  -32.876   14.24
+78.111.50.52    212.87.0.71      3 u   47  512  277   222.41  -58.496    9.20
#

*” indicates the server to which you are currently synchronized. “+” indicates the server which take the leading role if the current server becomes unavailable for some reason.

Fields Descriptions
remote The IP address or DNS name of the remote server
refid An identification of the reference clock and type
st The “stratum” or level of the server: for almost all systems, 2 is great. Your local system will have a higher number.
t The type of service. “I” indicates your local system or “u” indicates for communicating with remote servers
when Last sync timing which is in seconds format,
poll Current polling interval in seconds, Note:- “when” should be no greater than “poll”.
reach indicating whether responses have been received to your local server’s eight most recent requests.The value starts at 0. If your local server is receiving responses to all its requests, it will go to 1, then 3, then 7.The display is in octal, so 377 is the maximum value
delay Recent average roundtrip time in milliseconds from request to response
offset Estimated differential between your system clock and this time server’s clock, in milliseconds
disp A measure of the variability of the delays between request and receipt of a response, in milliseconds

NTP client Configuration Steps

Let we can start the configuration for NTP client, First copy the ntp.client sources file as ntp.conf and add nfs server name

# cp /etc/inet/ntp.client /etc/inet/ntp.conf
# vi /etc/inet/ntp.conf

Create a drift file and start the ntp services

# touch /var/ntp/ntp.drift
#
# svcs ntp
STATE          STIME    FMRI
disabled       Jul_25   svc:/network/ntp:default
# svcadm enable svc:/network/ntp:default
#
#

Now we can see the status by executing ntpq -p command.

# ntpq -p