NTP服務器的搭建和時間同步

一、NTP服務器
1.安裝NTP服務

yum install -y ntp

2.修改ntp的配置文件
[root@localhost ~]# grep -Ev “#|$” /etc/ntp.conf
driftfile /var/lib/ntp/drift
pidfile /var/run/ntpd.pid
logfile /var/log/ntp.log
restrict -4 default kod notrap nomodify
restrict -6 default kod notrap nomodify
restrict 127.0.0.1
restrict ::1
server ntp.aliyun.com iburst minpoll 4 maxpoll 10
restrict ntp.aliyun.com nomodify notrap nopeer noquery
server 127.127.1.0
fudge 127.127.1.0 stratum 8
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
3.重啓服務

systemctl start ntpd.service

systemctl enable ntpd.service

4.查看狀態
[root@localhost ~]# ntpstat
synchronised to NTP server (203.107.6.88) at stratum 3
time correct to within 46 ms
polling server every 1024 s
[root@localhost ~]#
二、Linux客戶端配置
1.安裝ntp客戶端,先手動同步

/usr/sbin/ntpdate -u 10.2.2.188

yum install -y ntpdate

2.寫入定時計劃

echo “0 5 * * * /usr/sbin/ntpdate -u 10.2.2.188” >> /var/spool/cron/root

echo “5 5 * * * /usr/sbin/hwclock -w” >> /var/spool/cron/root

三、window2012客戶端配置(若有域環境直接修改與控制器即可)
1.打開powershell終端管理,輸入gpedit.msc,打開策略管理器
在這裏插入圖片描述在這裏插入圖片描述
2.計算機配置–>管理模板–>系統–>Windows時間服務–>時間提供程序,配置(windows客戶端和啓動客戶端)
在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述
3.跟新策略
gpupdate /force
技術交流歡迎加入Q羣:177428068

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