Date: Mon, 11 Jun 2007 20:32:10 +0100 From: RW <fbsd06@mlists.homeunix.com> To: freebsd-questions@freebsd.org Subject: Re: rc.d NETWORKING dependancy not waiting for network to be up Message-ID: <20070611203210.47bb240d@gumby.homeunix.com.> In-Reply-To: <1ACC527A-E8B3-42C6-9F71-F10B0B6F77A4@conundrum.com> References: <1ACC527A-E8B3-42C6-9F71-F10B0B6F77A4@conundrum.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 11 Jun 2007 09:28:26 -0400 Matt Pounsett <matt@conundrum.com> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > It looks like the NETWORKING dummy dependancy doesn't actually cause > the its dependants to wait for networking to be up, but simply for > interfaces to be configured. I'm wondering if this is actually > intended, or if it's an unavoidable design flaw, or what? > > I'm noting on my systems that ntpdate and ntpd are trying to start > before the network is actually reachable, and therefore both have > issues starting. ntpdate is unable to sync the clock properly > before ntpd starts, and ntpd doesn't seem to ever be able to sync to > a time server if it starts trying to contact one before the network > is fully up... and needs to be restarted after boot in order for it > to work properly. > > I'm working around the issue by sticking a 20 second delay into /etc/ > rc.d/NETWORKING (this is probably way more than necessary, but I'm > allowing for a large margin of error) which seems to fix my problem, > but is obviously not ideal. I wrote a lttle rcng script to handle it it. It runs immediately before ntpdate,and waits until it can ping my ISP's nameservers (ignoring the 127.0.0.1 entry in resolv.conf), or you can specify ip addresses. $ cat /usr/local/etc/rc.d/networkwait #!/bin/sh # # PROVIDE: networkwait # REQUIRE: named # BEFORE: ntpdate . /etc/rc.subr networkwait_enable=${networkwait_enable:-"NO"} name="networkwait" rcvar=`set_rcvar` stop_cmd=":" start_cmd="wait_network" wait_network(){ if [ "$networkwait_ping_hosts" ] ; then host_list="${networkwait_ping_hosts}" else # No hosts supplied - use external nameservers host_list=`awk '/^ *nameserver/ {print $2} '< /etc/resolv.conf | grep -E -v '^127\.0+\.0+\.0*1'` fi echo -n "Waiting for network access ... " while true ; do for inet_host in $host_list ; do if ping -nc1 $inet_host 2>&1 > /dev/null ; then echo "ping to ${inet_host} succeeded." # Re-Sync ipfilter and pf in case # they had failed DNS lookups /etc/rc.d/ipfilter resync /etc/rc.d/pf resync exit 0 fi done sleep 5 done } load_rc_config ${name} run_rc_command "$1"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070611203210.47bb240d>