CentOS搭建內網NTP伺服器
阿新 • • 發佈:2018-12-03
在企業內部網路,不是所有的伺服器都可以連線外網,需要搭建一臺可以連線外網的伺服器用於NTP伺服器
安裝環境檢視
安裝ntp
yum -y install ntp
修改配置檔案
driftfile /var/lib/ntp/drift restrict default nomodify notrap nopeer noquery restrict 127.0.0.1 restrict ::1 restrict 10.1.3.0 mask 255.255.255.0 #可以使用該伺服器的IP server ntp1.aliyun.com #設定一個公網NTP伺服器 includefile /etc/ntp/crypto/pw keys /etc/ntp/keys disable monitor
重啟NTP服務
systemctl restart ntpd
隨意給本機設定一個時間
date -s "2018-03-22 1:00:00"
過一會大概幾分鐘檢視是否同步
ntpq -p
客戶端同步
ntpdate 10.1.1.230
如果在客戶端同步報錯則稍等一會即可,是伺服器端未正常同步,同時伺服器端關閉防火牆和Selinux