How to change hostname in FC3

Trevor Smith trevor at haligonian.com
Fri Dec 10 03:45:35 UTC 2004


On December 9, 2004 10:38 pm, Johnny Smith wrote:
> I have later added profiles for a wlan card and a
> separate lan-ethernet card.
...
> However when I do 'hostname newhostname' it only holds
> it til I reboot and reverts to
> localhost.localdomain....
>
> Curiously I am unable to place anything in my
> /etc/hosts file... if I do it disappears on reboot.
>
> Could these problems be related

Sort of.

When you switch "profiles", FC writes over your /etc/hosts file (and possibly 
others) with a link to the copy in your
/etc/sysconfig/networking/profiles/profile-name-here directory. This process 
(creating a new link that overwrites the above mentioned file) also happens 
at boot time (so I've been told). That's why your changes to your /etc/hosts 
file are getting discarded. You can edit the copy of the hosts file that is 
in the corresponding profile directory if you want to make changes to it and 
have them saved.

But that's not the file that you really want to modify to permanently to set 
your hostname. It's the /etc/sysconfig/network file that seems to tell the 
system what your hostname is. The syntax is obvious. Have a look.

The other person who directed you to system-config-network was giving you good 
advice, but if you want to do it "manually", you can just edit 
your /etc/sysconfig/network file.

Interestingly, I just found a potential problem (or maybe not?) with the 
"profiles" system. When you use system-config-network to modify your 
hostname, that utility also updates your /etc/hosts file with an entry that 
translates 127.0.0.1 to whatever hostname you supply. So far so good.

But this new /etc/hosts file will be replaced with an older, not-updated one 
when you switch profiles -- even though your hostname will remain what you 
set it to (in the /etc/sysconfig/network file). The new /etc/hosts file will 
come back when you switch back to the profile you were using when you changed 
your hostname but until you manually "fix" it in the other profile's 
directory, it will never be reflected there, I don't think.

I'm not sure if this will cause problems with resolving your local host's name 
or not, but to be safe, I'd say you should manually update the hosts file in 
all the profile directories that you use.

-- 
Trevor Smith | trevor at haligonian.com
public key   | http://www.haligonian.com/pgp/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20041209/c3c8f0f1/attachment-0001.sig>


More information about the fedora-list mailing list