温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

NTP时间服务器搭建

发布时间:2020-08-05 09:57:56 来源:网络 阅读:485 作者:jiege333 栏目:建站服务器

1. NTP

NTPNetwork Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议。它的用途是把计算机的时钟同步到世界协调时UTC,其精度在局域网内可达0.1ms,在互联网上绝大多数的地方其精度可以达到1-50ms

NTP服务器就是利用NTP协议提供时间同步服务的。

2. NTP器安装

    yum -y install ntp

 vim /etc/ntp.conf

 允许任何ip的客户机都可以进行时间同步

 将restrict default kod nomodify notrap nopeer noquery修改为如下行:

 Restrict default nomodify  #nomodify客户端可以同步

# 将默认时间同步源注释改用可用源

#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 ntp1.aliyun.com

server time.nist.gov

加入定时任务同步时间

 crontab -e

    */5 * * * * /usr/sbin/ntpdate time.nist.gov >/dev/null 2>&1  

    /etc/init.d/ntpd start

    chkconfig ntpd on 

    ntpq -p        ntpstat     #看同步状态

3客时间同步

 crontab -e

 */15 * * * * /usr/sbin/ntpdate 192.168.100.102(服务器端IP)

  注意

 客户机要等几分钟再与新启动的ntp服务器进行时间同步,否则会提示no server suitable for       synchronization found错误


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI