Can we use DNS hostname at "restrict" option in ntp.conf?

Solution Verified - Updated -

Issue

  • Can NTP from RHEL use DNS addresses in the 'restrict' line?
  • DNS addresses at the "restrict" option do not work. If you set a DNS address at the option, time synchronization to the server is not established.

Sample ntp.conf:

restrict default ignore

# 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 -6 ::1
restrict 0.rhel.pool.ntp.org nomodify noquery

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org
  • When ntpd starts up, following messages were logged. Why was this log written?
ntpd[xxx]: getaddrinfo: "<DNS hostname>" invalid host address, ignored
ntpd[xxx]: restrict: error in address '<DNS hostname>' on line 6. Ignoring...

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • ntpd

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content