服务端配置:
restrict 127.0.0.1
restrict ::1
restrict 10.28.200.0 mask 255.255.255.0 nomodify notrap
server 127.127.1.0
10.28.200.0:要同步的网段
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst (注释掉互联网时间服务器,采用集群时间)
客户端配置:
restrict 127.0.0.1
restrict ::1
ntpq: read: Connection refused (指定服务端ip)
并注释掉互联网时间服务器
服务端开启ntpd服务
客户端与服务端对时:ntpdate 服务端ip地址
查看是否对时成功: ntpq -p
如果客户端对时不成功,停掉客户端ntp服务—>进行对时—>开启ntpd服务