How to configure automatic time synchronization on Linux cloud server

WBOY
Release: 2023-05-23 15:46:06
forward
1668 people have browsed it

Time synchronization command:

ntpdata time.windows.com
Copy after login

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
Copy after login

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
Copy after login

Comment a line

restrict default ignore
Copy after login

Add a line

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

Add a line

pool.ntp.org
Copy after login

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

# service ntpd start # netstat -an |grep 123
Copy after login

Make sure the port is open in udp mode

Time client configuration (192.168.10.2)

# ntpdate 192.168.10.2
Copy after login

Should show successful synchronization

# crond -e
Copy after login

Join

0-59/10 * * * * /usr/sbin/ntpdate 192.168.10.1
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!