Setting up NTP in Centos 6.6
First we need to make sure we have the correct date, time, and timezone. You can verify with:# cat /etc/localtime
Set your time zone with (for Phoenix AZ USA)
#cp /usr/share/zoneinfo/America/Phoenix /etc/localtime
Now check date
# date
Sun Mar 29 01:10:44 MST 2015
You can verify this at the hardware level with:
# hwclock -r
Sun 29 Mar 2015 01:13:51 AM MST -0.156631 seconds
If these are incorrect then we can set the OS first and then update the hardware with the date command. The syntax is: date "day month year hh:mm:ss" So if we wanted to change this to March 2 2015 at 1:00pm we would use:
# date -s "2 MAR 2015 13:00:00"
When we have the date correct in the OS we can update the hardware with:
# hwclock -w
Now that we have the correct date and time lets install and setup ntp. First lets install ntp if not already installed.
# yum -y install ntp
Next edit the the ntp.conf file so we are using the correct time servers.
# vi /etc/ntp.conf
I usually use the public servers from the pool.ntp.org project of:
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
After you have those in lets start the service and make sure it is on in startup.
# service ntpd start
Starting ntpd: [ OK ]
# chkconfig ntpd on
Now lets verify the setup by looking at our peers.
# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*deekayen.net 209.51.161.238 2 u 43 64 3 75.257 -22.456 3.017
origin.towfowi. 204.9.54.119 2 u 43 64 3 31.405 -14.629 2.683
NTP2.playallian 129.6.15.30 2 u 43 64 3 50.576 -14.090 3.465
sola-dal-09.ser 10.0.77.54 4 u 42 64 3 59.879 -1.507 2.629
No comments:
Post a Comment