zoukankan      html  css  js  c++  java
  • CentOS之NTP服务器配置

      本文使用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为准

  • 相关阅读:
    vim 编辑器使用
    PHP高并发高负载系统架构(转载)
    类的使用
    linux下EC20 4G模块驱动移植
    linux 4G模块拨号脚本
    linux4.1.4上移植ME909s-821,MU609 4G模块驱动
    shell脚本语之运算符
    vim的列编辑操作
    linux下普通用户添加 sudo 免密码
    4G模块在AM335x上的移植
  • 原文地址:https://www.cnblogs.com/jim-hwg/p/4606821.html
Copyright © 2011-2022 走看看