Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 01-27-2010, 09:44 PM   #1
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, 09:47 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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, 10:56 PM   #3
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
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.

# sysctl
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
Cheers !!
Old 01-27-2010, 11:18 PM   #4
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, 04:11 AM   #5
Registered: Jan 2010
Posts: 189

Original Poster
Rep: Reputation: 15
Thank you very much


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

All times are GMT -5. The time now is 10:38 AM.

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