1、安装ntp软件
  sudo apt-get install ntp
2、修改配置文件
      sudo vim /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
    server ntp.ubuntu.com
    restrict -4 default kod notrap nomodify nopeer noquery
    restrict -6 default kod notrap nomodify nopeer noquery
    restrict 192.168.10.0 mask 255.255.255.0 nomodify
    restrict 127.0.0.1
    restrict ::1
  主要是在配置文件中的:
  restrict -6 default kod notrap nomodify nopeer noquery
  语句后面加入:
  restrict 192.168.0.0 mask 255.255.255.0 nomodify
      主要是允许能同步的服务器所在的内部网段
3、权限设定
  权限设定主要以restrict这个参数来设定,主要的语法为:
  restrict IP mask netmask_IP parameter
  其中IP可以是软体位址,也可以是 default ,default 就类似0.0.0.0
  至于 paramter则有:
  ignore:关闭所有的NTP 连线服务
  nomodify:表示Client 端不能更改 Server 端的时间参数,不过Client端仍然可以透过Server 端來进行网络较时。
  notrust:该 Client 除非通过认证,否则该 Client 来源将被视为不信任网域
  noquery:不提供 Client 端的时间查询
  如果 paramter完全没有设定,那就表示该 IP (或网域) 『没有任何限制!』
4、上层主机设定
  上层主机选择ntp.ubuntu.com,要设定上层主机主要以server这个参数来设定,语法为:server [IP|FQDN] [prefer]
  Server 后面接的就是我们上层的Time Server !而如果 Server 参数后面加上perfer 的话,那表示我们的 NTP 主机主要以该部主机来作为时间较正的对应。另外,为了解决更新时间封包的传送延迟动作,可以使用driftfile 来规定我们的主机在与Time Server沟通时所花费的时间,可以记录在 driftfile 后面接的档案内
5、如果有设置防火墙必须取消对123端口的限制
  iptables -t filter -A INPUT -p udp --destination-port 123 -j ACCEPT
6、重启ntp服务
  sudo /etc/init.d/ntp restart
7、客户端同步(也就是要进行同步的内网服务器)
  sudo ntpdate 192.168.112.1
  可同时查看服务器的硬件时钟并进行更改:
  sudo hwclock
  sudo hwclock -w
8、查看ntp的端口,应该看到123端口
     netstat -unlnp
9、查看ntp服务器与上层间的联系
     ntptrace -n 127.0.0.1
10、查看ntp服务器与上层ntp服务器的状态
      ntpq -p
      其中,
      remote - 本机和上层ntp的ip或主机名,“+”表示优先,“*”表示次优先
      refid - 参考上一层ntp主机地址
      st - stratum阶层
      when - 多少秒前曾经同步过时间
      poll - 下次更新在多少秒后
      reach - 已经向上层ntp服务器要求更新的次数
      delay - 网络延迟
      offset - 时间补偿
      jitter - 系统时间与bios时间差

ubuntu安装ntp时间服务器的更多相关文章

  1. Cloudera Manager安装之时间服务器和时间客户端(Ubuntu14.04)(二)

    第二步: Cloudera Manager安装之时间服务器和时间客户端(二) 找一台机器作为时间服务器 我这里,放到ubuntucmbigdata1这台机器! 注意,之前是已经做了集群时间同步了. 在 ...

  2. 搭建内网的NTP时间服务器

    NTP时间服务器 标签: linux 笔者Q:972581034 交流群:605799367.有任何疑问可与笔者或加群交流 1.简介 NTP(Network Time Protocol,网络时间协议) ...

  3. NTP时间服务器实战应用详解-技术流ken

    简介 在搭建集群服务中,要保证各节点时间一致,NTP时间服务器就成为了一个好帮手了. 系统环境 系统版本:centos6.7 服务器IP:10.220..5.166/24 客户端IP:10.220.5 ...

  4. 企业内部在centos7.2系统中必杀技NTP时间服务器及内网服务器时间同步(windows和linux客户端同步)

    网络时间协议NTP(Network Time Protocol)是用于互联网中时间同步的标准互联网协议.NTP的用途是把计算机的时间同步到某些时间标准.目前采用的时间标准是世界协调时UTC(Unive ...

  5. Linux NTP时间服务器

    NTP 时间服务器 ntp也是一种协议 ntp软件(支持ntp协议)  CentOS6自带 CentOS7需要安装 chrony软件(支持ntp协议)   CentOS7自带 安装ntp CentOS ...

  6. Ntp时间服务器与定时任务Crontab

    一 NTP时间服务器 1 局域网内的NTP同步配置 注意 所有配置操作必须是root用户 ,局域网内node21作为NTP Server,node22,node23作为NTP Client与服务器进行 ...

  7. 局域网部署ntp时间服务器

    搭建ntp时间服务器 时间服务器配置 须切换到root用户,再进行操作 检查ntp是否安装 [root@hadoop01 ~]# rpm -qa | grep ntp 如果没有安装,须安装 [root ...

  8. NTP时间服务器+DHCP服务器的搭建

    一.构建NTP时间服务器 ntp服务器监控端口UDP:123 安装ntp和ntpdate 命令:yum  -y install ntp netdate 修改配置文件/etc/ntp.conf 启动nt ...

  9. centos7.5配置ntp时间服务器

    Centos7配置ntp时间服务器 Centos7配置时间服务器,一个服务端,多个客户端,客户端去同步服务端 服务端: 1.先修改时区,否则即使配置完ntp时间也不对,修改时区参照:https://w ...

随机推荐

  1. (广搜)Catch That Cow -- poj -- 3278

    链接: http://poj.org/problem?id=3278 Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 6211 ...

  2. Android-Sqlite3的使用

    Sqlite3的使用: adb remount --> 挂载上 adb devices -->查看设备 adb shell -->进入Android文件系统 cd /data/dat ...

  3. 一起学习《C#高级编程》1--类型的安全性

    感觉写随笔第一天就遇到了困难,感觉好费时间啊,回宿舍就得8点多,然后只能看一点书.之后写随笔,首先得回忆,然后组织,最后打字.还有就是宿舍迎来的断网的日子,特别不方便,只能第二天去公司发.本人目前是. ...

  4. SQL 判断数据库是否有相关表 字段

    --判断数据库是否有相关表 if exists (select 1 from sysobjects where id = object_id(' 表名 ') and type = ' U ' ); - ...

  5. https经过ngxin在web服务器收到http请求

    一. 问题描述: nginx代理nexus的时候页面不全,部分https地址自动转成http了,使用方案四解决的 浏览器输入https://www.mysite.com,后台通过request.get ...

  6. 486. Predict the Winner

    Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from eith ...

  7. Problem G: 沉迷字符的WJJ (LCS)

    Contest - 河南省多校连萌(四) Problem G: 沉迷字符的WJJ Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 6  Solved: 5 ...

  8. jquery屏蔽掉键盘enter提交 onkeydown

    屏蔽掉enter提交onkeydown onkeydown="if(event.keyCode==13){return false;}"

  9. 常见的HTTP请求应答返回码列表

        200      OK 请求成功.一般用于GET与POST请求 300 Multiple Choices 多种选择.请求的资源可包括多个位置,相应可返回一个资源特征与地址的列表用于用户终端(例 ...

  10. tf入门-tf.nn.conv2d是怎样实现卷积的?

    转自:https://blog.csdn.net/mao_xiao_feng/article/details/78004522 实验环境:tensorflow版本1.2.0,python2.7 介绍 ...