• centos配置ntp服务器教程


    当服务器多了,时间准确与否,一致与否是个大问题。虽然这个问题总是被忽略,但是统一一致的时间是很有必要的。下面说一下在局域网内配置Linux时间服务器的方法。
    NtpServer篇:

    #1.安装ntp
      yum -y install ntp
    #2.修改配置文件
    vi /etc/ntp.conf
    #更改配置文件如下:
    #上级同步服务器:北京大学同步地址
    server s2m.time.edu.cn
    #上级服务器不通时使用本地服务
    server  127.127.1.0     # local clock
    fudge   127.127.1.0 stratum 10
    #记录上次的NTP server与上层NTP server联接所花费的时间
    driftfile /var/lib/ntp/drift
    #允许访问时间服务器的IP地址
    restrict 127.0.0.1 
    restrict -6 ::1
    restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap #允许任何主机跟进行时间同步
    #设置日志路径
    startsdir /var/log/ntp/
    #设置ntp日志文件
    logfile /var/log/ntp/ntp.log
    #3.手动同步
    ntpdate s2m.time.edu.cn
    #4.启动服务
    service ntpd start
    开机启动:
    chkconfig ntpd on
    

    Ntp客户端

    #1.安装ntp
    yum -y install ntp
    #2.修改配置文件
    注释默认配置,添加刚刚创建的ntpserver
    #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 192.168.2.151
    

    至此,ntp服务器配置介绍完毕。
    附:修改服务器本地时区

    rm -rf localtime
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    
  • 相关阅读:
    怎样用回显和无刷新实现模糊查询?
    2020软件工程作业02
    2020软件工程作业01
    2019春总结作业
    2019春第四次课程设计实验报告
    2019春第三次课程设计实验报告
    2019春第二次课程设计实验报告
    2019春第一次课程设计实验报告
    2019春第十二周作业
    2019春第十一周作业
  • 原文地址:https://www.cnblogs.com/sdhzdtwhm/p/9644606.html
Copyright © 2020-2023  润新知