centos 7 NTP離線安裝部署


1.下載三個rpm離線包

ntpdate-4.2.6p5-29.el7.centos.2.x86_64

ntp-4.2.6p5-29.el7.centos.2.x86_64

autogen-libopts-5.18-5.el7.x86_64

地址:

http://mirror.centos.org/centos/7/os/x86_64/Packages/ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm

http://mirror.centos.org/centos/7/os/x86_64/Packages/ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm

http://mirror.centos.org/centos/7/os/x86_64/Packages/autogen-libopts-5.18-5.el7.x86_64.rpm

 

2.上傳至centos安裝

ntp -ivh ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm

ntp -ivh ntp-4.2.6p5-29.el7.centos.2.x86_64

ntp -ivh autogen-libopts-5.18-5.el7.x86_64.rpm

 

 

 3.查看安轉版本 rpm -q ntp

 

 

 4. 啟用ntp服務  systemctl enable ntpd 

 

 

 

 5.開始ntp服務 systemctl start ntpd

     查看狀態 systemctl status  ntpd

 

6. 編輯master的機器的文件/etc/ntp.conf

找到ntp時間同步的機器范圍配置項
restrict 192.168.3.0 mask 255.255.255.0 nomodify notrap
這里的意思代表,192.168.3的網段的機器都參與ntp的時間同步

# 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 could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1

# Hosts on local network are less restricted.
restrict 192.168.111.0 mask 255.255.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 ntp1.aliyun.com
server ntp2.aliyun.com
server ntp3.aliyun.com
server 127.0.0.1
fudge 127.0.0.1 stratum 10

#broadcast 192.168.1.255 autokey # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 autokey # multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 autokey # manycast client

# Enable public key cryptography.
#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating
# with symmetric 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

ntp.conf中有默認的時間服務器,我們需要注銷,然后添加上我們對應的時區時間服務器。
server ntp1.aliyun.com
server ntp2.aliyun.com
server ntp3.aliyun.com

 

///當以上三個時間服務器不可用時,就是以本機時間作為集群機器的統一時間。
server 127.0.0.1
fudge 127.0.0.1 stratum 10

 

 

 6.更新時間 ntpdate -u ntp2.aliyun.com

7.配置客戶機 /etc/ntp.conf  

server 192.168.111.128

同步時間命令 ntpdate -u  192.168.111.128  需要關閉防火牆


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM