Tuesday, October 16, 2012

# aix ntp config with linux. ntp aix sync linux server # aix5.3

AIX 5.3 NTP client sync with Linux server

I'm going to discuss two issues here, namely 

  • Setting TZ settings on AIX 5.3
  • Configuring AIX 5.3 as client NTP to a Linux NTP server
I had two AIX 5.3 machines, and the time zones on these machines were not configured properly. The customers are based in Eastern Australia and with DST in place, they go from +3 hours to +2 hours ahead of us here in Malaysia. Initially my /etc/environment had these settings:

# more /etc/environment | grep ET

TZ=EET-2EEST,M3.5.0,M10.5.0


In English this meant that the DST started on M3.5.0 March (3) on the Sunday (0) of the fifth week (5)

You see whats going on here. If March doesn't have a fifth Sunday the bloody setting wont work!

What's even worse is that the switch back is set to M10.5.0 October (10) on the Sunday (0) of the fifth week (5)

October doesn't have 5 weeks so again the switch back isn't going to work

So I had to smitty and correct this setting

# smit chtz

Answer "1 yes" to "Use Daylight Saving Time?"


I chose Eastern Australia time zone. Once that was done, I rebooted the server and went on with the NTP syncing because the minutes were way too offset on these two boxes.

You know you have the right configuration when your /etc/environment makes "sense"

TZ=EET-10EETDT,M10.1.0,M4.1.0/03:00:00
Switch back=M4.1.0 First Sunday in April
DST=M10.1.0 First Sunday in October
03:00:00=both DST changes will occur at 3am


After a reboot to verify things were OK, I went on to sync the AIX hosts as client servers to a Linux host acting as a NTP server

1. Checked if I could ping and sync with NTP server

# ntpdate -d xxx
16 Oct 18:55:43 ntpdate[180314]: 3.4y
transmit(203.xxx)
receive(203.xxx)
transmit(203.xxx)
receive(203.xxx)
transmit(203.xxx)
receive(203.xxx)
transmit(203.xxx)
receive(203.xxx)
transmit(203.xxx)
server 203.xxx, port 123
stratum 3, precision -20, leap 00, trust 000
refid [61.110.197.50], delay 0.02597, dispersion 0.00002
transmitted 4, in filter 4
reference time:      d4278bac.df67e404  Tue, Oct 16 2012 18:30:52.872
originate timestamp: d4279180.dbad9820  Tue, Oct 16 2012 18:55:44.858
transmit timestamp:  d427917f.feabc000  Tue, Oct 16 2012 18:55:43.994
filter delay:  0.02634  0.02599  0.02599  0.02597
               0.00000  0.00000  0.00000  0.00000
filter offset: 0.863287 0.863137 0.863115 0.863123
               0.000000 0.000000 0.000000 0.000000
delay 0.02597, dispersion 0.00002
offset 0.863123

16 Oct 18:55:43 ntpdate[180314]: step time server 203.xxx offset 0.863123

The offset must be less than 1000 seconds for xntpd to synch. If the offset is greater than 1000 seconds, change the time manually on the client with #smitty date command and run the ntpdate -d again. I had to open two putty sessions, running pararel with the NTP server and run date commands on each server to check if the client server's seconds synced with the host server's seconds. The best I could come up with was 0.863123 offset

Then I edited the NTP config file to add the NTP server FQDN and IP address

vi /etc/ntp.conf

#broadcastclient
server ip.address.of.NTP.server
driftfile /etc/ntp.drift
tracefile /etc/ntp.trace

After that I restarted the NTP services on the client server

# stopsrc -s xntpd
0513-044 The /usr/sbin/xntpd Subsystem was requested to stop.
# startsrc -s xntpd
0513-059 The xntpd Subsystem has been started. Subsystem PID is 143404.

Please remember to uncomment the NTP services from system start up script so NTP will run persistently across reboots

# vi /etc/rc.tcpip
start /usr/sbin/xntpd "$src_running"


Lastly, check if the NTP services is in sync with NTP server
# lssrc -ls xntpd
 Program name:    /usr/sbin/xntpd
 Version:         3
 Leap indicator:  11 (Leap indicator is insane.)
 Sys peer:        no peer, system is insane
 Sys stratum:     16
 Sys precision:   -18
 Debug/Tracing:   DISABLED
 Root distance:   0.000000
 Root dispersion: 0.000000
 Reference ID:    no refid, system is insane
 Reference time:  no reftime, system is insane
 Broadcast delay: 0.003906 (sec)
 Auth delay:      0.000122 (sec)
 System flags:    pll monitor filegen
 System uptime:   305 (sec)
 Clock stability: 0.000000 (sec)
 Clock frequency: 0.000000 (sec)
Subsystem         Group            PID          Status
 xntpd            tcpip            143404       active
NOTE: Sys peer should display the IP address or name of your NTP server. This process may take up to 12 minutes

But after 12 minutes, I am still getting system is "insane" message BUT it detected the Linux NTP server as its host

# lssrc -ls xntpd
Program name: /usr/sbin/xntpd
Version: 3
Leap indicator: 11 (Leap indicator is insane.)
Sys peer: no peer, system is insane
Sys stratum: 16
Sys precision: -18
Debug/Tracing: DISABLED
Root distance: 0.000000
Root dispersion: 0.000000
Reference ID: no refid, system is insane
Reference time: no reftime, system is insane
Broadcast delay: 0.003906 (sec)
Auth delay: 0.000122 (sec)
System flags: pll monitor filegen
System uptime: 15 (sec)
Clock stability: 0.000000 (sec)
Clock frequency: 0.000000 (sec)
Peer: xxxx.com.my
flags: (configured)
stratum: 3, version: 3
our mode: client, his mode: server
Subsystem Group PID Status
xntpd tcpip 188452 active


Then I went one step ahead and added a second NTP host [ also a Linux server] into the /etc/ntp.conf

# vi /etc/ntp.conf

#broadcastclient
server 203.xxx
server 203.xxx
driftfile /etc/ntp.drift
tracefile /etc/ntp.trace


Then I restarted NTP services and ran the lssrc command again

# stopsrc -s xntpd
0513-044 The /usr/sbin/xntpd Subsystem was requested to stop.

# startsrc -s xntpd
0513-059 The xntpd Subsystem has been started. Subsystem PID is 163954.


# lssrc -ls xntpd

Program name: /usr/sbin/xntpd
Version: 3
Leap indicator: 11 (Leap indicator is insane.)
Sys peer: no peer, system is insane
Sys stratum: 16
Sys precision: -18
Debug/Tracing: DISABLED
Root distance: 0.000000
Root dispersion: 0.000000
Reference ID: no refid, system is insane
Reference time: no reftime, system is insane
Broadcast delay: 0.003906 (sec)
Auth delay: 0.000122 (sec)
System flags: pll monitor filegen
System uptime: 5 (sec)
Clock stability: 0.000000 (sec)
Clock frequency: 0.000000 (sec)
Peer: xxx.com.my
flags: (configured)
stratum: 3, version: 3
our mode: client, his mode: server
Peer: xxx.com.my
flags: (configured)
stratum: 2, version: 3
our mode: client, his mode: server
Subsystem Group PID Status
xntpd tcpip 163954 active


# ntpq -p
remote refid st t when poll reach delay offset disp

==============================================================================

myxxx 61.110.197.50 3 u 18 64 1 0.43 0.000 15875.0
my-xxx E210168211231.e 2 u 17 64 1 0.31 0.966 15875.0


When I checked again today, the system peer is no longer "insane" but it picked up one of the two NTP servers I had added to sync:

# lssrc -ls xntpd
Program name: /usr/sbin/xntpd
Version: 3
Leap indicator: 00 (No leap second today.)
Sys peer: xxx.com.my
Sys stratum: 3
Sys precision: -18
Debug/Tracing: DISABLED
Root distance: 0.165695
Root dispersion: 0.145218
Reference ID: 203.115.199.30
Reference time: d428ca78.f598d000 Wed, Oct 17 2012 17:11:04.959
Broadcast delay: 0.003906 (sec)
Auth delay: 0.000122 (sec)
System flags: pll monitor filegen
System uptime: 76814 (sec)
Clock stability: 43.771896 (sec)
Clock frequency: 48.000000 (sec)
Peer: yyy.com.my
flags: (configured)(sys peer)
stratum: 3, version: 3
our mode: client, his mode: server
Peer: xxx.com.my
flags: (configured)(sys peer)
stratum: 2, version: 3
our mode: client, his mode: server
Subsystem Group PID Status
xntpd tcpip 127374 active


And folks, thats how you sync AIX NTP client with Linux NTP server!

No comments:

Post a Comment