本文使用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. 关于Conversion to Dalvik format failed with error 1错误

    在用Android导入一个新项目时,不知道为啥就碰上这个错误.在网上搜了半天,发现各种办法都有,但是最后居然是:将一个项目下的文件夹libs作为了source folder,而又在Proporties ...

  2. Python3基础 print 输出helloworld

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  3. ImportError: cannot import name 'izip & TypeError: 'float' object cannot be interpreted as an integer

    ImportError: cannot import name 'izip' 参考:https://codereview.stackexchange.com/questions/26271/impor ...

  4. c++ 交换两个容器(swap)

    #include <iostream> #include <vector> using namespace std; int main () { vector<,); / ...

  5. python yaml文件读写

    import yaml yaml_dict={"} with open("a.yaml", "w") as f: yaml.safe_dump(yam ...

  6. Redis为什么要把所有数据放到内存中?

    Redis为了达到最快的读写速度将数据都读到内存中,并通过异步的方式将数据写入磁盘.所以Redis具有快速和数据持久化的特性. 如果不将数据放到内存中,磁盘的I/O速度会严重影响redis的性能.在内 ...

  7. js 面试题总结 3

    console.log(a); // undefined function fn() { console.log(a); // undefined } fn(); console.log(a); 创建 ...

  8. django使用bootstrap快速美化 admin后台

    使用django-admin-bootstrappe快速美化后台 两步: 1.pip install django-admin-bootstrapped  安装应用 2.在setting.py里面添加 ...

  9. 【Demo】Tree.js实例

    Three.js是通过对WebGL接口的封装与简化而形成的一个易用的图形库. 简单点的说法:WebGL可以看成是浏览器给我们提供的接口,在javascript中可以直接用这些API进行3D图形的绘制: ...

  10. Linux Mint 18.1安装nvidia驱动

    硬件环境:Dell Inspiron 7557笔记本(i7,8G,GTX960M) 软件环境:Linux Mint 18.1(基于Ubuntu 16.04) 问题描述: Linux Mint 18.1 ...