ntp時鐘同步(離線)

1、操作系統:redhat6.7

2、環境:公司內網,禁止上外網,選擇一個服務器爲主時鐘服務器,其他6個與其同步;

a、主服務器添加的內容:

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1 
restrict -6 ::1
# 允許內網其他機器同步時間 改爲自己的網段
 restrict 10.2.XX.XX(自己的主機的IP) mask 255.255.255.0 nomodify notrap

#代碼註釋

#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst
# 因爲是內網,以本地時間作爲時間服務
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10
 

b、其他6個從服務器的配置相同,如下:

server 10.2.xx.xx(主服務器IP)

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

restrict 127.0.0.1 
restrict -6 ::1

#代碼註釋

#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst

restrict 10.2.xx.xx(主服務器IP)  nomodify notrap noquery
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

到此爲止,配置完成。

主服務器執行:

           ntpdate 10.2.xx.xxx

          service ntpd restart

          chkconfig --level 2345 ntpd on

其他6臺服務器,同時或者依次執行:

         service ntpd restart

          chkconfig --level 2345 ntpd on

        ntpdate -u  10.2.xx.xx(主服務器IP)

      等待5分鐘左右,查看是否同步(ntpq -p )。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章