LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   hostname (https://www.linuxquestions.org/questions/linux-newbie-8/hostname-216757/)

mikpos 08-12-2004 12:14 PM

hostname
 
I have fedora2 core installed and I need to change the hostname from localhost.localdomain to another, still maintaining the 127.0.0.1 or the other IP that my network adapter has, but I can I do it???

The last time I've tried this, gdm gave me an error with gnome and it had problem loggin

stickman 08-12-2004 12:40 PM

You need to have localhost.localdomain and localhost pointing to 127.0.0.1. You can also point your hostname there or to another IP on another interface.

mikpos 08-12-2004 07:47 PM

But can I have 2 diferentes hostname for 127.0.0.1?
Can I have 1 hostname for 127.0.0.1 and another one diferent hostname on the same machine with a diferent IP number, not another machine, but the same machine?
If so does will fedore continues to login for the localhost.localdomain has it does in this moment?

att
julio
thanks for the other reply

jhayden 08-12-2004 10:36 PM

Quote:

Originally posted by mikpos
But can I have 2 diferentes hostname for 127.0.0.1?
Can I have 1 hostname for 127.0.0.1 and another one diferent hostname on the same machine with a diferent IP number, not another machine, but the same machine?

I guess I don't understand your questions. Host information should be added to /etc/hosts. Look at man hosts for the format. In my /etc/hosts file, I have 127.0.0.1 being pointed to by localhost and a second hostname. What exactly are you wanting to do?

Josh

mikpos 08-13-2004 04:00 AM

I want to make a server providing web-services with GRID

james.farrow 08-13-2004 04:42 AM

To change the hostname I think u need to edit 2 files. The 1st is etc/hosts , edit it with vim but LEAVE the the localhost.localdomain alone just TAB then add what u want ie if u want the name 2 b redhat9.redhat.com just add the redhat9, save and exit.Then I think its vim /etc/sysconfig/network and change the line that says localhost.... to redhat9.redhat.com save and exit. Then to see the host name change press CTRL D at the prompt(NO GUI) and the host will change, no reboot required.

amfoster 08-13-2004 06:52 AM

You are using Red Hat, so the file that declares your hostname is
/etc/sysconfig/network This will be persistent thru re-boots


You can set it temporarily with the command hostname
hostname host1.mydomain.com

You will need to log off and on to see the results.

stickman 08-13-2004 07:49 AM

Quote:

Originally posted by mikpos
But can I have 2 diferentes hostname for 127.0.0.1?
Can I have 1 hostname for 127.0.0.1 and another one diferent hostname on the same machine with a diferent IP number, not another machine, but the same machine?
If so does will fedore continues to login for the localhost.localdomain has it does in this moment?

att
julio
thanks for the other reply

You can do something like:
127.0.01 localhost.localdomain localhost myname

Or you can do:
127.0.0.1 localhost.localdomain localhost
192.168.0.2 myname

The "real" hostname will continute to be whatever is reported by the hostname command, which is initially set by the config files specific to your distro.

arsongt 08-27-2004 02:29 PM

change localhost name for logon
 
I just want to change then name of "localhost" to my nickname to show at log on. Without changing any configuration since I really dont know much about my network config. since I get my IP detected automatically from the LAN.

amfoster 08-27-2004 02:38 PM

The system's hostname is derived normally from the entry in Red Hat's /etc/sysconfig/network file.

You can bind a hostname to 127.0.0.1 as well. Edit your /etc/hosts file and do something like this:

We will assume a hostname such as host1.example.com

127.0.0.1 localhost.localdomain localhost host1.example.com host1


All times are GMT -5. The time now is 03:01 AM.