LinuxQuestions.org
Visit Jeremy's Blog.
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 01-27-2010, 10:44 PM   #1
casualzone
Member
 
Registered: Jan 2010
Posts: 189

Rep: Reputation: 15
Any difference to set in /etc/hosts & /etc/sysconfig/network ?


Plan to set my hostname in my linux centOS.

Should I set in /etc/hosts or /etc/sysconfig/network ?

Any difference to set in both place?
 
Old 01-27-2010, 10:47 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
You really should set it in both places, just because that's
where distros using that system place it on installation by
default. That said: /etc/hosts is mostly relevant for "local"
use on the machine.
 
Old 01-27-2010, 11:56 PM   #3
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Rep: Reputation: 55
Quote:
Originally Posted by casualzone View Post
Plan to set my hostname in my linux centOS.

Should I set in /etc/hosts or /etc/sysconfig/network ?

Any difference to set in both place?
Hi Casualzone,

If you want to set hostname, I suggest you to set in following way.

Code:
# sysctl kernel.hostname=your.hostname.com
You can also set in /etc/hosts and /etc/sysconfig/network, But many times it will not be reflected in all the places.

After setting the hostname as specified above, you can check it using
Code:
hostname
Cheers !!
 
Old 01-28-2010, 12:18 AM   #4
FragInHell
Member
 
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Solaris, Ubuntu, SUSE
Posts: 282

Rep: Reputation: 45
/etc/hosts is used by programs to look up hostnames (think of it as local dns), such as most daemon processes.

/etc/sysconfig/network- is what the system uses to set the hostname.
 
Old 01-28-2010, 05:11 AM   #5
casualzone
Member
 
Registered: Jan 2010
Posts: 189

Original Poster
Rep: Reputation: 15
Thank you very much
 
  


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
/etc/sysconfig/network quesion mokku Linux - Newbie 5 03-13-2008 10:35 AM
IP Address Not Being Set Correctly At Startup ie According to sysconfig-eth0 jogjayr Linux - Networking 7 08-30-2007 03:58 AM
I think i messed somthing up in my /etc/hosts /etc/sysconfig/network mr_coffee Linux - Networking 1 01-23-2006 08:26 AM
/etc/sysconfig/network does not exist! Lechium Linux - Newbie 1 06-21-2004 06:18 PM
/etc/sysconfig/network ssrikant Linux - Software 1 05-18-2003 04:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:55 PM.

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