设为首页 收藏本站
查看: 783|回复: 0

[经验分享] Ubuntu 配置NTP Server

[复制链接]

尚未签到

发表于 2017-12-7 18:47:43 | 显示全部楼层 |阅读模式
  Ubuntu安装NTP Server很简单,分位3步走:
  第一步:安装NTP



root@cephadmin:~/ceph-cluster# apt-get install ntp
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:
libopts25
Suggested packages:
ntp-doc
The following NEW packages will be installed:
libopts25 ntp
0 upgraded, 2 newly installed, 0 to remove and 217 not upgraded.
Need to get 477 kB of archives.
After this operation, 1,682 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libopts25 amd64 1:5.18-2ubuntu2 [55.3 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main ntp amd64 1:4.2.6.p5+dfsg-3ubuntu2.14.04.10 [421 kB]
Fetched 477 kB in 0s (757 kB/s)
Selecting previously unselected package libopts25:amd64.
(Reading database ... 55341 files and directories currently installed.)
Preparing to unpack .../libopts25_1%3a5.18-2ubuntu2_amd64.deb ...
Unpacking libopts25:amd64 (1:5.18-2ubuntu2) ...
Selecting previously unselected package ntp.
Preparing to unpack .../ntp_1%3a4.2.6.p5+dfsg-3ubuntu2.14.04.10_amd64.deb ...
Unpacking ntp (1:4.2.6.p5+dfsg-3ubuntu2.14.04.10) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Processing triggers for man-db (2.6.7.1-1) ...
Setting up libopts25:amd64 (1:5.18-2ubuntu2) ...
Setting up ntp (1:4.2.6.p5+dfsg-3ubuntu2.14.04.10) ...
* Starting NTP server ntpd                                                                                                                                                 [ OK ]
Processing triggers for libc-bin (2.19-0ubuntu6) ...
Processing triggers for ureadahead (0.100.0-16) ...
root@cephadmin:~/ceph-cluster# service ntp status
* NTP server is running
  第二步:修改ntp.conf配置文件
  1) 添加公网NTP Server
  server 120.24.166.46   (阿里云NTP Server)
  2) 允许的NTP Client网段

restrict 10.138.0.0 mask 255.255.0.0 nomodify



# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/    #也可以开启NTP log
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
# Specify one or more NTP servers.
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 120.24.166.46   # 阿里云NTP Server
server 127.127.
1.0     # 如果公网NTP不可用时,将使用Local时间作为NTP服务提供给NTP Client。
# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com
# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 192.168.20.0 mask 255.255.255.0 nomodify   # 允许的NTP Client网段
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
  第三步:重启NTP服务,并在客户端验证



root@ntpserver:~/ceph-cluster# service ntp restart
* Stopping NTP server ntpd                                           [ OK ]
* Starting NTP server ntpd                                           [ OK ]


root@ntpclient:/etc/ceph# ntpdate ntpserver
14 Jan 10:55:51 ntpdate[5230]: adjust time server 192.168.20.177 offset 0.209691 sec
root@ntpclient:/etc/ceph#
  未完待续......

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-421887-1-1.html 上篇帖子: Building Apps for Windows 10 on LattePanda–Jump Start 下篇帖子: java 调用windows bat脚本
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表