Thursday, November 15, 2007

Configuring NTP in *nix or BSD

edit /etc/ntp.conf
---------------------------
server 0.pool.ntp.org # A stratum 1 server at ntp.org
server 1.pool.ntp.org # A stratum 1 server at ntp.org
server time.nist.gov # A stratum 2 server at nist

restrict 0.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 1.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict time.nist.org mask 255.255.255.255 nomodify notrap noquery

restrict 10.10.1.0 mask 255.255.255.0 nomodify notrap

restrict 127.0.0.1
---------------------------


On linux systems that use chkconfig utility:
---------------------------
chkconfig ntpd on
service ntpd start
service ntpd stop
service ntpd restart
---------------------------


On other systems:
---------------------------
pkill -HUP -x ntpd
---------------------------


Verify that ntpd is running:
---------------------------
ps auxwww | grep ntpd
---------------------------


Syncronize

check the date: `date`
stop ntpd: `pkill -x ntpd`
run ntpdate: `ntpdate -u `
note: its possible that this command may need to be run several times.
use the offset to determine acceptable offset values.
start ntpd:
check sync: `ntpq -p`

No comments: