NTP Server configuration RHEL-6.6/CentOS-6.6
Network Time Protocol (NTP) is a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks. In operation since before 1985, NTP is one of the oldest Internet protocols in use. NTP was originally designed by David L. Mills of the University of Delaware, who still oversees its development.
NTP Server Configuration:-
Install the package
# yum -y install ntp
# rpm -q ntp
ntp-4.2.6p5-1.el6.x86_64
Make sure that the following lines in /etc/ntp.conf are enabled
# vim /etc/ntp.conf
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
driftfile /var/lib/ntp/drift
logfile /var/log/ntp.log
restrict 127.0.0.1 restrict -6 ::1
server 127.127.1.0
fudge 127.127.1.0
stratum 10
includefile /etc/ntp/crypto/pw keys /etc/ntp/keys
:wq!
The first restrict line allows other clients to query your time server. This restrict line has the following parameters
default is for allow all clients
noquery prevents dumping status data from ntpd.
notrap prevents control message trap service.
nomodify prevents all ntpq queries that attempts to modify the server.
nopeer prevents all packets that attempts to establish a peer association.
kod – Kiss-o-death packet is to be sent to reduce unwanted queries
The value -6 in the second line allows forces the DNS resolution to the IPV6 address resolution. For more information on the access parameters list, Please refer to documentation on “man ntp_acc”
driftfile is used to log how far your clock is from what it should be, and slowly ntp should lower this value as time progress.
If the localhost needs to have the full access to query or modify, so add the restrict 127.0.0.1
server 127.127.1.0 - if the NTP server is disconnected from the internet, NTP server provides time from its local system clock.
In the above, Stratum is used to synchronize the time with the server based on distance.
A stratum-1 time server acts as a primary network time standard.
A stratum-2 server is connected to the stratum-1 server over the network.
Thus, a stratum-2 server gets its time via NTP packet requests from a stratum-1 server.
A stratum-3 server gets its time via NTP packet requests from a stratum-2 server, and so on.
Also stratum 0 devices are always used as reference clock.
# chkconfig ntpd on
# service ntpd start
NTP Client Configuration:-
# vim /etc/ntp.conf
ntpdate -u ntpserver.example.com //- update time temporarily
server ntpserver.example.com prefer //- add this line to update time permanently from server
# service ntpd start
# chkconfig ntpd on
# ntpstat