LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Want to set up a new domain name and hostname? (https://www.linuxquestions.org/questions/linux-networking-3/want-to-set-up-a-new-domain-name-and-hostname-53687/)

hamster 04-06-2003 09:09 AM

Want to set up a new domain name and hostname?
 
Hi. I'm using RedHat 8.1 for a couple months now and really like a lot fo it's features. I'm trying to set up
a new domain name and hostname without affecting my net utils. This is installed on a laptop with a dial-up
connection.

I know that /etc/hosts defines "localhost" as 127.0.0.1. Can I add or change this to use say some pseudo name like "darkside.com" or can I add a new ip? Should I change /etc/hosts myself or use "redhat-config-network"
I changed it before but it prevented my net utils (ie browser) from resolving net addresses. :eek:

Mara 04-06-2003 10:17 AM

You can use 'hostname' command. It changes your current host name (hostname newname). If you run it without parameters, you'll be shown the current name.

hamster 04-06-2003 10:45 AM

> hostname ganymede


Yep, that worked it changed the hostname to "ganymede".

However during login I get;

"could not look up internet address for ganymede. This will prevent Gnome from operating correctly. It may be possible to correct the problem by adding ganymede to /ete/hosts.

I logged in anyway and checked /etc/hosts:

127.0.0.1 localhost.localdomain localhost
#127.0.0.1 ganymede.com localhost


The 2nd line was added automatically.... but shouldn't the 1st lined be remmed out instead of the new one? Or is the 1st one always necessary?

Further info......

I tried rebooting and came back to the login screen. The hostname has changed back to localhost.localdomain again. logging in gives me the same message. The /etc/hosts is the same except is:

#127.0.0.1 localhost.localdomain localhost
127.0.0.1 ganymede.com localhost

The only action was the above. Maybe I should use redhat-config-network. :confused:







Mara 04-06-2003 11:09 AM

Add to /etc/hosts:
127.0.0.1 ganymede
Reboot and test if it works.

hamster 04-06-2003 11:30 AM

Ok, putting in ".com" in ganymede threw it off. I set it to "ganymede" in the /etc/hosts file. I logged out without rebooting and saw the login with the new hostname. Logged in and went online - fine ! :)

Upon reboot however, it has gone back to localhost.localdomain
on the login screen. Hmmm. :( This is a standard non-modified redhat install...

looking at the /etc/hosts it is still has my changes:

#127.0.0.1 localhost.localdomain localhost
127.0.0.1 ganymede localhost

but hostname cmd comes back with "localhost.localdomain".

Something very small?

Running redhat-config-network shows me me 1 entry "127.0.0.1 name:ganymede alias: localhost"

Surely I shouldn't need to add "hostname ganymede" to some start up script?

Mara 04-06-2003 11:56 AM

It looks you should...Don't have RH, so I can't find the file it keeps it. There's another way. Open /etc/rc.d/rc.local and add 'hostname ganymede' somewhere at the end. It's one of the startup scripts (the last one), so it won't be changed later.

hamster 04-06-2003 12:04 PM

Thanks!
 
Thanks Mara!

I wasn't sure which one to add it to but /etc/rc.d/rc.local has done the trick!

Again really appreciate the help! :)


All times are GMT -5. The time now is 02:32 AM.