View Full Version : hostname of my machine

6th May 2009, 07:58 PM

Setting a hostname of a machine can be done as described in :


Q: How do I set or change the hostname of my machine?

A: This depends upon the distribution. In RedHat, you will find a file called /etc/sysconfig/network. In there you'll see a line

or something similar. Change the localhost.localdomain line to your desired hostname. Other distributions have a file called either /etc/hostname or /etc/HOSTNAME. You may have to create the file if it doesn't exist. Often doing
man hostname

will tell you which file is used. In Gentoo, for example, you manually create a file called /etc/hostname and put your desired hostname in there.
back to top

This is done in the "section" network.

Will my machine have more than 1 name if there are more than 1 networkcards in py pc ?

If so : Is this than still a machine name, or rather a network station name ?

6th May 2009, 09:19 PM
Hello phe

There is also a section in:


also known as "Network Configuration" from the Administration menu where you may set that. On the DNS tab there is a section for "hostname" and that sets it.

Interestingly, if you install from a DVD, you are asked during install for this information and it is recorded.

If you've installed from the Fedora 11 Live CD you are asked for the same information during install, but in my experience it isn't recorded.

If you have a laptop with both wired and wireless interfaces, the equivalent of your two network cards, there is still only the one DNS tab and only one opportunity of setting the hostname.

I can't imagine ever having two names for one computer, it sounds the route to insanity to me.

Now I can wait for some network guru to prove me wrong!!

7th May 2009, 01:56 AM
You system can only have one real hostname!

You could however use BIND/DNS to map "virtual" hostnames to alternate IP's, if the server is using multiple NIC's. But the server will still answer with it's assigned hostname, in any event.

Some applications, like email, allow you to "spoof" this name, to avoid complications when communicating with other mail servers!

Beyond that, you may be able to setup a "chrooted" environment, but this is basically another installation, so it's beyond the scope you were looking for. Of course Virtualization would allow for this too, but again, all are separate entities!

13th May 2009, 06:23 PM
You system can only have one real hostname!

Will this be the name mentioned on the bash prompt ?

eg :
[phe@f9 ~]$

17th May 2009, 11:30 AM
Hello phe

Yes, the 'phe' is obviously the username you decided on for your system, at sometime you have given the machine the name of 'f9' otherwise the bash prompt would be reporting 'phe@localhost'.

For comparison purposes this machine has this at the bash prompt:


17th May 2009, 02:33 PM
Just to mention, the FAQ cited in the first post is completely outdated, last edited, I think, around RedHat (NOT Fedora) 6 or so. One should also edit /etc/hosts as well, which will have an entry for the hostname.