Centos 快速搭建ntp服務器
阿新 • • 發佈:2017-07-11
ntp
Centos 快速搭建ntp服務器
centos 6.5測試成功
一、 安裝並配置
yum -y install ntp ntpdate (若系統未安裝ntp服務)
vi /etc/ntp.conf (以下是ntp.conf文件的內容)
#設置此服務器同上層服務器做時間同步的IP地址,prefer意味著首選IP地址
server 218.21.130.42
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
#設置默認策略為允許任何主機進行時間同步
restrict default ignore #設置允許訪問此時間服務器的時間服務的IP地址
#根據情況自己設定
restrict 127.0.0.1
restrict 192.168.10.2#指定某臺機器時間同步
restrict 192.168.0.0 mask 255.255.255.0 #允許192.168.0.0/254子網內主機時間同步
restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap #允許任何主機跟進行時間同步
二、 啟動服務(關閉防火墻或者開端口)
service ntpd start
時間同步
ntpdate 192.168.1.xx(ntp服務器ip)
Centos 快速搭建ntp服務器