本文使用CentOS 6.5作为搭建环境

一、服务器端配置

  1.安装所需软件包
  yum -y install ntp ntpdate
-------------------------------------------

  2.编辑NTP主配置文件,修改如下:
  vim /etc/ntp.conf

  #允许192.168.244.0网段同步
  restrict 192.168.244.0 mask 255.255.255.0 nomodify notrap      
  #注释如下几行
  #server 0.centos.pool.ntp.org iburst
  #server 1.centos.pool.ntp.org iburst
  #server 2.centos.pool.ntp.org iburst
  #server 3.centos.pool.ntp.org iburst

  #添加本地时间为服务时间

  server s2m.time.edu.cn iburst
  server 127.127.1.0 iburst    # local clock

--------------------------------------------

  3.重启ntp服务
  service ntpd restart

  验证:

  查看端口是否存在

  netstat -tulnp | grep ntp

--------------------------------------------

  4.设置开机自启动
  chkconfig ntpd on
----------------------------------------------
  5.查看现有连接客户端
  watch ntpq -p
       remote           refid     st t when poll reach   delay   offset  jitter
  ==============================================================================
  *LOCAL(0)        .LOCL.           5 l   46   64  377    0.000    0.000   0.000

------------------------------------------------
二、客户端配置:

  1、命令行手动执行一次验证是否可用:
  #ntpdate 192.168.244.20
   4 Dec 13:57:13 ntpdate[32277]: step time server 192.168.244.20 offset -24.396496 sec

  2.配置自动同步
  crontab -e
  15 1 * * *        /usr/sbin/ntpdate 192.168.244.20; /sbin/hwclock -w  

  IP以自己服务端IP为准

CentOS之NTP服务器配置的更多相关文章

  1. centos配置NTP服务器

    时间服务器: NTP(Network Time Protocol,网络时间协议)是用来使用网络中的各个计算机时间同步的一种协议,NTP服务器就是利用NTP协议提供时间同步服务的. 一.环境准备: 1. ...

  2. CentOS下NFS服务器配置教程

    说明: NFS服务器: 操作系统:CentOS 5.5 IP:192.168.21.160 nfs网络文件服务器共享目录:/data/osyunwei 目录所有者:www(说明:www为nginx运行 ...

  3. centos 搭建ntp

    str=$(printf "%-25s" "*") echo -e "${str// /*}" echo -e "*\t\t\t* ...

  4. centos7 ntp服务器配置

    一.ntp服务是什么 1. 定义 NTP是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机的时间的协议. 2. 发展 首次记载在Internet Enginee ...

  5. NTP 服务器配置

    1.yum安装ntp 1 yum install ntp* 2.更新时间 1 ntpdate 202.120.2.101 3.加入任务计划 1 2 crontab -e */10 * * * * nt ...

  6. CentOS 5.6服务器配置YUM安装Apache+php+Mysql+phpmyadmin

    1. 更新系统内核到最新. [root@linuxfei ~]#yum -y update 系统更新后,如果yum安装时提示错误信息,请执行以下命令修复. [root@linuxfei ~]#rpm ...

  7. Linux下NTP服务器配置

    简介 原理 配置ntp服务器 进行同步 一.简介 在计算时间的时候,最准确的计算应该是使用『原子震荡周期』所计算的物理时钟了( Atomic Clock, 也被称为原子钟 ),这也被定义为标准时间(I ...

  8. NTP服务器配置

    #/etc/ntp.conf# driftfile /var/lib/ntp/ntp.drift logfile /var/log/ntpd.log statistics loopstats peer ...

  9. CentOS下NTP安装配置

      安装yum install ntp 配置文件 /etc/ntp.confrestrict default kod nomodifynotrap nopeer noqueryrestrict -6 ...

随机推荐

  1. MySQL "Zero date value prohibited" 问题解析

    问题起因 之前一直使用Oracle数据,对MySQL数据库使用不多,因此搞不懂MySQL的日期“0000-00-00 00:00:00”对程序会产生怎样的影响.费了我一下午的时间 -_-^^. 首先: ...

  2. 日志自定义Tag

    import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentHashMap; /** * Crea ...

  3. HDU 1698 Just a Hook(线段树:区间更新)

    http://acm.hdu.edu.cn/showproblem.php?pid=1698 题意:给出1~n的数,每个数初始为1,每次改变[a,b]的值,最后求1~n的值之和. 思路: 区间更新题目 ...

  4. python 判断列表字符串元素首尾字符是否相同

    def match_words(words): ctr = for word in words: and word[] == word[-]: ctr += return ctr print(matc ...

  5. [原][osgearth]FAQ

    参考:http://docs.osgearth.org/en/latest/faq.html Common Usage How do I place a 3D model on the map? Th ...

  6. bzoj2120: 数颜色 带修莫队

    墨墨购买了一套N支彩色画笔(其中有些颜色可能相同),摆成一排,你需要回答墨墨的提问.墨墨会像你发布如下指令: 1. Q L R代表询问你从第L支画笔到第R支画笔中共有几种不同颜色的画笔. 2. R P ...

  7. ubuntu下修改matlab R2016b的快捷键为windows下相同

    选为: windows默认类.

  8. UVA-10570 Meeting with Aliens (枚举+贪心)

    题目大意:将一个1~n的环形排列变成升序的,最少需要几次操作?每次操作可以交换任意两个数字. 题目分析:枚举出1的位置.贪心策略:每次操作都保证至少一个数字交换到正确位置上. # include< ...

  9. tflearn tensorflow LSTM predict sin function

    from __future__ import division, print_function, absolute_import import tflearn import numpy as np i ...

  10. vue-cli如何添加多种环境变量

    vue-cli如何添加多种环境变量 目前webpack(vue-cli) 打包有两种变量,development, productor, 如何添加一个 test的测试环境呢 vue-cli 3.0 v ...