LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-17-2003, 10:47 AM   #1
xailer
Member
 
Registered: Nov 2003
Posts: 77

Rep: Reputation: 15
Setting the Host name


hi

I'd like to change the Host name.
To make it permanent I must enter entries in /etc/hosts file and in /etc/sysconfig/network file

But do I add lines in those files or replace the old lines with new ones?
Lets assume my PC's internet IP is 16.16.16.16

So for example:There is already a line in HOSTS file

127.0.0.1 localhost.localhost localhost

Do I add new line with internet IP---16.16.16.16 hey.com hey ;

or do I change a line with loopback IP to 127.0.0.0 hey.com hey ;

or must I change first line and also add a line with internet adrress?


In Network file I must only replace localhost.localhost with hey.com?Right?

thank you

Last edited by xailer; 11-17-2003 at 10:50 AM.
 
Old 11-17-2003, 11:07 AM   #2
dalek
Senior Member
 
Registered: Jul 2003
Location: Mississippi USA
Distribution: Gentoo
Posts: 2,058
Blog Entries: 2

Rep: Reputation: 79
I went by this.

http://www.cpqlinux.com/hostname.html

Hope that helps.

Later

 
Old 11-17-2003, 11:38 AM   #3
xailer
Member
 
Registered: Nov 2003
Posts: 77

Original Poster
Rep: Reputation: 15
hi

It shure does help but there are few things I don't quite understand.

First,why must that entry in Host file have two domain names(if it gets IP from DHCP)?Couldn't it just have

127.0.0.1 mybox.mydomain.com mybox ;

and that's it?


Second,I thought you have to add an entry in /etc/sysconfig/network file even if machine gets it's IP from DHCP server?But that article indicates you only add an entry if you have static IP.

Anyways,thank you very much for that link

bye
 
Old 11-17-2003, 12:05 PM   #4
dalek
Senior Member
 
Registered: Jul 2003
Location: Mississippi USA
Distribution: Gentoo
Posts: 2,058
Blog Entries: 2

Rep: Reputation: 79
You may want to know this. Linux runs a server in the background all the time. What you see runs on top of that.

I changed the line you were talking about and lost 'contact' with the server. CUPS would not work correctly as well as a few other strange problems.

Just put it like the link says and hope for the best.

When you boot it should say 'setting hostname to XXXX' right after the kernel and the init starts. it is actually set during the init part.

That help any?

 
Old 11-17-2003, 12:52 PM   #5
xailer
Member
 
Registered: Nov 2003
Posts: 77

Original Poster
Rep: Reputation: 15
Of course it helped)

So 127.0.0.1 must be in localhost domain and whatever other IPs you also have can run in their own domain?

And about the network file...do you have to add an entry only if you have static IP?Why only then?

what kind of server runs in the background?

thank you
 
Old 11-17-2003, 02:05 PM   #6
SpotsPaw
LQ Newbie
 
Registered: Nov 2003
Location: Houston, TX
Distribution: Red Hat 9, Windows XP Pro
Posts: 6

Rep: Reputation: 0
I just installed Red Hat 9 and had this question too. I particularly wanted to avoid having to add a static IP to the /etc/hosts file. I found the link supplied in the initial reply very useful. I'll try the DHCP_HOSTNAME setting in the /etc/sysconfig/network.

Thanks for the information!
 
Old 11-18-2003, 05:10 PM   #7
xailer
Member
 
Registered: Nov 2003
Posts: 77

Original Poster
Rep: Reputation: 15
I agree.It really helped alot.But besides hows I also wanna know whys

thank you again for that link
 
Old 11-18-2003, 05:45 PM   #8
dalek
Senior Member
 
Registered: Jul 2003
Location: Mississippi USA
Distribution: Gentoo
Posts: 2,058
Blog Entries: 2

Rep: Reputation: 79
Why, I didn't like the name localhost, but I did like the name smoker. I went from a 400MHz to a 2.5GHz and 128MBs of ram to 512MBs. Pretty well smoking by comparison.

I read it is a good idea to name them all something different if on a network. 50 machines named localhost would be confusing.

Later

 
Old 11-18-2003, 09:22 PM   #9
xailer
Member
 
Registered: Nov 2003
Posts: 77

Original Poster
Rep: Reputation: 15
hi

Is the whole purpose of a domain named localhost to communicate with some background server?Can't you assign some other domain to hold 127.0.0.1 IP and talk to that server?

bye
 
Old 11-18-2003, 09:35 PM   #10
dalek
Senior Member
 
Registered: Jul 2003
Location: Mississippi USA
Distribution: Gentoo
Posts: 2,058
Blog Entries: 2

Rep: Reputation: 79
With Linux there is a server running in the background. It also needs that to communicate with CUPS and other stuff depending on what you have on.

At this moment there is a GUI running and 6 other terminals, I'm not logged into those, running and waiting for action.

There are also several daemons running as well as all that other stuff. The GUI is just the part that you see.

Later

 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Help setting host name please? MichaelD Linux - Newbie 1 05-20-2005 11:33 PM
Setting up a virtual host zupidupi Linux - Networking 2 01-30-2005 09:58 AM
setting up telnet host leroy27336 Linux - Networking 2 11-12-2003 03:13 PM
Setting up host in Terminal? CauSTiC Linux - General 6 10-06-2002 08:54 AM
Setting up host in Terminal? CauSTiC Linux - Newbie 3 10-06-2002 07:12 AM


All times are GMT -5. The time now is 03:23 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration