From:http://www.linuxidc.com/Linux/2014-07/104371.htm
Quickly build ntp time synchronization server under Linux
background:
With more servers, it is very important whether the time is consistent and whether it is prepared. Although this problem is always ignored, it is necessary to unify the time. It is common for service problems due to time problems. This article briefly introduces the fast speed of ntp under Linux. Build and use.
CentOS NTP server installation and configuration http://www.linuxidc.com/Linux/2014-01/95258.htm
NTP server of Linux actual combat deployment serieshttp ://www.linuxidc.com/Linux/2013-11/92275.htm
NTP client configuration for various operating systems http://www.linuxidc.com/Linux/2013-10/91928.htm
Build an enterprise-level NTP time serverhttp ://www.linuxidc.com/Linux/2014-02/97205.htm
1. Install ntp
yum -y install ntp (just install yum directly)
2. Modify the configuration of ntp.conf
1)vim /etc/ntp.conf
① Configuration method 1: Only clients on the 192.168.100.0 network segment are allowed to perform time synchronization
Add a line after restrict default kod nomodify notrap nopeer noquery (meaning to deny time synchronization for all IPs by default):
restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap
② Configuration method 2: Allow any ip client to perform time synchronization
Modify restrict default kod nomodify notrap nopeer noquery to the following line:
Restrict default nomodify
The setting of permissions is mainly set by the parameter restrict. The main syntax is:
restrict IP address mask Subnet mask parameter
The IP can be either an IP address or default, and default refers to all IPs
The main parameters are as follows:
ignore : Turn off all NTP online services
nomodify: The client cannot change the time parameters of the server, but the client can perform network time calibration through the server.
notrust: The client origin will be treated as an untrusted subnet unless the client is authenticated
noquery: do not provide client-side time queries
2), use the server parameter to set the superior time server, the syntax is:
server IP address or domain name [prefer]
The IP address or domain name is the upper-level time server we designate. If the server parameter is added with prefer at the end, it means that our NTP server is mainly calibrated with the time of this host.
3), solve the transmission delay when the NTP server calibrates the time
Use the driftfile parameter to set:
driftfile filename
The time spent in contacting the superior time server is recorded in the file following the driftfile parameter.
Note: The file following driftfile needs to use the full path file name, not a link file, and the file permissions need to be set to be writable by the ntpd daemon.
/usr/share/zoneinfo This directory stores the setting files corresponding to each time zone
/etc/localtime local system time setting file
/etc/sysconfig/clock local time zone setting file
To enable the NTP service to start automatically at system boot, execute:
chkconfig ntpd on
Write the synchronized time into the CMOS
vim /etc/sysconfig/ntpd
SYNC_HWCLOCK=yes
After modifying the configuration file, you need to restart:
Remember to restart the service every time you modify the configuration file to make the configuration take effect. You can use the following command to check whether the NTP service is started. If it is started, you can get a process ID number;
pgrep ntpd
Check the status of the time server synchronization with the following command:
ntpq -p
You can also view some synchronization status information with ntpstat ,
After the installation is complete, it takes 5-10 minutes for the client to update the time from the server
Client Settings:
crontab -e
add a line
*/15 * * * * /usr/sbin/ntpdate 192.168.100.102 (server IP)
This article permanently updates the link address : http://www.linuxidc.com/Linux/2014-07/104371.htm
++
+
|
|
+
++