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

How CentOS configures NTP services

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is about how CentOS configures NTP services. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

NTP is a network time protocol (Network Time Protocol), and NTP service ensures that the local time of the server is synchronized with the standard time.

▶ configuration time zone information

1. Delete the local time link in the system

Sudo rm / etc/localtime

2. Edit the file / etc/sysconfig/clock

Cat / etc/sysconfig/clockZone=Asia/ShanghaiEOM

3. Update time zone information

Sudo ln-sf / usr/share/zoneinfo/Asia/Shanghai / etc/localtime

4. Update the hardware clock (RTC)

Hwclock-w

5. Restart the machine

Introduction to sudo reboot ▶ NTP Service

1. NTP and NTPDATE

In Linux system, NTP time synchronization can be achieved through ntpdate and ntpd. Ntpdate is a breakpoint update and ntpd is a step-by-step step-by-step adjustment of time. For new servers, you can use ntpdate synchronization time. For servers that already host running business, it is recommended to use ntpd synchronization time.

2. Install NTP & NTPDATE

Yum install-y ntp ntpdate

3. Use NTPDATE to synchronize time

Ntpdate-u ntp2.aliyun.com ▶ configuration Custom NTP Service

1. Edit the NTP configuration file

Sudo vi / etc/ntp.conf

2. Find the record of the server ntp server iburst and comment it out with #

3. Add the address of Ali Cloud NTP server

Server ntp2.aliyun.com iburstserver ntp3.aliyun.com iburstserver ntp4.aliyun.com iburst

After editing, save and exit

4. Enable NTP service

Reminder: before enabling the service, be sure to configure the firewall and security group, and open port 123 protocol UDP

Sudo service ntpd start

Power on and start automatically

Sudo systemctl enable ntpd

5. View the status of NTP service

Ntpstat

The output is as follows, indicating that in synchronization, you need to wait patiently for a few seconds.

Unsynchronised time server re-starting polling server every 8 s

The output is as follows, which indicates that the synchronization is successful

Synchronised to NTP server (203.107.6.88) at stratum 3 time correct to within 237 ms polling server every 64 s Thank you for reading! This is the end of the article on "how to configure NTP Services for CentOS". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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