Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Explain the time synchronization settings of linux ntp server in detail

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Linux ntp server time synchronization settings

The need for time synchronization exists in many places. For example, if cm and cdh are installed, ntp time synchronization is required, otherwise a red warning will appear.

Here is mainly to set up a server as the master server, let other machines synchronize the time of this machine, and it is the configured local time, there is no synchronous internet time, because many times the server cannot be connected to the Internet.

First of all, we set up two machines here, the main machine is 192.168.5.102, and the other is 192.168.5.103

First set up the master machine

Edit / etc/ntp.conf file

Add to it

Restrict 127.0.0.1 # enable internal recursive network interface lo restrict 192.168.5.0 mask 255.255.255.0 nomodify # clients in the internal subnet can perform network time correction, but cannot modify the time parameters of the NTP server

Because the local time is configured, you also need to configure a NTP server that uses the system clock as the time source, and you need to add the following records in the / etc/ntp.conf file:

Server 127.127.1.0 fudge 127.127.1.0 stratun 10

In the above record:

The specified IP address is a "pseudo" IP address that determines 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 the clock, and without this record, the node is the first-tier server. It is a good idea to redefine the level to 10 so that when the client queries the server, it will know that the server is not a reliable source of time.

This method of time synchronization should only be used when the local network cannot use an external time source.

Then start the NTP service

Service ntpd start

Set Boot self-boot

Chkconfig ntpd on

Then configure the client to edit the / etc/crontab file on the host 192.168.5.103, which is used to set the node to synchronize time like the master server every minute.

The settings are as follows:

* root / usr/sbin/ntpdate 192.168.5.102

The above is about the linux ntp server time synchronization setting explanation, thank you for reading, hope to help you, thank you for your support to this site!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report