1.首先安装NTP

  1. [root@localhost /]# yum install ntp -y

2.修改NTP配置文件,添加NTP服务器的网络位置    /etc/ntp.conf

  1. # For more information about this file, see the man pages
  2. # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
  3.  
  4. driftfile /var/lib/ntp/drift
  5.  
  6. # Permit time synchronization with our time source, but do not
  7. # permit the source to query or modify the service on this system.
  8. restrict default nomodify notrap nopeer noquery
  9.  
  10. # Permit all access over the loopback interface. This could
  11. # be tightened as well, but to do so would effect some of
  12. # the administrative functions.
  13. restrict 127.0.0.1
  14. restrict ::1
  15.  
  16. # Hosts on local network are less restricted.
  17. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
  18.  
  19. # Use public servers from the pool.ntp.org project.Please consider joining the pool (http://www.pool.ntp.org/join.html).
  20. server 192.168.1.1 iburst #目标服务器网络位置
  21. #server 1.centos.pool.ntp.org iburst #一下三个是CentOS官方的NTP服务器,我们注释掉
  22. #server 2.centos.pool.ntp.org iburst
  23. #server 3.centos.pool.ntp.org iburst
  24.  
  25. #broadcast 192.168.1.255 autokey # broadcast server
  26. #broadcastclient # broadcast client
  27. #broadcast 224.0.1.1 autokey # multicast server
  28. #multicastclient 224.0.1.1 # multicast client
  29. #manycastserver 239.255.254.254 # manycast server
  30. #manycastclient 239.255.254.254 autokey # manycast client
  31.  
  32. # Enable public key cryptography.
  33. #crypto
  34.  
  35. includefile /etc/ntp/crypto/pw
  36.  
  37. # Key file containing the keys and key identifiers used when operating
  38. # with symmetric key cryptography.
  39. keys /etc/ntp/keys
  40.  
  41. # Specify the key identifiers which are trusted.
  42. #trustedkey 4 8 42
  43.  
  44. # Specify the key identifier to use with the ntpdc utility.
  45. #requestkey 8
  46.  
  47. # Specify the key identifier to use with the ntpq utility.
  48. #controlkey 8
  49.  
  50. # Enable writing of statistics records.
  51. #statistics clockstats cryptostats loopstats peerstats
  52.  
  53. # Disable the monitoring facility to prevent amplification attacks using ntpdc
  54. # monlist command when default restrict does not include the noquery flag. See
  55. # CVE-2013-5211 for more details.
  56. # Note: Monitoring will not be disabled with the limited restriction flag.
  57. disable monitor

保存退出

3.启动服务并设置开启自启

  1. [root@localhost /]# systemctl start ntpd.service  #启动服务
    [root@localhost /]# systemctl enable ntpd.service  #设置为开机启动

4.查看运行状态

[root@localhost /]# systemctl status ntpd.service
● ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
   Active: active (running) since 二 2016-10-11 13:34:11 CST; 8min ago
 Main PID: 6497 (ntpd)
   CGroup: /system.slice/ntpd.servicess
           └─6497 /usr/sbin/ntpd -u ntp:ntp -g

10月 11 13:34:11 localhost.localdomain ntpd[6497]: Listen and drop on 1 v6wildcard :: UDP 123
10月 11 13:34:11 localhost.localdomain ntpd[6497]: Listen normally on 2 lo 127.0.0.1 UDP 123
10月 11 13:34:11 localhost.localdomain ntpd[6497]: Listen normally on 3 eno16777736 192.168.100.100 UDP 123

linux时间同步ntp服务的安装与配置的更多相关文章

  1. 4、时间同步ntp服务的安装于配置(作为客户端的配置)

    yum安装ntpd服务   .yum -y install ntp ntpdate (安装时间同步ntp服务) . vi /etc/ntp.conf (修改ntpd服务的配置文件)   3.修改配置文 ...

  2. 时间同步ntp服务的安装与配置(作为客户端的配置

    在linux环境下,我们不仅可以自己设置时间,也可以对系统进行时间的同步,比如同步时间到某台物理机上或虚拟机,皆可!接下来我们就以同步时间到某台物理机为例, 一起学习学习. 1.配置本地yum源(挂载 ...

  3. 时间同步ntp服务的安装与配置

    1,首先安装ntp服务. [root@localhost /]# yum install ntp -y 2,修改ntp配置文件.(ntp配置文件在:/etc/ntp.conf) [root@local ...

  4. cetnos 7 ntp服务的安装与配置

    首先需要搭建yum本地仓库 http://www.cnblogs.com/jw35/p/5967677.html   #搭建yum仓库方法 yum install ntp -y        #安装n ...

  5. linux时间同步-NTP服务

    作者:曹世军链接:https://www.zhihu.com/question/30252609/answer/108840850来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注 ...

  6. Linux下TFTP服务的安装、配置和操作

      TFTP是用来下载远程文件的最简单网络协议,它其于UDP协议而实现.嵌入式linux的tftp开发环境包括两个方面:一是linux服务器端的tftp-server支持,二是嵌入式目标系统的tftp ...

  7. 关于linux - Centos 7 下DHCP服务的安装与配置

    DHCP(Dynamic Host Configuration Protocol,动态主机配置协议)是一个局域网的网络协议,使用UDP协议工作, 主要有两个用途:给内部网络或网络服务供应商自动分配IP ...

  8. 局域网内使用linux的ntp服务

    假设我们的饿局域网无法连接外网,但又需要同步时间,怎么办? 1. 已局域网内的一台机器作为基础,适用date修改其他机器的时间,date -s ...,很不方便,这里不介绍. 2. 适用ntp服务,自 ...

  9. CentOS 7 Tomcat服务的安装与配置

    3422人阅读  http://blog.51cto.com/13525470/2073657 一.Linux下的Java运行环境 Java是一种可以撰写跨平台应用软件的面向对象的程序设计语言,是由S ...

随机推荐

  1. EXCEL 对比数据是否重复

    1.同一列 后一行对比前面所有行 查找是否重复 =IF(COUNTIF(B$2:B2,B2)>1,"重复","") 2.两行两列(多行多列) 两行两列 = ...

  2. 处理Https 异常记录 javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

    http://blog.csdn.net/baidu_18607183/article/details/51595330 https://blogs.oracle.com/java-platform- ...

  3. kettle系列-我的开源kettle管理平台[kettle-manager]介绍

    kettle管理工具 专门为kettle这款优秀的ETL工具开发的web端管理工具. 项目简介 kettle作为非常优秀的开源ETL工具得到了非常广泛的使用,一般的使用的都是使用客户端操作管理,但问题 ...

  4. {二逼小青年的记事簿}为什么treelist不会显示子节点的文字?

    <TreeView Name="treeView" DockPanel.Dock="Left" MinWidth="200" > ...

  5. maven权威指南学习笔记(二)——安装、运行、获取帮助

    这部分在网上很容易找到详细教程,这里就略写了. 基础:系统有配置好的jdk,通过 命令行 java -version,有类似下面的提示,表示java环境以配好 下载maven:官网 http://ma ...

  6. Dev Cpp 输出中文字符问题

    最近 c++ 上机作业,vc++6.0 挂了没法用,只好用 Dev Cpp 先顶替一下,然而在遇到输出中文字符的时候出现了乱码的情况,但这种情况又非常诡异.于是简单了解了一下写成此博客. [写在前面] ...

  7. (UWP开发)基于Windows10 Anniversary SDK创造出位于可视化层的DropShadow

    Windows.UI.Composition API是可以从任何通用Windows平台应用程序调用的声明性保留模式API,从而可以直接在应用程序中创建合成对象.动画和效果. Composition A ...

  8. Javascript原型继承 __proto__

    Javascript继承是通过原型链继承的 原型链是依赖__proto__而不是prototype var animal = function(){}; var dog = function(){}; ...

  9. 解决ScrollView 嵌套 GridView 单行显示问题

    简单重写GridView package com.hh.beauter.my_ui; import android.content.Context; import android.util.Attri ...

  10. SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式

    java日期格式大全 format SimpleDateFormat(转) SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH ...