Detail linux ntp server time synchronization Settings
- 2020-06-15 10:56:49
- OfStack
linux ntp server time synchronization Settings
Time synchronization is a requirement in many places. For example, installing cm and cdh requires ntp time synchronization, or a red warning will appear
This is mainly to set up a server as the primary server and let other machines synchronize the time of this machine. In addition, it is the configured local time and there is no synchronization of internet time, because most of the time the server cannot be connected to the Internet
First, we set up two machines here, the main machine is 192.168.5.102 and the other machine is 192.168.5.103
First set up the main machine
Edit /etc/ ntp.conf file
Add to it
restrict 127.0.0.1 # Open the internal recursive network interface lo
restrict 192.168.5.0 mask 255.255.255.0 nomodify # Clients within the internal subnet can Network proofreading, but can not be modified NTP Server time parameter
Since the local time is configured, you also need to configure an NTP server that USES the system clock as the time source. The following records need to be added to the /etc/ ntp.conf file:
server 127.127.1.0
fudge 127.127.1.0 stratun 10
In the above records:
The specified IP address is a "fake" IP address that identifies the local system as the time source.
The specified IP address 127.127.1.1 tells NTP to use the internal clock as the time source.
"fudge" defines the level of this clock, without which the node is a level 1 server. It is a good idea to redefine the level to 10 so that clients can query the server knowing that it is not a reliable source of time
This method of time synchronization should only be used when the local network cannot use external time sources
Then start the NTP service
service ntpd start
Set the boot to boot
chkconfig ntpd on
Then configure the client to edit /etc/crontab file on the 192.168.5.103 host to set the synchronization time for this node per minute like the master server
The Settings are as follows:
* * * * * root /usr/sbin/ntpdate 192.168.5.102;/sbin/hwclock -w
Above is the explanation of linux ntp server time synchronization Settings, thank you for reading, I hope to help you, thank you for your support to this site!