(1)NTP服務器是用於局域網服務器時間同步使用的,可以保證局域網所有的服務器與時間服務器的時間保持一致,某些應用對時間實時性要求高,必須保證時間的統一性
(2)在互聯網中的時間服務器也有很多,
例如: 復旦大學免費NTP:"ntp.fudan.edu.cn
阿里雲免費NTP:"ntp1.aliyun.com"
NTP服務器的監聽端口爲UDP的123端口,如果防火牆開啓的話就需要在本地防火牆開啓運行客戶端訪問123端口
實驗系統環境
root@rsync[15:33:47]:~#cat /etc/redhat-release CentOS release 6.9 (Final)
在iptables配置文件中添加如下規則:
vim /etc/sysconfig/iptables -A INPUT -m state --state NEW -m udp -p udp --dport 123 -j ACCEPT
如圖所示
部署服務端NTP服務
第一步:yum安裝NTP
yum install ntp ntpdate -y
第二步:配置ntp.conf配置文件
#備份源配置文件 cp /etc/ntp.conf{,.bak} #清空原有文件中的配置內容 > /etc/ntp.conf #編輯ntp.conf配置文件 driftfile /var/lib/ntp/drift restrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery restrict 127.0.0.1 restrict -6 ::1 server 127.127.1.0 #