Centos6.8 configuration Server NTP Service
Centos6.8 configuration Server NTP Service
1.1. Configure the server NTP service 1.1.1. Install and configure NTP
Check if NTP is installed first.
Rpm-qa | grep ntp
Install if not installed
Yum-y install ntp
Set East eighth District time Zone as current time Zone
Rm-rf / etc/localtime
Cp / usr/share/zoneinfo/Asia/Shanghai / etc/localtime
Manually synchronize the network time
Ntpdate-u cn.pool.ntp.org
Configure after installation
Vi / etc/ntp.conf
/ / add the following configuration
/ / allow any host to synchronize time by default
Restrict default ignore
/ / the most active time server in China
Server cn.pool.ntp.org perfer # China National time-receiving Center
Server 0.cn.pool.ntp.org # 1.cn.pool.ntp.org
Server 1.cn.pool.ntp.org
Server asia.pool.ntp.org
Server 0.asia.pool.ntp.org
Server1.asia.pool.ntp.org
/ / allow the upper time server to actively modify the local time
Restrict cn.pool.ntp.org nomodify notrap noquery
Restrict 0.cn.pool.ntp.org nomodify notrap noquery
Restrict 1.cn.pool.ntp.org nomodify notrap noquery
Restrict asia.pool.ntp.org nomodify notrap noquery
Restrict 0.asia.pool.ntp.org nomodify notrap noquery
Restrict 1.asia.pool.ntp.org nomodify notrap noquery
/ / when the external time server is not available, use local time as the time service
Server 127.127.1.0 # local clock
Fudge 127.127.1.0stratum 10
1.1.2. Set NTP service self-startup
Set ntp as a self-starting item
Chkconfig ntpd on
Check to see if startup items 2, 3, 4, 5 are open
Chkconfig-list ntpd
Start the NTP service
/ etc/init.d/ntpd restart
Check the service and monitoring, and look at the places marked in red, indicating that the current ip connection and monitoring are correct
Netstat-tlunp | grep ntp
Check the NTPD service. Wait 5-10 minutes before checking.
/ / 1 View time synchronization status. After startup, it usually takes about 5-10 minutes to start synchronizing time with the external time server. You can query the NTPD service by command
Ntpstat
/ / 2 View the NTP servers on the network and show the relationship between the client and each server
Ntpq-p
/ / local appears in the red box, indicating that the local clock source is configured successfully