大家好我是sean,因客户需求,首次在生产环境搭建ntp服务
硬件环境情况
准备2台独立服务器,分别为:
10.3.3.62/192.168.36.230 ntpd服务器,用于与外部公共ntpd同步标准时间
10.3.3.64/192.168.36.85 ntpd客户端,用于与ntpd同步时间
系统环境
Oracle linux7.3 x86_64
Oracle rac 集群版本 11.2.0.3
检测2台机器是否安装
[root@a05 ~]# rpm -q ntp
ntp-4.2.6p5-28.0.1.el7.x86_64
如果已经安装则略过此步,否则使用yum进行安装,并设置系统开机自动启动并启动服务
yum -y install ntp
systemctl enable ntpd(如果设置了这一步还是开无法启动,那么执行systemctl disable chronyd.service )
systemctl start ntpd
设置ntp服务器10.3.3.62
配置前先使用命令:ntpdate -u cn.pool.ntp.org,同步服务器
修改/etc/ntp.conf文件,红色字体是修改的内容
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
restrict 192.168.36.0 mask 255.255.255.0 nomodify no