Thursday, May 5, 2016

Install NTP package on CentOS 5.11 and Configure as NTP Client


Install NTP package on CentOS 5.11 and Configure as NTP Client


If needed, search for the ntp package:
# yum search ntp
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.aol.com
 * extras: mirror.cc.columbia.edu
 * updates: mirror.net.cen.ct.gov
====================================== Matched: ntp =======================================
adjtimex.i386 : A utility for adjusting kernel time variables.
chkfontpath.i386 : Simple interface for editing the font path for the X font server.
cyrus-imapd.i386 : A high-performance mail server with IMAP, POP3, NNTP and SIEVE support
inn.i386 : The InterNetNews (INN) system, an Usenet news server.
ntp.i386 : Synchronizes system time using the Network Time Protocol (NTP).
system-config-date.noarch : A graphical interface for modifying system date and time
xfce4-fsguard-plugin.i386 : Filesystem-Guard plugin for the Xfce panel
Install NTP:
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.aol.com
 * extras: mirror.cc.columbia.edu
 * updates: mirror.net.cen.ct.gov
====================================== Matched: ntp =======================================
adjtimex.i386 : A utility for adjusting kernel time variables.
chkfontpath.i386 : Simple interface for editing the font path for the X font server.
cyrus-imapd.i386 : A high-performance mail server with IMAP, POP3, NNTP and SIEVE support
inn.i386 : The InterNetNews (INN) system, an Usenet news server.
ntp.i386 : Synchronizes system time using the Network Time Protocol (NTP).
system-config-date.noarch : A graphical interface for modifying system date and time
xfce4-fsguard-plugin.i386 : Filesystem-Guard plugin for the Xfce panel
Configure /etc/ntp.conf
# cp -pv /etc/ntp.conf /etc/ntp.conf.orig
# vi /etc/ntp.conf
(old)
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
server 3.centos.pool.ntp.org
(updated)
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 2.us.pool.ntp.org
server 3.us.pool.ntp.org
server 2.ca.pool.ntp.org
server 3.ca.pool.ntp.org
server 2.north-america.pool.ntp.org
server 3.north-america.pool.ntp.org
server 2.europe.pool.ntp.org
server 3.europe.pool.ntp.org
If the driftfile does not exist, create it:
# touch /var/lib/ntp/drift
To synchronize time:
# ntpd -qg
ntpd: time set +18024.320432s
This behavior mimics that of the ntpdate program, which I believe is now deprecated.
Next, verify that the time is now updated:
# date
Thu Apr 14 18:51:13 EDT 2016
Configure ntpd so it starts on system boot:
# chkconfig ntpd on
Finally, start the service:
# service ntpd start
Starting ntpd:                                             [  OK  ]
Run the following command to see the status of this server:
# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 2607:fa18::2407 .INIT.          16 u    -   64    0    0.000    0.000   0.000
 204.2.134.163   44.24.199.34     3 u    1   64    1  127.537   16.501   0.001
 2604:a880:cad:d .RMOT.          16 u    -   64    0    0.000    0.000   0.001
 199.19.167.36   .INIT.          16 u    -   64    0    0.000    0.000   0.001
 198.60.22.240   .INIT.          16 u    -   64    0    0.000    0.000   0.001
 2001:a60::123:2 .INIT.          16 u    -   64    0    0.000    0.000   0.001
 192.36.143.130  .INIT.          16 u    -   64    0    0.000    0.000   0.001
 127.127.1.0     .LOCL.          10 l    -   64    0    0.000    0.000   0.001

No comments:

Post a Comment