Monday, July 25, 2011

Configuring NTP in HP-UX

Assuming is your local NTP server, then you need to edit /etc/rc.config.d/netdaemons first. Add your NTP server to NTPDATE_SERVER and change the value for XNTPD from 0 (zero) to 1 (one):

# vi /etc/rc.config.d/netdaemons
export XNTPD=1
export XNTPD_ARGS=

After that add the server to /etc/ntp.conf (in case that the file is existing already, make a backup):

# mv /etc/ntp.conf /etc/ntp.conf.orig
# vi /etc/ntp.conf
driftfile /etc/ntp.drift

The server line defines your server and the peer line defines a substitue for it. The driftfile stores variance between the local clock and the NTP server. Finally, start the NTP daemon:

/sbin/init.d/xntpd start
25 Jul 13:36:31 ntpdate[21017]: step time server offset -0.016372 sec

Check if it is running:

# ps -ef | grep ntp
    root 21019     1  0 13:36:31 ?         0:00 /usr/sbin/xntpd

# ntpq -p
     remote           refid      st t when poll reach   delay   offset    disp
==============================================================================         16 -    -   64    0     0.00    0.000 16000.0

That's it again, more information can be found here:

Update 06/26/2012: added ntpq command and output