本文使用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. linux第五周

    第五周 给MenuOS增加time和time-asm命令 更新menu代码到最新版 在main函数中增加MenuConfig 增加对应的Time函数和TimeAsm函数 make rootfs 使用g ...

  2. ubuntu16.04下安装TensorFlow(GPU加速)----详细图文教程【转】

    本文转载自:https://blog.csdn.net/zhaoyu106/article/details/52793183 le/details/52793183 写在前面 一些废话 接触深度学习已 ...

  3. [kata] Playing with digits

    package kata_011; /** * Some numbers have funny properties. For example: * * 89 --> 8¹ + 9² = 89 ...

  4. P4factory ReadMe Quickstart 安装p4factory

    操作系统: Ubuntu 14.04 前言 在之前,我直接从P4.org给的GitHub网址上下载了p4factory,但是在根据ReadMe的内容进行QuickStart的时候,发生了shell脚本 ...

  5. SpringBoot与Dubbo整合下篇

    (1)pom.xml引入相关依赖jar包,如下: <dependency> <groupId>com.alibaba</groupId> <artifactI ...

  6. RJ45接口

    什么是rj45接口? rj45是各种不同接头的一种类型,通常用于数据传输,最常见的应用为网卡接口. 常见的RJ45接口有两类:用于以太网网卡.路由器以太网接口等的DTE类型,还有用于交换机等的DCE类 ...

  7. ACM比赛学习指导(20180223)

    0.比赛介绍 (1)浙江省大学生程序设计比赛,3人一组,题目为英文 (2)ACM程序设计比赛 百度百科介绍 1.理论学习 (1)<挑战程序设计竞赛>,秋叶拓哉,巫泽俊 (2)<算法竞 ...

  8. Android之网络图片加载的5种基本方式

    学了这么久,最近有空把自己用到过的网络加载图片的方式总结了出来,与大家共享,希望对你们有帮助. 此博客包含Android 5种基本的加载网络图片方式,包括普通加载HttpURLConnection.H ...

  9. Leetcode 62

    //从理解二维dp到简化成一维dp我用了一年的时间class Solution { public: int uniquePaths(int m, int n) { vector<); ;i &l ...

  10. @pathVariable的作用

    //url中的id 可通过@pathVariable绑定到函数的参数中