HOSTNAME

Robert Locke rlocke at ralii.com
Thu Sep 2 01:49:39 UTC 2004


On Wed, 2004-09-01 at 12:19, Chadley Wilson wrote:
> On Wednesday 01 September 2004 16:27, Mike Wills wrote:
> > Three other people have stated the correct location.
> >
> > /etc/sysconfig/network
> >
> > I have done this and it works, both in FC1 and FC2.
> I know, I got that, its just that there seems to be a spook in this config 
> somewhere, I don't know where though, probably someone has added a hostname 
> command to a startup script somewhere which causes the hostname to be set on 
> boot, but not permanently, as in, in one of the correct files. 
> So I am not spending hours hunting for it I will just add  another statement 
> to rc.local
> 
The "spook" is in the network startup scripts.....

Start with /etc/rc.d/init.d/network which you will see calls
/etc/sysconfig/network-scripts/ifup which calls a function need_hostname
found in /etc/sysconfig/network-scripts/network-functions which declares
that the "hostname" needs to be fixed if the variable setting which was
sourced from /etc/sysconfig/network (the file everyone pointed you to)
is set to "localhost" or "localhost.localdomain" or "(none)", but the
real key to "setting" the new hostname is actually done by the above
ifup script calling /etc/sysconfig/network-scripts/ifup-post which calls
the pair of functions "need_hostname" and "set_hostname" found in the
above network-functions file.  Ultimately, it will perform a DHCP query
to get the hostname but failing that will actually do a reverse DNS
lookup to obtain the "correct" hostname.

Check out the files, because there are a few exceptions as to why in
some conditions it will not update the hostname (i.e. a ppp connection).

Hope that helps resolve your question,

--Rob






More information about the fedora-list mailing list