Set up an ntp server in Centos

Source: Internet
Author: User
In the production environment, linux server time synchronization is important. The following describes how to build a time server. One slave build time server 1、install ntpservertarzxvfntp-4.2.6.tar.gz cdntp-4.2.6./configure -- prefix =/usr/local/ntp -- enable-all-clocks -- enable-parse-clocksmake & am

In the production environment, linux server time synchronization is important. The following describes how to build a time server.
1. set up a time server
1. install ntp server on a linux server

Tar zxvf ntp-4.2.6.tar.gz
Cd ntp-4.2.6
./Configure -- prefix =/usr/local/ntp -- enable-all-clocks -- enable-parse-clocks
Make & make install

2. modify the ntp. conf configuration file.
Vi/etc/ntp. conf
# Permit time synchronization with our time source, but do not
# Permit the source to query or modify the service on this system.
# Restrict default kod nomodify notrap nopeer noquery
Restrict default nomodify
(Allow the client of any IP address to synchronize time. if you only allow the client of a certain network segment to synchronize time, you can write
Restrict 10.58.26.0 mask quota limit 255.0 nomodify)

Restrict-6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface. This cocould
# Be tightened as well, but to do so wocould effect some
# The administrative functions.
Restrict 127.0.0.1
Restrict-6: 1

# Hosts on local network are less restricted.
# Restrict 192.168.1.0 mask limit 255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool
# Server 0.rhel.pool.ntp.org (default time server)
# Server 1.rhel.pool.ntp.org (default time server)
# Server 2.rhel.pool.ntp.org (default time server)
Server 10.128.14.25 (manually set the time server)
(If you can directly connect to the Internet, you can use the three sets of standard time servers provided by default in LINUX; otherwise, you can specify a synchronization time source by yourself)

# Broadcast 192.168.1.255 key 42 # broadcast server
# Broadcastclient # broadcast client
# Broadcast 224.0.1.1 key 42 # multicast server
# Multicastclient 224.0.1.1 # multicast client
# Manycastserver 239.415254.254 # manycast server
# Manycastclient 239.415254.254 key 42 # manycast client

# Undisciplined Local Clock. This is a fake driver intended for backup
# And when no outside source of synchronized time is available.
Server 127.127.1.0 # local clock
Fudge 127.127.1.0 stratum 10

3. start ntpd with a daemon
#/Etc/rc. d/init. d/ntpd-c/etc/ntp. conf-p/tmp/ntpd. pid
#/Etc/rc. d/init. d/ntpd start
# Ps-ef | grep ntpd

4. after the ntp service is started on the ntp server, it may take five minutes for the ntp server to synchronize itself or with its server, during this time, when the client runs the ntpdate command for synchronization, the no server suitable for synchronization found error will occur.

So how do I know when the ntp server completes the synchronization process with itself?

Run the following command on the ntp server:

# Watch ntpq-p

The following figure is displayed:

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.