码迷,mamicode.com
首页 > 其他好文 > 详细

ntp内网时间同步(基于centos6.5)

时间:2015-08-12 14:54:38      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:ntp时间服务器

ntp内网时间同步(基于centos6.5)


服务器端:


安装ntp

yum install ntp


编辑配置文件

vi /etc/ntp.conf

添加

restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap

server time-b.nist.gov

其他server都注释掉


vi /etc/sysconf/iptables


添加iptables规则

-A  INPUT -m state --state NEW -m udp -p udp --dport 123 -j ACCEPT


重启iptables

sudo service iptables restart


重启ntp

sudo service ntpd restart


客户端:


安装ntp

yum install ntp



编辑配置文件

vi /etc/ntp.conf


添加

server 192.168.10.111

其他server都注释掉


同步时间

sudo ntpdate 192.168.10.111


把同步命令添加到任务计划


查看时间

date


所有客户端机器都跟ntp服务器时间同步!

本文出自 “linux&云计算” 博客,请务必保留此出处http://czbinghe.blog.51cto.com/9824423/1683958

ntp内网时间同步(基于centos6.5)

标签:ntp时间服务器

原文地址:http://czbinghe.blog.51cto.com/9824423/1683958

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!