Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Aug 2009 12:13:17 -0700
From:      Nerius Landys <nlandys@gmail.com>
To:        RW <rwmaillists@googlemail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: /etc/rc.d/named dilemma
Message-ID:  <560f92640908221213p2e426650x3bcad3b93de4d4a3@mail.gmail.com>
In-Reply-To: <20090822164219.1d439ae4@gumby.homeunix.com>
References:  <560f92640908212137s376f1dc8vaba59618a6b71d67@mail.gmail.com> <20090822164219.1d439ae4@gumby.homeunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?560f92640908221213p2e426650x3bcad3b93de4d4a3>