1. 程式人生 > >生產上的NTP服務配置

生產上的NTP服務配置

ntp

NTP服務是生產環境中必須配置的一個服務。

雖然有各種機構提供時間校準服務,但很多生產服務器是沒有外網的,不能直接填那些外網時間服務來進行校準。


註意:提供NTP服務的服務器至少要保證有兩個或者兩個以上,這個很重要。


推薦使用的NTP服務器:(http://www.pool.ntp.org/zone/cn)
cn.pool.ntp.org
2.cn.pool.ntp.org
s1a.time.edu.cn
s2c.time.edu.cn
s2m.time.edu.cn
time.asia.apple.com
1.asia.pool.ntp.org
3.asia.pool.ntp.org


  1. 服務端配置文件ntp.conf


    restrict default nomodify notrap nopeer noquery


    restrict 127.0.0.1

    restrict -6 ::1

    #根據自己內網的IP段來進行設置

    restrict 172.32.1.0 mask 255.255.255.0 nomodify

    restrict 192.168.0.0 mask 255.255.255.0 nomodify


    restrict cn.pool.ntp.org

    restrict 2.cn.pool.ntp.org

    restrict s1a.time.edu.cn

    restrict s2c.time.edu.cn

    restrict s2m.time.edu.cn

    restrict time.asia.apple.com

    restrict 1.asia.pool.ntp.org

    restrict 3.asia.pool.ntp.org


    server cn.pool.ntp.org prefer

    server 2.cn.pool.ntp.org prefer

    server s1a.time.edu.cn prefer

    server s2c.time.edu.cn prefer

    server s2m.time.edu.cn prefer

    server time.asia.apple.com

    server 1.asia.pool.ntp.org

    server 3.asia.pool.ntp.org


    server 127.127.1.0

    fudge 127.127.1.0 stratum 8

    logfile /var/log/ntp.log

    driftfile /var/lib/ntp/drift

    keys /etc/ntp/keys


2、客戶端配置文件ntp.conf

driftfile /var/lib/ntp/drift

restrict default kod ignore

restrict -6 default kod ignore

restrict 127.0.0.1

restrict -6 ::1

restrict ntp服務端IP地址1

restrict ntp服務端IP地址2


server ntp服務端IP地址1 iburst

server ntp服務端IP地址2 iburst

logfile /var/log/ntp.log



生產上的NTP服務配置