/etc/hostname isn't anything I've ever heard about.
You should make sure you have an entry in /etc/hosts though.
But I suspect if you've never set your hostname, then DHCP is doing it for you. You might want to look in :
[edit]
Doh! Hit the wrong button... Continuing
[/edit]
/etc/sysconfig/network-scripts
There are a bunch of scripts in there which control your network connections. For the sake of completeness I'm going to go into a great deal of detail here, but the solution is fairly simple
ifup - is a script which 'ups' a network connection. It contains the following lines :
if need_hostname; then
PUMPARGS="${PUMPARGS} --lookup-hostname"
DHCPCDARGS="${DHCPCDARGS} -H"
fi
The -H on the end of DHCPCDARGS is important here. It tells dhcp to 'set the hostname of this machine to be what DHCP tells me my interface is called'.
need_hostname is defined in /etc/sysconfig/network-scripts/network-functions
it looks like this :
need_hostname()
{
if [ "`hostname`" = "(none)" -o "`hostname`" = "localhost" -o \
"`hostname`" = "localhost.localdomain" ]; then
return 0
else
return 1
fi
}
Which basically says 'if I don't have a hostname, or my hostname is localhost (or localhost.localdomain) then I need a hostname...
There are two ways you can do this. You can either manually (or in a script at bootup) type 'hostname humbert' or you can set it in
/etc/sysconfig/network
where the file should contain the following :
NETWORKING=yes
HOSTNAME='humbert'
where 'humbert' is the name of your machine. Once you set that you should be good.
Allternatively, if you don't like the way that DCHP works, you can remove the -H from the DHCP section of the 'ifup' script, and it won't ever do it again.
*bounce*
Slick.