NTPD Installation

NTPD is the daemon service for NTP server.


Step 1

yum install ntp
chkconfig ntpd on

Install ntp RPM via yum.




Step 2

vi /etc/ntpd.conf

restrict 192.168.0.0 nask 255.255.0.0

server stdtime.gov.hk prefer
#server 0.centos.pool.ntp.org
#server 1.centos.pool.ntp.org
#server 2.centos.pool.ntp.org

To edit ntp.conf basic setting

vi /etc/sysconfig/ntpd

OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid"
SYNC_HWCLOCK=yes

To edit /etc/sysconfig/ntpd basic setting




Step 3

/etc/init.d/ntpd start netstat -tlunp Proto Recv-Q Send-Q Local Address Foreign Address PID/Program name udp 0 0 192.168.1.254:123 0.0.0.0:* 15118/ntpd udp 0 0 127.0.0.1:123 0.0.0.0:* 15118/ntpd udp 0 0 0.0.0.0:123 0.0.0.0:* 15118/ntpd udp 0 0 :::123 :::* 15118/ntpd

Start ntpd and check in UDP listen port 123 for ntpd




Step 4

[root@linux ~]# ntpstat synchronised to NTP server (220.130.158.71) at stratum 3 time correct to within 495 ms polling server every 64 s [root@linux ~]# ntptrace -n 127.0.0.1 127.0.0.1: stratum 3, offset -0.034965, synch distance 0.109233 220.130.158.71: stratum 2, offset -0.000873, synch distance 0.031625 220.130.158.50: timed out, nothing received ***Request timed out [root@linux ~]# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== *220-130-158-71. 220.130.158.50 2 u 53 64 77 36.800 -10.496 1.890 220-130-158-51. .INIT. 16 u - 64 0 0.000 0.000 4000.00 +220-130-158-51. 220.130.158.50 2 u 49 64 77 33.448 -10.431 2.581 LOCAL(0) LOCAL(0) 10 l 51 64 77 0.000 0.000 0.004

Use ntpstat , ntptrace and ntpq to check the NTP connection between you server and upper NTP server.




Step 5 - Client side

ntpdate serverip

In client ntp server, try update maually first. if success update then add to cronjob.

crontab -e

0 0 * * * /usr/sbin/ntpdate serverip &> /dev/null





Server is hosted by Alanstudio
Linux Operating System

Recommend screen resolution 1024 x 768 / IE / FireFox
Alan Studio © 2007 by Alan Cheung Hin Lun. All rights reserved.