Subject: Re: rc.d: time synchronization issues at boot time
To: None <tech-userlevel@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-userlevel
Date: 03/16/2005 17:55:03
On Wed, 16 Mar 2005, Alistair Crooks wrote:
> It seems that there are a number of ways to fix the root of the problem:
> 
> 1. write a minimal name resolution service which would just do
> lookups, no zone transfer or any of the other things that the
> full DNS does. Use this to resolve hostnames before the full
> name service is started.

"named" can do this job.  All it needs is a command line option to make
it use a special named.conf file.  Then, after ntpdate has run,
kill this special named and start the normal named.  Here, I
donate the following named.conf file to the public domain:

	options {
		directory "/etc/namedb";
		listen-on port 53 { 127.0.0.1; };
	};
	zone "." {
		type hint;
		file "root.cache";
	};

If there's a resolv.conf file that points to working name servers
(specified by IP address), then you don't even need this.

> 2. bring up dns, resolve the names of the time server, stop dns,
> get a good time value from the ntp server, set time, and re-start
> dns. Repeat for kdc and whatever else needs good time.

The following sequence is sufficient, modulo concerns about whether
/etc/resolv.conf contains "nameserver 127.0.0.1":

    start cacheing-only named
    run ntpdate and let it step the time
    kill cacheing-only named
    start normal named

--apb (Alan Barrett)