在不連接配接外網的情況下提供時間同步服務
RHEL7.x及CentOS7.x以上預設安裝有chrony服務
-----------服務端
yum -y install chrony
vim /etc/chrony.conf
#添加以下參數,IP位址為本機IP,同時可以注釋掉其他的服務位址
server 127.0.0.1 iburst
# Serve time even if not synchronized to a time source.開啟該服務,在不與外網同步時間的情況下,依然為下層終端提供同步服務
local stratum 10
#allow用來标記允許同步的網段或主機,下例是允許192.168.10.0/24這個網段的終端來同步,127/8是本機和自己同步。
allow 192.168.10.0/24
allow 127/8
儲存後開啟服務
systemctl restart chronyd
systemctl enable chronyd
防火牆設定
firewall-cmd --permanent --add-service=ntp
firewall-cmd --reload
------------終端
vim /etc/ntp.conf
#添加以下參數(ntp服務适用rhel6.x及以下版本)
server 192.168.10.254
restrict 192.168.10.254 nomodify notrap noqery
service ntpd restart
chkconfig ntpd on
#手動同步
ntpdate -u 192.168.10.254
-------------windows系統
直接時間設定中設定同步
對于在域中的windows作業系統
運作“gpedit.msc”,依次展開“計算機配置”-“管理模版”-“系統”-“Windows 時間服務”-“時間提供程式”-“配置 Windows NTP 用戶端”,啟用該項配置,并将類型更改為“NTP”,設定時間伺服器位址.
立即生效組政策
gpupdate /force