centos时间服务器搭建

1,安装ntp服务

         yum -y install ntp

2,配置时间服务器

vi/etc/ntp.conf 文件

    ①,将“restrict default nomodify notrap noquery”这行修改成:

         restrict default nomodify

    ②,在restrict default nomodify notrap noquery(表示默认拒绝所有IP的时间同步)         之后增加一行:

     restrict 192.168.18.0 mask 255.255.255.0 nomodify

   server ntp.api.bz prefer 上级服务器同步

3,启动时间服务

   /usr/local/ntp/bin/ntpd -c /etc/ntp.conf -p /tmp/ntpd.pid

4,在iptables 中开通ntp的udp端口123

    #ntpserver

            -A INPUT -p udp --destination-port 123 -j ACCEPT

5,客户端通过crontab 来配置定时同步

00,* * * * /usr/sbin/ntpdate 192.168.18.2

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容