Home >Operation and Maintenance >Linux Operation and Maintenance >Detailed explanation of how to synchronize and set the NTP server time in Linux
This article mainly introduces the relevant information of linux ntp server time synchronization settings. Friends who need it can refer to
linux ntp server time synchronization settings
Time The need for synchronization exists in many places. For example, if you install cm and cdh, you need ntp time synchronization, otherwise a red warning will appear
The main thing here is to set up a server as the main server and let other machines synchronize the time of this machine, and it is configured The local time is not synchronized with the internet time, because many times the server cannot connect to the Internet
First we set up 2 machines here, the main machine is 192.168.5.102, and the other one is 192.168.5.103
First set up the main machine
Edit the /etc/ntp.conf file
Add
## in it #
restrict 127.0.0.1 # 开启内部递归网络接口 lo restrict 192.168.5.0 mask 255.255.255.0 nomodify #在内部子网里面的客户端可以 进行网络校时,但不能修改NTP服务器的时间参数Since the configuration is local time, you also need to configure an NTP server that uses the system clock as the time source. You need to add the following records to the /etc/ntp.conf file:
server 127.127.1.0 fudge 127.127.1.0 stratun 10In the above record:
service ntpd startSet to start automatically at boot
chkconfig ntpd onThen configure the client. On the 192.168.5.103 host, edit the /etc/crontab file to set this node to synchronize with the main server every minute. Time
is set as follows:
* * * * * root /usr/sbin/ntpdate 192.168.5.102;/sbin/hwclock -w
The above is the detailed content of Detailed explanation of how to synchronize and set the NTP server time in Linux. For more information, please follow other related articles on the PHP Chinese website!