hostname curiosity [SOLVED] ...but curioser and curioser

Steve zephod at cfl.rr.com
Thu Jan 29 15:05:40 UTC 2009


---- "Mikkel L. Ellertson" <mikkel at infinity-ltd.com> wrote: 
> Steve wrote:
> > ---- "Mikkel L. Ellertson" <mikkel at infinity-ltd.com> wrote: 
> >> Steve wrote:
> >>> Cool! Adding 
> >>>
> >>> DHCP_HOSTNAME=yes
> >>>
> >>> to /etc/sysconfig/network-scripts/ifcfg-eth0 seems to have done
> >>> the trick. Now there is a longer pause during booting when it gets
> >>> to the Setting up eth0...[OK] line so I'm guessing it is waiting a
> >>> little longer to get an answer from the dhcp server.
> >>> Btw, where are the docs for the ifcfg-eth0 file syntax? There is
> >>> no man page for it.

It looks like I spoke too soon. Yesterday when I booted up in the morning I got the hp<number> for the host name back, ie not what I was expecting. Rebooting got the correct name again.

> > The second thing is that there is no DHCP_HOSTNAME option listed
> > in the /usr/share/doc/initscripts-8.76.4/sysconfig.txt and yet it
> > DHCP_HOSTNAME="yes" seems to work evem though PERSISTENT_DHCLIENT is
> > still not set.
> > 
> It should be set to the hostname you desire. I am surprised that it
> is not in the file. It is processed by the ifup-eth script.

I did some looking around in the ifup-eth scrupt and yes, you are correct in that whatever DHCP_HOSTNAME is set to gets sent to the dhcp server to say that this is the hostname I want. But that's the problem - I want the dhcp server to tell the client what hostname to use, not the other way around. From the dhclient man page:

-R <option>[,<option>...]
              Specify the list of options the client is to request from the server.  The option list must be a single string consisting of option names separated
              by at least one command and optional space characters.  The default option list is:

                  subnet-mask, broadcast-address, time-offset, routers,
                  domain-name, domain-name-servers, host-name, nis-domain,
                  nis-servers, ntp-servers

This tells me that the client >>requets<< host-name >>from<< the server by default so it should not be necessary to configure anything to get this. (Hmmm... maybe the dhcp protocol does not >require< that the server honour the request). Obviously, this is not working all the time so I modified ifup-eth and replace the -q switch to dhclient with a -v to try and get a better idea of what is going on. I saw some messages flash by during the boot but I can't find where they have been logged. Any ideas or do I need to log them manually by adding '> dhclient.log 2>&1 ' to the dhclient startup call?

> > The third thing is that something is creating a
> /etc/dhclient-eth0.conf file at boot time that contains this line:
> > 
> > send host-name "yes"; # temporary RHL ifup addition
> > 
> I am not sure what is creating it - I will have to look into it.
> 
> > Obviously, my host name is not "yes" so this must be some
> > special, undocumented use of send host-name that make the
> > dhcp client get the hostname from the server.
> > 
> I think it is causing the DHCP server to send the client a hostname.
> It is probably a "feature" of the server, rather then something with
> the client.

I figured this one out. The ifup-eth script writes the dhclient-eth0.conf file with the line

send host-name "<whatever DHCP_HOSTNAME in ifcfg-eth0 is set to>";

so when I wrote DHCP_HOSTNAME=yes in ifcfg-eth0 I got
send host-name = "yes";
in dhclient-eth0.conf.

Steve




More information about the fedora-list mailing list