Linux NTP service Setup

Source: Internet
Author: User

Background:

When the server is more, the time is accurate or not, the consistency is a problem. So it is necessary to unify the time.

Here's how to configure a Linux time server within a LAN.

Configuration environment and requirements:

1. Assume that the Linux machine with IP 192.168.1.201 is the time server in the 192.168.1.0 network segment.

2.192.168.1.201 server can Sisu network, can be synchronized with the more authoritative public network time server.

3. Other machines in the same network segment automatically synchronize time to 192.168.1.201 every minute.

Preparation method:

1. Yum Install ntpdate-y download NTP

/ETC/INIT.D/NTPD Start Open ntpd

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/8A/9A/wKiom1g1A63DAHj8AAAK53Fk4-E995.png "title=" 1.png " alt= "Wkiom1g1a63dahj8aaak53fk4-e995.png"/>

2. cd/etc CP ntp.conf Ntp.conf.bak backup NTP configuration file

Vim (vi) ntp.conf then you can see there are four rows of server

Edit the first line to server time.windows.com and then save the exit.

Then/etc/init.d/ntpd restart Restart NTPD

Can see if the time has changed (of course, if your time is incorrect)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/8A/9A/wKiom1g1B8iSFZ7xAAA8eGa2Zn4621.png "title=" 2.png " alt= "Wkiom1g1b8isfz7xaaa8ega2zn4621.png"/>

3. You can now configure other servers to connect to the 192.168.1.201

Yum install ntpdate-y download NTP

/ETC/INIT.D/NTPD Start Open ntpd

Set a timed task

Crontab-e

*/1 * * * */usr/sbin/ntpdate 192.168.1.201 >>/tmp/log

Synchronize with 192.168.1.201 server every minute and enter into/tmp/log

Then wait a little while to see the results.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/8A/9B/wKiom1g1FxahmVCkAACIH9geB9M755.png "style=" float: none; "title=" 3.png "alt=" Wkiom1g1fxahmvckaacih9geb9m755.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/8A/98/wKioL1g1FxnAWVUHAACRIy6jqTM096.png "style=" float: none; "title=" 4.png "alt=" Wkiol1g1fxnawvuhaacriy6jqtm096.png "/>

Of course, the 2 machine time synchronized with the 192.168.1.201 host is the best error. Otherwise it's not good to compare.

The following is the log

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/8A/98/wKioL1g1F87SSUxuAACJtXkAFbQ457.png "style=" float: none; "title=" 5.png "alt=" Wkiol1g1f87ssuxuaacjtxkafbq457.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/8A/9B/wKiom1g1F9OBroYjAACG9NGeSkw251.png "style=" float: none; "title=" 6.png "alt=" Wkiom1g1f9obroyjaacg9ngeskw251.png "/>

Time also synchronized well. Logs are also available. So everything is fine.

Linux NTP service Setup

Related Article

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.