Wednesday, March 22, 2017

HPUX NTP setup

/etc/hosts
192.168.1.4. ntp1
192.168.1.5  ntp2

/etc/ntp.conf
server 127.127.1.0  #Local clock
fudge 127.127.1.0 stratum 10

server ntp1 prefer
server ntp2

/etc/rc.config.d/netdaemons
export NTPDATE_SERVER=ntp1
export XNTPD=1
export XNTPD_ARGS="-l /var/adm/xntpd.log"

NTP Pool as alternate external NTP if ports are open:  north-america.pool.ntp.org

My recommendation is for NTP entries to be in DNS as cname records and then just reference the cname records in your configuration files... so if you ever need to change the NTP server you do not have to edit hundreds of client NTP client files.  Just update the DNS entries for NTP1 NTP2 etc.

The reason you update /etc/ntp.conf as well as ntpdate in the netdaemons file... is that ntpdate is intended for a single use on boot up... then from that point on... it gets updated from xntpd running from the /etc/ntp.conf configuration.  The reason for this is that xntpd will refuse to start if the local clock is off by more than 1000 seconds off from the NTP server you wish you get time from and if this happens the xntpd won't start and time will be way off until someone notices... manually runs ntpdate and then starts xntpd again.  Be careful not to cause your clock to go backwards or jump ahead after a database or application is running if it is sensitive to time.  Be sure to read about setting the options to SLEW the clock if you have things like a database running when you need to affect a large time change.