1.安装ntp服务
apt install ntp
2.配置ntp服务
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
#此处为需要同步的网段
restrict 192.1.0.0 mask 255.255.0.0 nomodify
restrict 127.0.0.1
restrict ::1
# Needed for adding pool entries
restrict source notrap nomodify noquery
server 127.127.1.0
fudge 127.127.1.0 stratum 10
3.配置好后重启ntp服务
service ntpd restart
**
注意
**:重启后一般需要等待5-10分钟时间,然后客户端才可以使用ntpdate serverip进行校时