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 10-03-2004, 03:10 PM   #1
tejpatil
Member
 
Registered: Feb 2004
Posts: 43

Rep: Reputation: 15
how to setup a hostname in linux - need help


How to setup a hostname in linux RH 9.0? The reason I am trying to do this is right now I am accessing linux using its IPaddress. I want give a name to it and use the name to access linux from other machine. I don't know how to configure the host name. Could you please help me do it. Thanks.

Last edited by tejpatil; 10-03-2004 at 03:15 PM.
 
Old 10-03-2004, 03:19 PM   #2
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
go to the computer (the you use to connect to the computer you want to give a host name to)

then edit this file as root

/etc/hosts

simply add a new line with the ip address of the computer, then a space, then put a host name there
 
Old 10-03-2004, 03:20 PM   #3
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Use the hostname command to set the hostname (run it from rc.local or set it in the network configuration to make it stick between boots). However, setting a hostname on one machine does not make it so that your other machines magically know about it. To do that, you must either set up DNS (probably overkill, unless you have a lot of hosts) or add it to the /etc/hosts file on all of the remote systems.
 
Old 10-03-2004, 03:35 PM   #4
tejpatil
Member
 
Registered: Feb 2004
Posts: 43

Original Poster
Rep: Reputation: 15
thanks SciYro,

I did adding ip address and a hostname on \etc\hosts file. But if I ping the host name from my laptop it doesn't respond. But if I ping same IP address from my laptop it responds. What should I do now?

Thanks,
Tej
 
Old 10-03-2004, 04:53 PM   #5
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
try this command

echo 192.168.0.1 newhost >> /etc/hosts

as root, replace 192.168.0.1 with the ip of the computer to connect to, then

ping newhost

should work .. works for me without a hitch
 
  


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
hostname, fqdn, /etc/hosts setup [GOD]Anck Slackware 9 07-20-2010 04:51 PM
hostname and fully qualified domain name setup help strimp099 Linux - Networking 7 01-14-2005 10:07 PM
simple mail setup for hostname quickk Linux - Newbie 6 11-02-2004 01:13 AM
hostname setup for router RoughEdge Linux - Newbie 5 04-29-2004 09:16 AM
hostname changes after setup internet spchehe Linux - General 4 08-19-2003 02:11 PM

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

All times are GMT -5. The time now is 12:57 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