ubuntu配置ntp服务器

来源:互联网 发布:按键精灵源码 编辑:程序博客网 时间:2024/06/16 13:15

安装命令:

sudo apt_get ntp

我电脑安装完出错:

解决办法:

------------------------------------------------------

配置:(原文:https://www.cnblogs.com/xwdreamer/p/3448773.html)

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for helpdriftfile /var/lib/ntp/ntp.drift #草稿文件#日志文件statsdir /var/log/ntpstats/statistics loopstats peerstats clockstatsfilegen loopstats file loopstats type day enablefilegen peerstats file peerstats type day enablefilegen clockstats file clockstats type day enable#上层ntp serverserver 10.138.16.251 prefer #让NTP Server和其自身保持同步,如果在/etc/ntp.conf中定义的server都不可用时,将使用local时间作为ntp服务提供给ntp客户端server 127.127.1.0fudge 127.127.1.0 stratum 5#不允许来自公网上ipv4和ipv6客户端的访问restrict -4 default kod notrap nomodify nopeer noquery restrict -6 default kod notrap nomodify nopeer noquery#运行上层ntp server的所有权限restrict 10.138.16.251#允许这个网段的对时请求restrict 10.138.0.0 mask 255.255.0.0 nomodify # Local users may interrogate the ntp server more closely.restrict 127.0.0.1restrict ::1

在网上找了几个可以用的ntp服务器

time.windows.com

ntp1.aliyun.com

----------修改时区--------------------

tzselect

按提示操作。。。

复制文件到/etc目录下

sudo cp /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime

更新时间命令:

ntpdate ntp1.aliyun.com



原创粉丝点击