[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

dhcp and nis problems solved



On Thu, Oct 15, 1998 at 11:41:38AM +0200, Rainer Clasen wrote:
> Hi!
> 
> Lee Bradshaw (lee@sectionIV.com):
> > On Wed, Oct 14, 1998 at 11:18:13AM +0200, Miquel van Smoorenburg wrote:
> > > In article <cistron.19981014001751.A32250@sectionIV.com>,
> > > Lee Bradshaw <lee@sectionIV.com> wrote:
> > > >nis specific problems:
> > > >
> > > >When I run dhclient, /etc/resolv.conf is written with the new dns info,
> > > >but /etc/defaultdomain doesn't change. I guess the file doesn't need to
> > > >change, but the value returned by (nis)domainname isn't modified either.
> > > >I'm using the dhcp-beta_2.0b1pl6-0.1 and dhcp-client-beta_2.0b1pl6-0.1.
> 
> > I set the domainname to a garbage value, ran dhclient, and then expected
> > to see the updated nis domainname from dhcp. But on my system the
> > nis information doesn't appear to be updated by dhcp. Am I missing
> > something? Here is the dhcp server nis information again:
> > 
> >   option nis-domain "alantro.com";
> >   option nis-servers 192.168.50.1;
> > 
> > Do I need to do anything on the client to enable dhclient to override a
> > previous value for the nis domain?
> 
> theoretically this should work:
> 
> a) put apropriate request / require lines in your dhclient.conf. dhclient
>    only asks for dhcp-options it needs / you told it to ask. cat
>    /var/db/dhclient.leases to see what options it got.
> 
> b) You need to extend your /etc/dhclient-script. By default only the bare
>    minimum of all those nice dhcp-options is used: IP adress(es),
>    ip-alias(es), default route(s), netmask?, broadcast, DNS domain name,
>    nameserver(s).

Thanks Ranier,

The dhclient-script was the piece I was missing.

I made a few modifications if anyone is interested:

  function update_static_routes () {
     local action static_routes destination gateway
     action=$1
     static_routes="$2 "   # add space for easy looping
     while [ "$static_routes" ]; do
       destination=${static_routes%% *}
       static_routes=${static_routes#* }
       gateway=${static_routes%% *}
       static_routes=${static_routes#* }
       route $action $destination gw $gateway
     done
  }

I added the following code twice:

    # don't need to test old values for domain/host
    # no problems if resetting them to identical value??
    if [ x$new_nis_domain != x ]; then
      echo $new_nis_domain >/etc/defaultdomain
      nisdomainname `cat /etc/defaultdomain`
    fi
    if [ x$new_host_name != x ]; then
      echo $new_host_name >/etc/hostname
      hostname --file /etc/hostname
    fi

    # old and new static routes different?
    if [ "x$old_static_routes" != "x$new_static_routes" ]; then
      # delete old static routes if they existed
      if [ "x$old_static_routes" != "x" ]; then
        update_static_routes "del -net" "$old_static_routes"
      fi
      # add new static routes if they exist
      if [ "x$new_static_routes" != "x" ]; then
        update_static_routes "add -net" "$new_static_routes"
      fi
    fi

I'm sending a wishlist bug to extend the debian dhclient-script.

-- 
Lee Bradshaw                 lee@sectionIV.com (preferred)
Alantro Communications       lee@alantro.com


Reply to: