Recently, we often encounter some faults caused by synchronization of time on each server. Now we need to build a CentOS time server to adjust and upgrade the ntp time package. # The specific configuration of yum-yinstallntp has been modified, here, I will check the configuration file so that the logout is not displayed # grep-v ^ # etcntp. confrestrictdefaultkodnomodifyn
Recently, we often encounter some faults caused by synchronization of time between servers. Now we need to set up a CentOS time server to adjust it.
Update and install the ntp time package
# Yum-y install ntp
The specific configuration has been modified. Here I will check the configuration file so that the logout is not displayed.
#Grep-V "^ #">/etc/ntp. conf
ResTrIct default kod nomodify notrap nopeer noquery
Restrict-6 default kod nomodify notrap nopeer noquery
Restrict 127.0.0.1
Restrict 192.168.10.0 mask 255.255.255.0 # This line is newly added so that the address can use the time server, which is equivalent to acl control.
Restrict-6: 1
Server ntp. fudan.EdU.cn prefer # A new priority is added. prefer indicates priority.
Server 0.rhel.pool.ntp.org
Server 1.rhel.pool.ntp.org
Server 2.rhel.pool.ntp.org
Server 127.127.1.0 # local clock
Fudge 127.127.1.0 stratum 10
DriftFile/Var/lib/ntp/drift
Keys/etc/ntp/keys
Start the service
Service ntpd start
NetStat-Tlunp
Check whether the 123udp port is started. Now we can log on to the client machine for synchronization.
[Root @ localhost ~] # NtpDate192.168.10.231
16 Jun 18:25:53 ntpdate [10535]: stepTimeServer 192.168.10.231 offSet1538.540766 sec