Sunday, September 11, 2011

How to configure NTP in AIX 7.1

First, verify that you have a server suitable for synchronisation. Do note that the offset must be less than 1000 seconds for xntpd to sync. If the offset is more than 1000 seconds, change the time manually on the client and try again. Ensure that firewall is opened for port 123.

# ntpq -d 10.10.10.254
ntpq> ^C

# ntpdate -d 10.10.10.254
23 Feb 14:41:24 ntpdate[4653300]: 3.4y
transmit(10.10.10.254)
receive(10.10.10.254)
transmit(10.10.10.254)
receive(10.10.10.254)
transmit(10.10.10.254)
receive(10.10.10.254)
transmit(10.10.10.254)
receive(10.10.10.254)
transmit(10.10.10.254)
server 10.10.10.254, port 123
stratum 2, precision -18, leap 00, trust 000
refid [10.10.10.250], delay 0.02632, dispersion 0.00002
transmitted 4, in filter 4
reference time:      d10f27e7.15e9bbb7  Wed, Feb 23 2011 14:29:59.085
originate timestamp: d10f2a94.f62731bd  Wed, Feb 23 2011 14:41:24.961
transmit timestamp:  d10f2a94.f62e7000  Wed, Feb 23 2011 14:41:24.961
filter delay:  0.02638  0.02632  0.02637  0.02637
               0.00000  0.00000  0.00000  0.00000
filter offset: -0.00046 -0.00047 -0.00050 -0.00051
               0.000000 0.000000 0.000000 0.000000
delay 0.02632, dispersion 0.00002
offset -0.000479

23 Feb 14:41:24 ntpdate[4653300]: adjust time server 10.10.10.254 offset -0.000479
Now specify xntp server in /etc/ntp.conf. Add in the line "server ip-address-of-the-server prefer". Leave the driftfile and tracefile at their defaults.
vi /etc/ntp.conf
Now, ensure xntpd is started after every reboot.
vi /etc/rc.tcpip
Uncomment the following line
start /usr/sbin/xntpd "$src_running"
Then, start the client and verify.
# lssrc -s xntpd
Subsystem         Group            PID          Status
 xntpd            tcpip                         inoperative
startsrc -s xntpd
0513-059 The xntpd Subsystem has been started. Subsystem PID is 4391134.
#lssrc -s xntpd
Subsystem         Group            PID          Status
 xntpd            tcpip            4391134      active
# ntpq -p
     remote           refid      st t when poll reach   delay   offset    disp
==============================================================================
*10.10.10.254   10.10.10.250      2 u   25   64  377     0.87    0.266    0.02
For AIX NTP server, Firstly, verify that you have a suitable NTP server. "Sys peer" should show a valid server or 127.127.1.0. Otherwise, if the server is "insane", you will need to ad a server line to /etc/ntp.conf and restart xntpd.
# lssrc -ls xntpd
 Program name:    /usr/sbin/xntpd
 Version:         3
 Leap indicator:  00 (No leap second today.)
 Sys peer:        10.10.10.254
 Sys stratum:     3
 Sys precision:   -18
 Debug/Tracing:   DISABLED
 Root distance:   0.002701
 Root dispersion: 0.001129
 Reference ID:    10.10.10.254
 Reference time:  d10f3206.cca44000  Wed, Feb 23 2011 15:13:10.799
 Broadcast delay: 0.003906 (sec)
 Auth delay:      0.000122 (sec)
 System flags:    bclient pll monitor filegen
 System uptime:   2653 (sec)
 Clock stability: 1.338257 (sec)
 Clock frequency: 0.000000 (sec)
 Peer: 10.10.10.254
      flags: (configured)(sys peer)(preferred)
      stratum:  2, version: 3
      our mode: client, his mode: server
Subsystem         Group            PID          Status
 xntpd            tcpip            4391134      active
To add server line into /etc/ntp.conf
vi /etc/ntp.conf
Add the following ilne and ensure "broadcast client" is commented out.
server 127.127.1.0
Restart xntpd
stopsrc -s xntpd
startsrc -s xntpd
If the server runs databases, use the -x flag to prevent the clock from changing in a negative direction. Add into /etc/rc.tcpip if necessary. Remember to use the double quote as in "-x". The whole process may take up to 12 minutes.

No comments: