From owner-freebsd-questions@FreeBSD.ORG Sat Aug 22 19:13:18 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B538A106568F for ; Sat, 22 Aug 2009 19:13:18 +0000 (UTC) (envelope-from nlandys@gmail.com) Received: from mail-pz0-f171.google.com (mail-pz0-f171.google.com [209.85.222.171]) by mx1.freebsd.org (Postfix) with ESMTP id 37B0C8FC16 for ; Sat, 22 Aug 2009 19:13:18 +0000 (UTC) Received: by pzk1 with SMTP id 1so333260pzk.3 for ; Sat, 22 Aug 2009 12:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=HVLq32zJj8QLKNKmC5M8aKVWHc9SKtyNbi2+0yC7Qyc=; b=fMFoJIwfSYYKCYa0eL/TKMoMJvfRf/Q9IRmZXAbX1OP0Qzs7VDWrTdqbIY3Sfp8tKT GY/2UErLhuCgwCzFtkSoJ2xcGwd9x8ZhmRkTkDqE0AiW0ULSoj2vNeQQEuuo1sF+F2vM v9cFl4ee9SI7KRFpFIhHoLJkph5RwD3p2j0D4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=taM7t7BUFi0MCLSVgF640FJbxRfovVxZs1IOGjBoSEKOZGQbLqZFAceUEVc+HUTP1w neaItcL54eYyv/n5kZKeW0z5BvEvx0nsznjHBSOOtacStSow0GzJyFGTr1LeE1MGdxRf cxFWAKlew4ekfcYvA4PkjKIj5OirdEsmd0DdM= MIME-Version: 1.0 Received: by 10.114.3.36 with SMTP id 36mr2853806wac.112.1250968397942; Sat, 22 Aug 2009 12:13:17 -0700 (PDT) In-Reply-To: <20090822164219.1d439ae4@gumby.homeunix.com> References: <560f92640908212137s376f1dc8vaba59618a6b71d67@mail.gmail.com> <20090822164219.1d439ae4@gumby.homeunix.com> Date: Sat, 22 Aug 2009 12:13:17 -0700 Message-ID: <560f92640908221213p2e426650x3bcad3b93de4d4a3@mail.gmail.com> From: Nerius Landys To: RW Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: /etc/rc.d/named dilemma X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Aug 2009 19:13:18 -0000 Thanks for the script. I found the underlying problem on my system. My server is at a data center and I don't know what kind of equipment the server is connected to. It appears that it takes 30 seconds for the networking to start. I added this script as /etc/rc.d/waitfornetwork, and enabled it in rc.conf: =================== #!/bin/sh # PROVIDE: waitfornetwork # REQUIRE: NETWORKING # BEFORE: named . /etc/rc.subr : ${waitfornetwork_enable:=NO} name=waitfornetwork rcvar=`set_rcvar` stop_cmd=":" start_cmd="waitfornetwork_start" waitfornetwork_start() { echo "Waiting for network to initialize." for i in 0 1 2 3 4 5 6 7 8 9; do #echo "Iteration $i" if ping -c 1 198.41.0.4 | grep -q '^1 packets transmitted, 1 packets received, 0.0% packet loss'; then break fi done } load_rc_config ${name} run_rc_command "$1" =================== It goes through 4 or 5 iterations (the "for" loop) before it exits. This takes about 30 seconds. Without this startup script, ntpdate and ntpd fail, regardless of whether or not I use named as my local DNS caching server. With this script enabled, ntpdate and ntpd are able to resolve the listed DNS for the time servers, regardless of whether I'm using 127.0.0.1 or some other DNS in my resolv.conf. This 30 second delay for the network to start on every reboot (at the data center) - is this normal?