The NTP time synchronization method under Linux

Source: Internet
Author: User

If the server's time is messed up, it can cause a lot of unexpected problems. Using NTP, you can make the server get the right time to avoid problems.

NTP is a network time protocol, meaning "Network Time Protocol", is a TCP/IP protocol to achieve the synchronization protocol.

Ubuntu automatically goes to NTP every time it starts. ubuntu . com to do time synchronization. However, because the server generally does not start frequently, it is still not possible to avoid time deviation, and this deviation can be very large. Therefore, we need to revise the time of the server periodically. The easiest way to do this is to use Cron's scheduled tasks to do one time synchronization a day. For example, create a file/etc/cron.daily/timeupdate:

___fckpd___0nbsp;sudo nano/etc/cron.daily/timeupdate

Then enter the following:

Ntpdate ntp.ubuntu.com

After you save the file, you also need to give it executable permissions:

___fckpd___2nbsp;sudo chmod 755/etc/cron.daily/timeupdate

This allows the system to ntp.ubuntu.com fetch time every day (all tasks under the/etc/cron.daily/directory will be executed once a day) and calibrate the server itself. If you are concerned that time has failed, you can add multiple NTP servers to the/etc/cron.daily/timeupdate file:

Ntpdate ntp.ubuntu.com pool.ntp.org

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.