[ntp:questions] Re: DHCP and NTP configuration

Dale Worley worley at dragon.ariadne.com
Thu Oct 30 18:02:19 UTC 2003


ptrojane at mion.elka.pw.edu.pl (Piotr Trojanek) writes:
> What DHCP client/setup do you know, that makes use from already distributed
> information? I have put IP of NTP server into dhcpd.conf, but my debian
> and *BSD machines doesn't care about it. How to make them ask DHCP for
> NTP server address?

The DHCP Parameter number 42 is documented as:

   42      NTP Servers              N    NTP Server Addresses          [RFC2132]

in http://www.iana.org/assignments/bootp-dhcp-parameters.

RFC 2132 gives:

8.3. Network Time Protocol Servers Option

   This option specifies a list of IP addresses indicating NTP [18]
   servers available to the client.  Servers SHOULD be listed in order
   of preference.

   The code for this option is 42.  Its minimum length is 4, and the
   length MUST be a multiple of 4.

As for what DHCP systems use this option, in Red Hat Linux 8.0,
/etc/dhclient-script processes information obtained from the DHCP
server, and it includes the following code

  if [ -n "$new_ntp_servers" ]; then
      cat <<EOF > /etc/ntp.conf
restrict default ignore
restrict 127.0.0.1
driftfile /etc/ntp/drift
broadcastdelay 0.008
authenticate yes
keys /etc/ntp/keys
EOF
      :> /etc/ntp/step-tickers
      for I in $new_ntp_servers; do
	  echo "server $I" >> /etc/ntp.conf
	  echo "$I" >> /etc/ntp/step-tickers
      done
	fi

That's a little harsh, since it overwrites any NTP configuration
already present.

Dale



More information about the questions mailing list