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-23-2004, 01:37 AM   #1
LQ Newbie
Registered: May 2003
Posts: 19

Rep: Reputation: 0
setting up my hostname

1). How to setup a host name? as I know a host name can be anything u make up, but what about the domain name, can I pick any domain name i want as well?
2). Do I have to associate my ip with the hostname under the HOST tab in network config? If I do, what should I put in the alias field?
3). if all of the above has been done correctly, would there be any problem accessing to my computer from a remote host by ssh? or I need to config something else?

I know these may sound stupid, but I really need someone to help me on this.

I am using redhat 7.2, thx
Old 01-23-2004, 02:35 AM   #2
Senior Member
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
set the hostname in /etc/hosts. if u are running a local DNS server, u can set up any domain name you want. that way, u can do 'host based' resolution within your network.

if you only do the hostname assignment via /etc/hosts, remote machines won't know it. u need to set the hostname with the corresponding IP address to other machine's hosts file.
Old 01-23-2004, 03:05 AM   #3
Registered: Jan 2004
Location: Melbourne, Australia
Distribution: Mandrake 9.1
Posts: 48

Rep: Reputation: 15
Here is an example: say my hostname is "nyteshyft", and the domain name that i am associated with is called "", and that my IP address is "".

edit /etc/sysconfig/network, modify the following entries:
hostname = "nyteshyft"
domainname = ""
Restart your machine. Test your hostname and domainname:
# hostname

# hostname --fqdn

# dnsdomainname
Keep all your most used host names and IP addresses in /etc/hosts
Code:          localhost              nyteshyft
Configure the DNS using /etc/resolv.conf
You can configure the order of the nameservers too with /etc/nsswitch.conf (everything else is unchanged)
hosts:               dns files
i hope thats all right, worked for me, my friend told me some of it though, pretty easy once you know it
Old 01-23-2004, 05:22 PM   #4
LQ Newbie
Registered: May 2003
Posts: 19

Original Poster
Rep: Reputation: 0
everything i clear, except the part that to configure etc/resolv.conf and etc/nsswitch.conf, what are they doing? what would be the ip of the nameserver?
In etc/nsswitch.conf, I just type in "hosts: dns files", or i have to fill in other information, can u make a concrete example?
also what does the localhost thing do, i read some web page and it says that local host is for some special use.


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
Setting Hostname abhijeetudas Linux - Networking 1 06-04-2005 08:10 AM
setting up hostname in RH9 wiredX Linux - General 9 07-15-2003 11:46 AM
setting hostname akamol Linux - General 2 07-03-2003 04:48 AM
setting hostname skunk1 Solaris / OpenSolaris 3 04-02-2003 02:00 AM
setting up a hostname sakeeb Linux - Networking 3 04-28-2002 05:37 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:07 PM.

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