- 安装
sudo apt-get install ntp
- 配置成和本机同步时间
代码语言:javascript
复制# /etc/ntp.conf
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
#ntp server update with it self
server 127.127.1.0
fudge 127.127.1.0 stratum 5
#do not alow remote ipv4 and ipv6
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
- 重启
service ntp restart
- 查看ntp服务器与上层ntp的状态
ntpq -p