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 07-09-2009, 11:26 PM   #1
txchien
LQ Newbie
 
Registered: Apr 2009
Location: HCMC-VIETNAM
Posts: 9

Rep: Reputation: 0
I want to access pc with hostname instead of IP


I want to access pc with hostname instead of IP, but I forgot the file.
Please help me.

Thanks.
txchien
 
Old 07-09-2009, 11:35 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
/etc/hosts
 
Old 07-09-2009, 11:52 PM   #3
txchien
LQ Newbie
 
Registered: Apr 2009
Location: HCMC-VIETNAM
Posts: 9

Original Poster
Rep: Reputation: 0
I will check it again.
Thanks chrism01

Last edited by txchien; 07-09-2009 at 11:53 PM.
 
Old 07-09-2009, 11:58 PM   #4
txchien
LQ Newbie
 
Registered: Apr 2009
Location: HCMC-VIETNAM
Posts: 9

Original Poster
Rep: Reputation: 0
I MEAN
Example:
My Ip pc:192.168.1.2
I want to ping 2 pc: 192.168.1.3 and 192.168.1.4 with hostname instead of IP.
 
Old 07-10-2009, 12:40 AM   #5
cmdln
Member
 
Registered: Apr 2009
Location: Lawrence, KS
Distribution: Debian, Centos
Posts: 102
Blog Entries: 1

Rep: Reputation: 24
Put entries in your /etc/hosts file for each host you want to access by name.

So a a line like [code]
192.168.1.5. jacksbox
[code]
now the computer whose host file you edited knows that ip maps to that name and you can ping jacksbox.

You will have to make these entries on each computer.

Alternativly you could set up DNS with something like dnsmasq (it's pretty easy)
 
Old 07-10-2009, 12:50 AM   #6
txchien
LQ Newbie
 
Registered: Apr 2009
Location: HCMC-VIETNAM
Posts: 9

Original Poster
Rep: Reputation: 0
That's right!
Thanks chrism01
and Thank you very much cmdln

txchien
 
  


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
Cannot access my linux machine when i type the hostname instead of ip address dcordina Linux - Networking 1 04-07-2009 07:43 AM
Define new hostname without root access? pwc101 Linux - Networking 8 07-31-2008 06:05 AM
Ubuntu -- Access by Hostname DeanS Linux - Networking 5 10-03-2007 11:59 AM
Can't access server using hostname from other PCs on the local network binister Linux - Software 5 09-01-2006 04:13 AM
Cannot access system via hostname Sirkent Linux - Networking 2 08-22-2004 03:35 PM

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

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