LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2003, 03:40 AM   #1
dincer80
LQ Newbie
 
Registered: Jul 2003
Posts: 8

Rep: Reputation: 0
Unhappy hostname question (urgent)


Currently etc/hosts is:

127.0.0.1 localhost.localdomain localhost

I want to change name of the machine from localhost to "ABC"

Which part should I modify?

localhost.localdomain -> ABC.localdomain [Name]
or
localhost -> ABC [Alias]

or both?


And, any other files needed to be modified?
 
Old 07-31-2003, 03:43 AM   #2
dincer80
LQ Newbie
 
Registered: Jul 2003
Posts: 8

Original Poster
Rep: Reputation: 0
By the way,

etc/sysconfig/network contains:

HOSTNAME = localhost.localdomain



Should I modify this one?

And, lastly, after changing name of the localhost;can "sendmain" cause any problems when starting?
 
Old 07-31-2003, 03:44 AM   #3
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
Neither will change the hostname. /etc/hosts is only used to map hostnames to ip addresses (the precursor to DNS). You need to leave the entry for localhost as it is.

What distro are you running? Different distros set the hostname in different places. Once you've changed the hostname you'll want to add an entry for your new hostname in /etc/hosts on a new line.

cheers

Jamie...
 
Old 07-31-2003, 03:47 AM   #4
dincer80
LQ Newbie
 
Registered: Jul 2003
Posts: 8

Original Poster
Rep: Reputation: 0
I have RedHat Advanced Server 2.1 installed.

I hope you know what file I should modify to change the name of the machine from localhost to something else..

Peace..
 
Old 07-31-2003, 03:52 AM   #5
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
Quote:
Originally posted by dincer80
etc/sysconfig/network contains:

HOSTNAME = localhost.localdomain
OK - that was the missing bit of info. Looks like you're using Redhat or something that uses a similar layout. Yeah, change this entry then reboot, or change this entry then use the hostname command from the command line - whever you prefer.

Once this is done edit /etc/hosts to reflect the change of name, add a line for the new hostname, leave the old entry for localhost alone or things may go screwy.
Quote:
Originally posted by dincer80
And, lastly, after changing name of the localhost;can "sendmain" cause any problems when starting?
Uhm... sorry I don't follow.

cheers

Jamie...
 
Old 07-31-2003, 03:57 AM   #6
dincer80
LQ Newbie
 
Registered: Jul 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Did I understand right? What I gotta do is:

1. Editing etc/sysconfig/network and changing the line "HOSTNAME = localhost.localdomain" to "HOSTNAME = ABC"

2. Rebooting

3. Editing etc/hosts and adding the line
"127.0.0.1 localhost.localdomain ABC"
under the line
"127.0.0.1 localhost.localdomain localhost"


Are these 3 steps correct?
 
Old 07-31-2003, 03:59 AM   #7
dincer80
LQ Newbie
 
Registered: Jul 2003
Posts: 8

Original Poster
Rep: Reputation: 0
As soosn as you confirm, I'll apply the steps :-)
 
Old 07-31-2003, 04:09 AM   #8
dincer80
LQ Newbie
 
Registered: Jul 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Won't you confirm?
Is there anything wrong?
 
Old 07-31-2003, 04:24 AM   #9
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
Easy now, its only been a few minutes since the last update! If someone takes a while to respond it might be becuase they're in a different timezone, or gone to lunch or something! (Or actually doing some work in my case...)

Step 1 is correct, then edit /etc/hosts and add "ABC" to the end of the localhost line (assuming you don't have another IP address), then reboot.

HTH

Jamie...
 
Old 07-31-2003, 04:34 AM   #10
dincer80
LQ Newbie
 
Registered: Jul 2003
Posts: 8

Original Poster
Rep: Reputation: 0
I am sorry about that.. And thank you by the way.

Actually, I have one more line under the
"127.0.0.1 localhost.localdomain localhost"
which is
"21......... qua..... q..."

Does the existence of this line change anything?

Now what should I do?
"127.0.0.1 localhost.localdomain ABC"
"21......... qua..... q..."

Does it work, when the file contains these 2 lines?
 
Old 07-31-2003, 05:02 AM   #11
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
All /etc/hosts allows you to do it type things like "ping ABC" instead of having to use the ip address "ping 127.0.0.1". If your want ABC to be associated with a different IP address then you need to put that in /etc/hosts. You can have as many different entries in /etc/hosts as you want, so the 'other' line will simply be an entry for another box.

So long as your hostname appears to have changed and you can ping your hostname from the command line then that's it done. Keep in mind that entries in /etc/hosts only effect your machine.

cheers

Jamie...
 
Old 07-31-2003, 07:01 AM   #12
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
you will require to change the /etc/sysconfig/network entry

HOSTNAME=mylinux.domain.com

leave the 127.0.0.1 entries in /etc/hosts as they are...
add your ipaddress and add assign names to it, for example,

172.16.200.1 abc.mydomain.com abc
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent Question Regarding Urgent Questions! Need Help Now! Crashed_Again LQ Suggestions & Feedback 11 10-17-2007 08:07 PM
Hostname question GUIPenguin Linux - Networking 1 01-18-2005 08:59 PM
hostname question?? rnj Linux - Newbie 1 10-08-2004 07:09 AM
hostname question wendallsan Linux - Networking 4 10-16-2003 04:46 PM
Hostname Question darkfnord Linux - Newbie 1 09-04-2003 07:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration