CentOS World in Linux and local time synchronization

Source: Internet
Author: User

First use the date command to see if the CentOS time is correct, date-r to see if time zone is right.

First determine if the NTP service is installed before using time synchronization, view command "Yum List | grep NTP, no then enter "Yum install Ntp-y" can be.

Temporary manual Time Synchronization command is "Ntpdate cn.pool.ntp.org", note: Ntpdate behind the time server, you can also use the China National Service Center Address "210.72.145.44″." After you get the exact time, use "hwclock-w" to update the ROM time.

Set automatic time synchronization using Crontab to implement, enter "Vi/etc/crontab" Add the following:

The code is as follows Copy Code

* * * * root/usr/sbin/ntpdate cn.pool.ntp.org &&/sbin/hwclock-w

The meaning is that every night 21:30 automatically sync time, and then write Rom.

Attached crontab file format: minutes (0-59) hours (0-23) Date (1-31) month (1-12) week (0-7) User command


Synchronizing with a locally set time server
First we need to select 1 machines to do the server
Open the configuration file on this server

The code is as follows Copy Code
Vi/etc/ntp.conf
Put restrict default Kod nomodify notrap nopeer noquery
restrict-6 default default Kod nomodify notrap nopeer noquery

#掉不用
Add below

The code is as follows Copy Code
Restrict default nomodify noquery notrap
Restrict native IP address mask native subnet mask nomodify

Save exit

The code is as follows Copy Code
Service NTPD Start

The machines that need to be synchronized after the

server is running
just have to follow the same approach as synchronizing the world's servers    just change the domain name to your server's IP address on the line ~

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.