Linux time synchronization ntp service installation and configuration, linux time synchronization ntp service

Source: Internet
Author: User

Linux time synchronization ntp service installation and configuration, linux time synchronization ntp service

When we need to manage the time of multiple servers, it is too troublesome to modify one server. The NTP service can solve this problem for us!

1. First install NTP

[root@localhost /]# yum install ntp -y

2. Modify the NTP configuration file and add the network location of the NTP server/etc/ntp. conf

# For more information about this file, see the man pages # ntp. conf (5), ntp_acc (5), ntp_auth (5), ntp_clock (5), ntp_misc (5), ntp_mon (5 ). driftfile/var/lib/ntp/drift # Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. restrict default nomodify notrap nopeer noquery # Permit all access over the loopback interface. this cocould # be tightened as well, but to do so wocould effect some of # the administrative functions. restrict 127.0.0.1restrict: 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 (http://www.pool.ntp.org/join.html ). server 192.168.1.1 iburst # network location of the target server # server 1.centos.pool.ntp.org iburst # The following three are the official NTP servers of CentOS, comment out # server multicast iburst # broadcast 192.168.1.255 autokey # broadcast server # broadcastclient # broadcast client # broadcast multicast autokey # multicast server # multicastclient 224.0.1.1 # multicast client # manycastserver region # manycast server # manycastclient 239.424254.254 autokey # manycast client # Enable public key cryptography. # cryptoincludefile/etc/ntp/crypto/pw # Key file containing the keys and key identifiers used when operating # with Your Ric key cryptography. keys/etc/ntp/keys # Specify the key identifiers which are trusted. # trustedkey 4 8 42 # Specify the key identifier to use with the ntpdc utility. # requestkey 8 # Specify the key identifier to use with the ntpq utility. # controlkey 8 # Enable writing of statistics records. # statistics clockstats cryptostats loopstats peerstats # Disable the monitoring facility to prevent amplification attacks using ntpdc # monlist command when default restrict does not include the noquery flag. see # CVE-2013-5211 for more details. # Note: Monitoring will not be disabled with the limited restriction flag. disable monitor

Save and exit

3. Start the service and set to enable auto-start

[Root @ localhost/] # systemctl start ntpd. service # start the service
[Root @ localhost/] # systemctl enable ntpd. service # Set it to boot

4. view the running status

[Root @ localhost/] # systemctl status ntpd. service
● Ntpd. service-Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd. service; enabled; vendor preset: disabled)
Active: active (running) since 13:34:11 CST; 8 min ago
Main PID: 6497 (ntpd)
CGroup:/system. slice/ntpd. servicess
2017-6497/usr/sbin/ntpd-u ntp: ntp-g

October 11 13:34:11 localhost. localdomain ntpd [6497]: Listen and drop on 1 v6wildcard: UDP 123
October 11 13:34:11 localhost. localdomain ntpd [6497]: Listen normally on 2 lo 127.0.0.1 UDP 123
October 11 13:34:11 localhost. localdomain ntpd [6497]: Listen normally on 3 eno16777736 192.168.100.100 UDP 123

The current status is running.

 

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.