Red Hat Bugzilla – Bug 114487
NTP suggested enhancement
Last modified: 2007-11-30 17:07:00 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2)
Description of problem:
the ntp package version has increased recently to 4.1.2 and shipped
with an ntp.conf file with different options to before. Basicly now
the ntp.conf file has line
restrict default ignore
typically you could add:
and it would work, now you need to resolve the IP address of the
'my-time-server.example.net' and then add into the ntp.conf file:
restrict ip-of-my-time-server mask 255.255.255.255 nomodify
this will then allow the ntpd running to sync/correct time as needed
Since one of the main Ideas of DNS is to allow hostnames to resolve to
difference IP's seemlessly, this has a high chance to break should
'my-time-server.example.net' IP address change, requiring you to login
and fix all the systems you admin to this new IP (not much fun).
As such, I have an initial solution/enhancement to get arround this issue:
- Add within /etc/sysconfig/ntp line:
- Add within /etc/rc.d/init.d/ntpd lines:
#Force system adjustment from time server.
/usr/bin/logger -t ntpd "From /etc/sysconfig/ntp - using
/usr/sbin/ntpdate -o 1 $NTPSERVER 1>/dev/null 2>&1
#Check to see if IP for $NTPSERVER is set within /etc/ntp.conf
# to allow time syncs for ntpd.
NTPSERVERIP=`dig +short $NTPSERVER| sed -n 2p`
if grep "^restrict $NTPSERVERIP" /etc/ntp.conf > /dev/null
/usr/bin/logger -t ntpd "File /etc/ntp.conf configured
for $NTPSERVER's IP address of $NTPSERVERIP"
/usr/bin/logger -t ntpd "Adding $NTPSERVERIP into
/etc/ntp.conf file for $NTPSERVER"
if [ -s /etc/ntp.conf.orig ]
mv /etc/ntp.conf.orig /etc/ntp.conf.orig.1
sed "1s/^/#Allowing $NTPSERVERIP for
$NTPSERVER\nrestrict $NTPSERVERIP mask 255.255.255.255 nomodify\n/"
/etc/ntp.conf > $NTPTMPFILE
if [ -s $NTPTMPFILE ]
mv /etc/ntp.conf /etc/ntp.conf.org
mv $NTPTMPFILE /etc/ntp.conf
# Start daemons.
echo -n $"Starting $prog: "
I could have added a section to add the "server
my-time-server.example.net" within ntp.conf within the script, but
this is a one time deal/addition which wouldnt change (unlike the IP
it resolves to). Of course this is just a suggested ideal/solution -
but figured you may be interested.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Internal RFE bug #114776 entered. Will be considered for future releases.
Thank you for the suggestion. It was passed along to product
management, but not committed for a future release.