The script below was used to configure the RHEL or CentOS host to act as an NTP client to the CentOS NTP pool. In summary, the script below does the following:
- Install ntp
- Setup the ntp.conf configuration file
- Enable ntp to startup upon bootup
- Startup ntp
- Execute ntpq to verify the box is acting as a ntp client
yum install ntp -y
cp /etc/ntp.conf /etc/ntp.conf.orig
cat > /etc/ntp.conf << EOF
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.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
EOF
chkconfig ntpd on
service ntpd restart
ntpq -p
Leave a comment