How to configure a NTP server?

sábado, 19 de maio de 2012

Enable the ntp server in the config file /etc/rc.config.d/netdaemons:
# vi /etc/rc.config.d/netdaemons..
# this variable list the nfs servers separated by space.
export NTPDATE_SERVER='ntp.mycorp.com pool.ntp.org in.pool.ntp.org'
# This flag enable the ntp service to start with the server
export XNTPD=1
# See man pages to see the options available
export XNTPD_ARGS=

Setup the time zone in /etc/TIMEZONE file (look for TZ variable):
# vi /etc/TIMEZONE
..
# Use your time zone here, you can check man pages for see others examples for time zone.
TZ=MST7MDT

Edit the ntp.conf configuration file:
# vi /etc/ntp.conf
..
server unix-box-ntp
# ntp server used (poll) to obtain time
server delhi-ntp
# a peer relationship with another ntp server
peer delhi-noc-ntp
# driftfile : track local clock time (drift of the local clock)
driftfile /etc/ntp.drift

Start the NTP service:
# /sbin/init.d/xntpd start

Check if xntpd service is running:
# ps -ef | grep xntpd

Verify if the NTP server is working fine:
# ntpq -p

For troubleshot check the syslog (/var/adm/syslog/syslog.log).