SUMMARY: DHCP on boot = no default route

From: <jeff_at_digitalpipe.net>
Date: Thu Oct 25 2001 - 18:03:36 EDT
I figured it out..at least WHY it does what it does after some trussing.

If there is already an entry in /etc/hosts for your host, then it won't update 
/etc/resolv.conf because /sbin/netstrategy returns "ufs none none"

BUT, if you remove that entry from /etc/hosts, the /sbin/netstrategy returns 
"ufs hme0 dhcp"

so I guess I need to make a little sed script to remove the "added by dhcp" 
lines from the /etc/hosts file.

Seems like there should be a better solution, as you'd always want it to 
update your /etc/resolv.conf for you..especially if you moved subnets and it 
had to update your /etc/hosts file as well.  Odd.

---------

  Looks like $_INIT_NET_STRATEGY gets reset by /etc/rc2 in this section:

  set -- `/sbin/netstrategy`
  if [ $? -eq 0 ]; then
          if [ "$1" = "nfs" -o "$1" = "cachefs" ]; then
                  _INIT_NET_IF="$2"
          fi
          _INIT_NET_STRATEGY="$3"
          export _INIT_NET_IF _INIT_NET_STRATEGY
  fi

  Unfortunately, what's happening here, is /sbin/netstrategy is returning:

  ufs none none

  So, _INIT_NET_STRATEGY gets set to "none" right here and exported.  Seems 
like
  this is probably a bug, no?

  Where does /sbin/netstrategy get it's info?  I couldn't find a man page for 
it
  on any of my systems.

  On Thu, 25 Oct 2001 jeff@digitalpipe.net wrote:

  > Well, I now know why DHCP doesn't update the /etc/resolv.conf.  It's 
because
  > _INIT_NET_STRATEGY is set to "none".  In /etc/init.d/inetsvc there is this
  > little if statement:
  >
  > if [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then
  >         dnsdomain=`/sbin/dhcpinfo DNSdmain`
  > else
  >         dnsdomain=
  > fi
  >
  > Which is then followed by:
  >
  > if [ -n "$dnsdomain" ]; then
  >
  >  <big snip>
  >        /usr/bin/mv /tmp/resolv.conf.$$ /etc/resolv.conf
  >        /usr/bin/chmod 644 /etc/resolv.conf
  > fi
  >
  >
  > So, if _INIT_NET_STRATEGY is not "dhcp" then the /etc/resolv.conf doesn't 
get
  > edited.  My question is, where does _INIT_NET_STRATEGY get set and why 
isn't
  > it dhcp?
  >
  > Looks like it's set in: /etc/init.d/network:
  >
  >         if [ "$_INIT_NET_IF" != "$primary" ]; then
  >                 echo "starting DHCP on primary interface $primary"
  >                 /sbin/ifconfig $primary auto-dhcp primary $cmdline
  >
  >                 #
  >                 # diskfull machine which uses dhcp. Set strategy for
  >                 # the use of the rest of this run level.
  >                 #
  >                 _INIT_NET_STRATEGY="dhcp"
  >                 export _INIT_NET_STRATEGY
  >         fi
  >
  > I can't find where $_INIT_NET_IF is defined though.
  >
  > I must have something configured slightly wrong.
  >
  > -Jeff
  >
Received on Thu Oct 25 23:03:36 2001

This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:32:34 EDT