IBM Support

IBM AIX: How to check if Network Time Protocol (NTP) on AIX is in sync

Question & Answer


Question

Is NTP on AIX working?

Cause

How to check  if NTP on the client is in sync with the NTP on the server?

Answer

The following assumes that /etc/ntp.conf has been configured

Example /etc/ntp.conf:
server <ntp server 1 ip address> prefer
server <ntp server 2 ip addess>
driftfile /etc/ntp.drift
tracefile /etc/ntp.trace

1) Use the ntpdate command on the AIX NTP client to find the offset between the client's clock and the NTP server's clock.
# /usr/bin/ntpdate -d <ntp server 1 ip address>
# /usr/bin/ntpdate -d <ntp server 2 ip address>
The offset is the last line of output and the value is in seconds.
<date time ... >  offset 0.000629


NTP will not sync if the offset between the client's clock and the server's clock is 1000 seconds or greater. Run the ntpdate command against each server defined in /etc/ntp.conf to determine the offset.
The above offset which is in seconds is well within the range for xntpd to dynamically sync to the NTP server when it is started and stabilized.
Allow 6 - 10 minutes for xntpd to stabilize after a refresh or a restart of the xntpd daemon.

2) If the offset is 1000 seconds or greater stop xntpd if active and use the ntpdate command to sync it to the preferred server defined in /etc/ntpc.conf. It is highly recommended  to stop or quiesce all time sensitive applications such as databases before adjusting the system clock.
# /usr/bin/ntpdate  <ntp server 1 ip address>
Omit the -d option to sync the clock with the NTP server.

3) Use ntpq to determine if xntpd is in sync
Example output:
# /usr/bin/ntpq -p
     remote           refid      st t when poll reach   delay   offset    disp
==============================================================================
*tcplab14bso.aus bestbso.aus.stg  3 u   47   64  377     0.47    0.145    0.03
An asterisk '*' next to the NTP server's hostname indicates that this server has been selected for synchronization. The NTP client is in sync with the NTP server tcplab14bso.

4) Check the  Sys stratum. If the Sys stratum is 16 xntpd is not in sync
# lssrc -ls xntpd
Example output.
 Program name:    /usr/sbin/xntpd
 Version:         3
 Leap indicator:  00 (No leap second today.)
 Sys peer:        tcplab14bso.aus.stglabs.ibm.com
 Sys stratum:     4
 Sys precision:   -18
 Debug/Tracing:   DISABLED
<....>
Peer: tcplab14bso.aus.stglabs.ibm.com
      flags: (configured)(sys peer)(preferred)
      stratum:  3, version: 3
      our mode: client, his mode: server
Subsystem         Group            PID          Status
 xntpd            tcpip            241686       active

If the client is in sync the Sys stratum will NOT be 16. It will be 1 higher than that of the NTP server's Sys stratum.
Sys Stratum is  a representation of the hierarchy of the NTP servers.
The furthest possible level is Stratum 16 and a Stratum of 16 is considered not to be synchronized.
In the above example the Sys stratum is 4. This indicates that the Sys stratum on the NTP server is 3 and the client is in synch with it.

ADDITIONAL INFORMATION
Do not specify a broadcastclient directive and a server directive at the same time in /etc/ntp.conf. They are two different modes of operation. Only use one or the other. It is recommended to use the server directive as shown above instead of the broadcastclient directive.

The xntpd daemon uses UDP port 123 to communicate with the NTP server. If there is a firewall the port access must be allowed through the firewall.

To add the -x option to xntpd to prevent system clock time from going backwards use the chssys command to add it to the ODM.
-x    Makes small time adjustments. (SLEWING)
# /usr/bin/chssys -s xntpd -a "-x"
# stopsrc -s xntpd
# startsrc -s xntpd
# ps -ef |grep xntpd

For troubleshooting purposes you can start xntpd in debug mode as follows:
# startsrc -s xntpd -a "-D 10 -l /tmp/xntpd.debug"

SUPPORT:

If additional assistance is required after completing all of the instructions provided in this document, please follow the step-by-step instructions below to contact IBM to open a case for software under warranty or with an active and valid support contract.  The technical support specialist assigned to your case will confirm that you have completed these steps.

a.  Document and/or take screen shots of all symptoms, errors, and/or messages that might have occurred

b.  Capture any logs or data relevant to the situation.

c.  Contact IBM to open a case:

   -For electronic support, please visit the IBM Support Community:
     https://www.ibm.com/mysupport
   -If you require telephone support, please visit the web page:
      https://www.ibm.com/planetwide/

d.  Provide a good description of your issue and reference this technote

e.  Upload all of the details and data to your case

   -You can attach files to your case in the IBM Support Community
   -Or Upload data to IBM testcase server analysis:

    http://www.ibm.com/support/docview.wss?uid=ibm10733581

f.  Click here to submit feedback for this document.

[{"Line of Business":{"code":"LOB08","label":"Cognitive Systems"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"ARM Category":[{"code":"a8m0z000000cvxSAAQ","label":"Communication Applications->NTP\/TIMED"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]

Document Information

More support for:
AIX

Component:
Communication Applications->NTP/TIMED

Software version:
All Version(s)

Document number:
6365447

Modified date:
12 November 2020

UID

ibm16365447

Manage My Notification Subscriptions