Construction of NTP time server
1. Brief introduction to NTP
NTP (Network Time Protocol, Network time Protocol) is a protocol used to synchronize the time of various computers in the network. Its purpose is to synchronize the computer clock to UTC UTC. Its accuracy can reach 0.1ms in the local area network and 1-50ms in most places on the Internet.
NTP server uses NTP protocol to provide time synchronization service.
2. NTP server installation
Yum-y install ntp
Vim / etc/ntp.conf
Allow any client of ip to synchronize time
Modify the restrict default kod nomodify notrap nopeer noquery to look like this line:
Restrict default nomodify # nomodify client can synchronize
# change the default time synchronization source annotation to an available source
# 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
Server ntp1.aliyun.com
Server time.nist.gov
Add timing task synchronization time
Crontab-e
* / 5 * / usr/sbin/ntpdate time.nist.gov > / dev/null 2 > & 1
/ etc/init.d/ntpd start
Chkconfig ntpd on
Ntpq-p ntpstat # to see synchronization status
3 client time synchronization
Crontab-e
* / 15 * / usr/sbin/ntpdate 192.168.100.102 (server-side IP)
Be careful
The client will have to wait a few minutes before synchronizing with the newly started ntp server, otherwise it will prompt a no server suitable for synchronization found error