在CentOS 6上设置NTP服务器

时间:2020-03-21 11:47:08  来源:igfitidea点击:

NTP用于将Linux系统上的时间与集中式NTP服务器同步。
可以将网络上的本地NTP服务器与外部计时源同步,以使组织中的所有服务器与准确的时间保持同步。

安装并配置NTP服务器

安装NTP软件包:

# yum install -y ntp

打开“ /etc/ntp.conf”文件进行编辑并添加以下内容:

tinker panic 0
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
server 0.uk.pool.ntp.org iburst
server 1.uk.pool.ntp.org iburst
server 2.uk.pool.ntp.org iburst
server 3.uk.pool.ntp.org iburst
driftfile /var/lib/ntp/drift

服务器列表可能会因我们所在的位置而异。

iptables将通过Puppet进行配置。
下面的行仅用于:

# iptables -A INPUT -s 10.8.8.0/24 -p udp -m state --state NEW --dport 123 -j ACCEPT

故障排除

检查日志:

# tail /var/log/messages