Home >Operation and Maintenance >Linux Operation and Maintenance >How to configure automatic time synchronization on Linux cloud server

How to configure automatic time synchronization on Linux cloud server

WBOY
WBOYforward
2023-05-23 15:46:061809browse

Time synchronization command:

ntpdata time.windows.com

Automatic time synchronization:

Need to configure the /etc/crontab file to automatically execute tasks and allow Linux to automatically synchronize time from time.windows.com

vi /etc/crontab

Add a sentence:

00 0 1 * * root ntpdate -s time.windows.com

time.nist.gov is a time server

Linux time server configuration (192.168.10.1)

# rpm -ivh ntp-4.1.2-4.EL3.1.i386.rpm
# vi /etc/ntp.conf

Comment a line

restrict default ignore

Add a line

restrict 192.168.10.0 mask 255.255.255.0 notrust nomodify notrap
# vi /etc/ntp/step-tickers

Add a line

pool.ntp.org

In this way, every time ntpd starts, it will automatically connect to the international standard time server

 # service ntpd start
 # netstat -an |grep 123

Make sure the port is open in udp mode

Time client configuration (192.168.10.2)

 # ntpdate 192.168.10.2

Should show successful synchronization

# crond -e

Join

0-59/10 * * * * /usr/sbin/ntpdate 192.168.10.1

means synchronizing time every 10 minutes

The above is the detailed content of How to configure automatic time synchronization on Linux cloud server. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete