LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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-08-2009, 01:03 AM   #1
maya.asagao
LQ Newbie
 
Registered: Jul 2009
Posts: 8

Rep: Reputation: 0
how to map IP to hostname


Hi,

I used to log-in PC (OS is ubuntu-9.04) from my room. Instead of "ssh username@IP", I want to use hostname such as " ssh username@hostname". Could you please explain me how to do it?


Thanks in advance,
maya
 
Old 07-08-2009, 01:08 AM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,421

Rep: Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085
You need the machine your are coming from to have a name-to-ip mapping to find your target system.
Typically, if on Linux, you would add an entry to /etc/hosts. Otherwise you need a dns server to have an entry.
 
Old 07-08-2009, 01:10 AM   #3
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
Is that IP address statically configured (i.e., doesn't regularly change)? If so, just edit /etc/hosts and add an entry with the IP address and the hostname.

Edit: Ah, beat me to it.
 
Old 07-08-2009, 01:54 AM   #4
maya.asagao
LQ Newbie
 
Registered: Jul 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Hi,

Thank you so much for your prompt responses. It is statically configured and when I add hostname/ip to /etc/hosts as you suggested, it worked.

However, to gain new knowledge, I would like to know that

(1) if my IP is changing (in the case of DHCP), how can I map IP to hostname?

(2) if there is dns server, how should I do ?


thanks in advance,
maya
 
Old 07-08-2009, 02:07 AM   #5
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 38
(1) You'd need to have a dynamic dns server. I've not tried it, but a quick search brought up a lot of links (like this). Then a small script on each of your clients is required, which will update the DynDNS server every 20 minutes or so about its present ip address.
(2) If you have a dns server already, put its address in /etc/resolv.conf of the client machine.
 
Old 07-08-2009, 02:30 AM   #6
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
I do use a dynamic DNS service (dyndns.com, to be precise), so let me add to that - it's pretty straightforward. You register with the service and get your hostname, and then you set up something to regularly make sure the entry the service has is correct on the machine in question. A program that does this and seems to be broadly available is inadyn, if you're interested.
 
  


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 -f error hostname :unknownhost prnkho Linux - Newbie 1 11-26-2008 09:12 AM
Kernel virtual memory map TO Board memory map -----> Mapping !rajkums! Linux - Embedded & Single-board computer 0 10-18-2008 09:21 AM
SYSERR(root): hash map "generics": missing map file /etc/mail/genericstable.db? singying304 Linux - Networking 4 02-28-2005 06:49 AM
hostname command vs. $HOSTNAME env. variable Silly22 Linux - Networking 2 03-29-2002 05:01 PM


All times are GMT -5. The time now is 01:30 AM.

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