- 原理:无论linux还是windows集群的时间同步,都是选取某一台机器时间作为基准点(ntp时钟服务)。所有机器时间都以它为主,同步它的时间。
- 同步机器分配:ntp时钟服务ip:88.204;需同步的机器,linux:88.206,win:110.24
- linux服务端(ntp时钟服务)配置
1.查看是否安装
rpm -q ntp
2.安装(关闭防火墙)
yum install ntpdate ntp -y
3.修改配置文件(vim /etc/ntp.conf)
restrict 192.168.88.0 mask 255.255.255.0 nomodify notrap
server 0.cn.pool.ntp.org iburst
server 1.cn.pool.ntp.org iburst
server 2.cn.pool.ntp.org iburst
server 3.cn.pool.ntp.org iburst
server 192.168.88.204 iburst
fudge 127.0.0.1 stratum 10
restrict 0.cn.pool.ntp.org nomodify notrap noquery
restrict 1.cn.pool.ntp.org nomodify notrap noquery
restrict 2.cn.pool.ntp.org nomodify notrap noquery
4.设置系统开机自启动
systemctl enable ntpd
systemctl enable ntpdate
systemctl is-enabled ntpd
5.在ntpd服务启动前,先使用ntpdate命令做第一次时间同步
ntpdate -u 1.cn.pool.ntp.org
6.启动服务
systemctl start ntpd
7.查看同步状态
ntpstat
8.查看客户端和每个服务器的关系
ntpq -p
- linux客户端(ntp客户端)配置
1.安装及自启动同服务端,只是配置文件内容不一样
2.修改配置文件
restrict 192.168.88.204 nomodify notrap noquery
server 192.168.88.204
fudge 127.0.0.1 stratum 10
- Windows客户端同步
1.开机自启动
services.msc-》Windows Time-》设置为自动
2.ntp客户端配置
控制面板 -》 日期和时间 -》Internet时间-》更改配置-》NTP服务器的IP
3.修改客户端(ntp)时间同步周期
1.gpedit.msc-》计算机配置 -> 管理模板 -> 系统 -> Windows 时间服务-》全局配置设置-》设置已启用,其他参数不动
2.gpedit.msc-》计算机配置 -> 管理模板 -> 系统 -> Windows 时间服务 -> 时间提供程序-》
2.1配置ntp客户端-》依次设置已启用、NtpServer(NTP服务器IP)、类型(ntp)、SpecialPollInterval(同步周期,秒)
2.2启用ntp客户端-》设置已启用