CentOS下设置NTP时间同步服务器

  1. 安装ntp服务
    yum install ntp
  2. 配置config
    vi /etc/ntp.conf
    restrict 192.168.5.0 mask 255.255.255.0 nomodify notrap #允许该网段内的主机可以进行校时
    restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap #允许任何主机跟进行时间同步
    restrict default #default指所有的IP
    restrict 192.168.10.2  # 指定某台机器时间同步
    配置时间源
    server pool.ntp.org #可选择其他优先服务器
    server 0.pool.ntp.org
    server 1.pool.ntp.org
    server 2.pool.ntp.org
  3. 配置防火墙123端口开放
    iptables -I INPUT -p udp --dport 123 -j ACCEPT
    /etc/init.d/iptables save
    service iptables restart
  4. 开启服务
    chkconfig ntpd on #设置为开机启动
    /etc/init.d/ntpd start #启动NTP服务器
    /etc/init.d/ntpd stop #关闭NTP服务器
    /etc/init.d/ntpd restart #重启NTP服务器

附参考目录:
https://www.linuxidc.com/Linux/2014-01/95258.htm
https://blog.csdn.net/wunianjiumeng/article/details/79070326
https://www.cnblogs.com/2018shawn/p/9022425.html
https://blog.csdn.net/wangcg123/article/details/53693935
https://www.cnblogs.com/zwingblog/p/6110588.html

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

推荐阅读更多精彩内容