ubuntu 下ntp sever 安装及配置

2020-06-03 15:44:58 浏览数 (1)

  1. 安装 sudo apt-get install ntp
  2. 配置成和本机同步时间
代码语言: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
  1. 重启 service ntp restart
  2. 查看ntp服务器与上层ntp的状态 ntpq -p
ntp

0 人点赞