Subject: Re: No nameservers configured when using DHCP/dhclient
To: None <netbsd-users@netbsd.org>
From: Lee W <lee@unassemble.co.uk>
List: netbsd-users
Date: 05/19/2003 23:42:27
Robert Elz wrote:
>     Date:        Sun, 18 May 2003 19:22:03 -0400
>     From:        "Steven M. Bellovin" <smb@research.att.com>
>     Message-ID:  <20030518232204.15EE57B4D@berkshire.research.att.com>
> To debug the dhclient script, edit it (/sbin/dhclient-script) and right
> near the start (but after the #! line obviously) add ...
> 
> exec >> /tmp/dhclient-debug 2>&1
> echo "======================"
> date
> echo "$# args: $@"
> set
> set -x
> 
> and then run dhclient normally, and after it has done, examine the
> debug file (/tmp/dhclient-debug - obviously you can put it wherever
> you like).
> 
> This, along with examination of the dhclient-script (after you have
> the output, so you can easily see what is actually being done, and
> why) will usually allow any problems to be easily detected.

Thanks for your help everyone,  I think I have cracked (sorry hacked) it.

It seems as the dhclient-script was at fault:-

#!/bin/sh
#
# $NetBSD: dhclient-script,v 1.4 2002/04/10 10:11:41 enami Exp $

ENTERHOOKS=/etc/dhclient-enter-hooks
EXITHOOKS=/etc/dhclient-exit-hooks
RESOLV=/etc/resolv.conf
SIGNATURE="# Created by dhclient at: "
make_resolv_conf() {
	echo "MAKING RESOLV.CONF"
          if [ \( ! -z "$new_domain_name" \) -a \
	     \( ! -z "$new_domain_name_servers" \) ]; then
		if [ -f $RESOLV ]
		then
			while read line; do
				case $line in
				"$SIGNATURE"*)
					;;
				*)
					mv $RESOLV $RESOLV.save
                                         echo "MOVED RESOLV.CONF.SAVE";;
				esac
				break
			done < $RESOLV
		fi
         fi <--- Moved from Below

		echo "$SIGNATURE$(date)" > $RESOLV
		if [ ! -z "$new_domain_name" ]
		then
			echo search $new_domain_name >> $RESOLV
		fi
		for nameserver in $new_domain_name_servers; do
			echo nameserver $nameserver
		done >> $RESOLV

	#fi <--- Commented out
}

What I did was move the code for creating the resolv.conf file outside 
of the checks for length of $new_domain_name & $new_domain_name_servers. 
  Consequently this allowed the resolv.conf file to be created.


Can anyone tell if what I have done will cause me any future trouble? 
I would hate to think that I have compromised my shiny new install.

Thanks

Lee