Subject: Re: dhclient-script question regarding resolv.conf (Solved)
To: Christos Zoulas <christos@zoulas.com>
From: Ian Thomas <ipthomas@mac.com>
List: netbsd-users
Date: 03/26/2004 15:42:49
On Mar 26, 2004, at 2:33 PM, Christos Zoulas wrote:
> On Mar 26, 2:24pm, ipthomas@mac.com (Ian Thomas) wrote:
> -- Subject: Re: dhclient-script question regarding resolv.conf
>
> | The contents of /etc/dhclient.conf
> |
> | # DHCP setup options.
> | interface "rtk0"
> | {
> | send host-name "my.domain.org";
> | request subnet-mask, broadcast-address, routers,
> | domain-name-servers;
> | require subnet-mask, domain-name-servers;
> | script "/sbin/dhclient-script";
> | }
>
> mine looks like:
>
> timeout 60;
> retry 120;
> reboot 10;
> select-timeout 10;
> initial-interval 2;
>
> interface "ep0" {
> supersede host-name "stinky.astron.com";
> supersede domain-name "astron.com gw.com";
> supersede nis-domain "";
> prepend domain-name-servers 127.0.0.1, 192.168.2.9;
> request subnet-mask, broadcast-address, routers,
> domain-name, domain-name-servers, host-name;
> require subnet-mask, routers;
> script "/sbin/dhclient-script";
> }
The proverbial light-bulb came on as I was looking at the man page for
dhclient.conf(5).
1. By default, the DHCP server requests the ... domain-name,
domain-name-servers, and ...
If the DHCP server doesn't get a value for its request for a
domain-name, then resolv.conf will not be created unless you specify a
domain-name value in your dhclient.conf file. By adding
supersede domain-name "domain.org";
a copy of resolv.conf was generated. The values in the file
dhclient-script: new_domain_name and new_domain_name_servers;
correspond to the values domain-name and domain-name-servers in the
file dhclient.conf, respectively.
Should the logic in the function make_resolv_conf be changed to allow
for the situation when just domain-name-servers are sent without a
domain-name, and vice-versa? resolv.conf can do its job with either
the search or nameserver option filled in. Maybe just generate a
resolv.conf file containing two comments like if the DHCP server fails
to give either a domain-name or domain-name-servers.
ex.
# Created by dhclient ...
# No domain-name or nameservers could be found.
This would allow a person just setting up a box on a network using
DHCP to not have to create a dhclient.conf file at all because the
defaults would "do-the-right-thing". Just a suggestion to make DHCP
more user-friendly. Appreciate the help.
Ian