安装

sudo apt-get install ntp

修改ntp.conf配置文件

sudo vi /etc/ntp.conf

修改为如下内容

# 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 -- (LP: #). 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 - default kod notrap nomodify nopeer noquery
restrict - 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 ::

重启NTP服务,并在客户端验证

root@ntpserver:~/ceph-cluster# service ntp restart
* Stopping NTP server ntpd [ OK ]
* Starting NTP server ntpd [ OK ]
root@ntpclient:/etc/ceph# ntpdate ntpserver
Jan :: ntpdate[]: adjust time server 192.168.20.177 offset 0.209691 sec
root@ntpclient:/etc/ceph#

观察时间同步状况:

ntpq -p

remote:本机和上层ntp的ip或主机名,“+”表示优先,“*”表示次优先
refid:参考上一层ntp主机地址
st:stratum阶层
when:多少秒前曾经同步过时间
poll:下次更新在多少秒后
reach:已经向上层ntp服务器要求更新的次数
delay:网络延迟
offset:时间补偿
jitter:系统时间与bios时间差

查看ntpd进程的状态
【命令】watch "ntpq -p"
第一列中的字符指示源的质量。星号 ( * ) 表示该源是当前引用。
remote:列出源的 IP 地址或主机名。
when:指出从轮询源开始已过去的时间(秒)。
poll:指出轮询间隔时间。该值会根据本地时钟的精度相应增加。
reach:是一个八进制数字,指出源的可存取性。值 377 表示源已应答了前八个连续轮询。
offset:是源时钟与本地时钟的时间差(毫秒)。

设置开机启动

chkconfig ntpd on

参考:
https://www.cnblogs.com/vincenshen/p/6284933.html
https://blog.csdn.net/willinge/article/details/79928726
https://www.cnblogs.com/quchunhui/p/7658853.html
https://blog.csdn.net/jinyuxiaoqiang/article/details/81634827
https://www.cnblogs.com/quchunhui/p/7658853.html

ubuntu 14.04 安装ntp的更多相关文章

  1. 在Ubuntu 14.04安装和使用Docker

    Docker是一个开源软件,它可以把一个Linux应用和它所依赖的一切(比如配置文件)都封装到一个容器.然而,Docker与虚拟机不同,它使用了沙箱机制,Docker容器不运行操作系统,它共享主机上的 ...

  2. [转]在Ubuntu 14.04安装和使用Docker

    在Ubuntu 14.04安装和使用Docker 作者:chszs,版权所有,未经同意,不得转载.博主主页:http://blog.csdn.net/chszs Docker是一个开源软件,它可以把一 ...

  3. Ubuntu 14.04 安装VMware 12

    /*********************************************************************** * Ubuntu 14.04 安装VMware 12 ...

  4. Ubuntu 14.04安装Chromium浏览器并添加Flash插件Pepper Flas

    转自Ubuntu 14.04安装Chromium浏览器并添加Flash插件Pepper Flash Player Chromium谷歌的开源浏览器将不再支持Netscape浏览器插件API,Adobe ...

  5. ubuntu 14.04 安装搜狗拼音输入法

    原文:ubuntu 14.04 安装搜狗拼音输入法 ubuntu桌面系统下终于有了好用的拼音法-搜狗拼音输入法,欲在ubuntu 14.04下安装搜狗拼音输入法相当的简单. 先到搜狗拼音官网下载对应的 ...

  6. ubuntu 14.04 安装torch及编译环境zbstudio

    ubuntu 14.04 安装torch及编译环境zbstudio torch zbstudio 本来是安装官网给的步骤安装torch的,可是碰到一系列的问题,后来参考网上的安装方法安装成功了 官网安 ...

  7. ubuntu 14.04 安装svn server (subversionedge )

    ubuntu 14.04 安装subversionedge 请仔细阅读安装包自带的readme文件! 1.先去官网,找安装包: http://subversion.apache.org/ http:/ ...

  8. Ubuntu 14.04 安装 sysrepo v0.7.5

    参考: Tentative gNMI support with sysrepo protobuf-c/protobuf-c Ubuntu 14.04 安装 sysrepo v0.7.5 安装依赖: s ...

  9. Ubuntu 14.04 安装 CUDA 问题及解决

    本文安装环境: - 双显卡: intel 集显 + nvidia 独显 - Ubuntu 14.04.4 - CUDA 8.0.44 1. Deb 安装包是个坑 (不要用这种方法!) 使用 Deb 安 ...

随机推荐

  1. css line-height & 图片底部间隙的处理

    前言:这是笔者学习之后自己的理解与整理.如果有错误或者疑问的地方,请大家指正,我会持续更新! 看大牛张鑫旭的视屏可能会理解的更深一些,点击这里 . line-height 的学习 line-heigh ...

  2. (七)easyUI之Accordion折叠面板:普通的静态面板

    一.普通的静态面板 前台 <%@ page language="java" contentType="text/html; charset=UTF-8" ...

  3. (三)Redis之数据结构概念以及数据结构之字符串

    一.数据结构 五种数据类型: 字符串(String) 字符串列表(list) 有序字符串集合(sorted set) 哈希(hash) 字符串集合(set) 二.数据结构之字符串 二进制安全的,存入和 ...

  4. KVM之磁盘管理工具qemu-img小结

    基本语法: qemu-img command [command options] 主要参数: info : 查看镜像的信息: create: 创建镜像: check: 检查镜像: convert: 转 ...

  5. SpringCloud之RabbitMQ消息队列原理及配置

    本篇章讲解RabbitMQ的用途.原理以及配置,RabbitMQ的安装请查看SpringCloud之RabbitMQ安装 一.MQ用途 1.同步变异步消息 场景:用户下单完成后,发送邮件和短信通知. ...

  6. http上传txt文件

    http通过post方式上传txt文件 可以参考 https://www.cnblogs.com/s0611163/p/4071210.html /// <summary> /// Htt ...

  7. Liunx-tail命令

    1. 实时刷新tail -f /var/log/messages 2. 实时刷新最新500条log tail -500f  /var/log/messages 3. tail -n 20 catali ...

  8. 通用分页model封装pageList

    package selfimpr.page; import java.util.List; /** * 分页模型 * @param <T> 数据泛型 * @author selfimpr ...

  9. YOLO---Darknet下的 GPU vs CPU 速度

    YOLO---Darknet下的 GPU vs CPU 速度 目录 一.基础环境 二.安装Darknet-yolo v3 三.CPU下测试 四.GPU下测试 五.测试速度对比结论 正文 一.基础环境 ...

  10. JAVA连接Derby数据库

    其实,JAVA连接Derby数据库也很简单,和一般的数据库操作一样:1.加载驱动2.获取连接3.进行数据库操作4.记得关闭连接 示例如下: import java.sql.ResultSet; imp ...