1.首先安装NTP

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

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

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

保存退出

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

[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. JDK1.5/1.6/1.7之新特性总结(转载)

    原文地址:http://www.cnblogs.com/yezhenhan/archive/2011/08/16/2141510.html 如果原作者看到不想让我转载请私信我! 开发过程中接触到了从j ...

  2. 如何获取苹果手机的UDID

    获取苹果手机的UDID有很多种,比如Xcode,iTunes等等吧,个人比较推荐使用iTunes,因为比较官方,而且苹果电脑自带的有,而且Windows也可以下载安装. 1.下载安装itunes(点击 ...

  3. [leetcode]leetcode初体验

    这几天把之前的设计模式回顾了一遍,整理了一点以前的项目.同学说,打算刷leetcode题目,也勾起了我的兴趣,索性也刷一些题目,再提高一些内功.刚开始进去,leetcode随机分配的题目,直接也就做了 ...

  4. AutoMapper实现自动CreapMap

    标题是个噱头,完全不写代码自动是不现实的,只是简化了CreateMap.方法也是很粗糙的,看看吧. 我想在使用AutoMapper的时候最恶心的一定是写了一个Profile,里边有n行 Mapper. ...

  5. 在子线程更新主线程的UI组件

    1.实例化一个 private Handler handlerBublishTopic = new Handler(Looper.getMainLooper()); 2. handlerBublish ...

  6. Python-匿名函数

    lambda 函数是一种快速定义单行的最小函数,可以用在任何需要函数的地方   常规版本: def fun(x,y) return x*y lambda版本: r = lambda x,y:x*y p ...

  7. Qtablevies获取内容

    首先是向tableview中添加内容 model=new QStandardItemModel(); model->setHorizontalHeaderItem(, new QStandard ...

  8. Linux 操作mysql数据库 创建库 导入、删除表

    确保线上的运行数据库是不可避免的本人小白,因公司上线没有办法自己去整服务器,深刻体会到服务器大神的霸气,所以为了增加记忆,服务广大员友记录一下 linux mysql 忘记root的密码无法登陆进my ...

  9. Java环境变量的简记

    1,安装版的jre或jdk.安装后如果不做开发用,则只是做Java运行时环境,则不需要手动配置任何Java环境变量. 2,绿色解压版(拷贝版)jdk或jre.运行和开发都需要配置环境变量. 运行Jav ...

  10. Java多线程之构造与发布

    资料来源 http://www.ibm.com/developerworks/library/j-jtp0618/ http://www.javaspecialists.eu/archive/Issu ...