centos 7 搭建ntp 伺服器

來源:互聯網
上載者:User

標籤:

第一步 安裝ntp

yum install ntp

第二步,尋找最近的時間同步伺服器

http://www.pool.ntp.org/zone/asia

第三部編輯 /etc/ntp.conf

server  127.127.1.0  iburst   # local clock 當外部時間伺服器停用時候,使用本機時間作為時間服務的標準
fudge 127.127.1.0 stratum 10 #這個值不能太高0-15,太高會報錯

第四步

添加允許訪問的ip 段

restrict 192.168.1.0 netmask 255.255.255.0 nomodify notrap

 

第五步 配置防火牆

firewall-cmd --add-service=ntp --permanent
firewall-cmd --reload

 

第六步 啟動ntp 服務

systemctl enable ntpd  開機啟動

systemctl start ntpd

sytemctl status ntpd

 

第七步 驗證服務

ntpq -p



date -R

 

第八步

同步遠程時間服務

ntpdate -q  0.ro.pool.ntp.org  1.ro.pool.ntp.org

 

 

第九步 在用戶端機器同步時間

ntpdate -d -b 192.168.85.20

 

可能遇到的問題

1 centos stratum 0, precision 0, leap 00, trust 000 no server suitable for synchronization found

這個問題是由於防火牆擋住了ntp 連接埠,使用上買你的firewall-cmd 命令解決

 

2 stratum  too high 的問題

在/etc/ntp.conf 中 修改 stratum 的值

 

3 NTP開機無法啟動的解決方案

這個問題往往是由於npt 服務的123 連接埠被其他服務佔用引起,這個佔用服務一般是chronyd

禁用這個服務即可

systemctl disable chronyd

centos 7 搭建ntp 伺服器

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.