LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices

Reply
 
Search this Thread
Old 01-20-2007, 10:07 PM   #1
gdlinuxer
LQ Newbie
 
Registered: Oct 2006
Location: Montreal
Distribution: Ubuntu 9.10
Posts: 9

Rep: Reputation: 0
How do I ssh using a hostname instead of using an IP address?


Hi,

I'm able to ssh from one computer to another using IP addresses, but not when using a hostname.

Both computers use wireless to connect to a cable router and use dhcp to get all the necessary info to get on the net.

I've googled for this info and see that it's a dhcp configuration issue, but I haven't been able to figure out exactly what needs to be changed.

Can anyone provide a helpful hint?
Thanks
 
Old 01-20-2007, 10:56 PM   #2
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 58
see this link: http://www.tdl.com/~netex/linux-doc-...e/node211.html
add an entry with the same format as the example substituting the appropriate values.
 
Old 01-20-2007, 11:04 PM   #3
gdlinuxer
LQ Newbie
 
Registered: Oct 2006
Location: Montreal
Distribution: Ubuntu 9.10
Posts: 9

Original Poster
Rep: Reputation: 0
I tried that.

When dhcp assigns a different IP address from the one in /etc/hosts, the hostname is no longer recognized.

Thanks for the suggestion.
 
Old 01-21-2007, 02:26 AM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
This is one of those cases where I start looking into a question, and end up finding out how little I know. So forgive me if I don't have a definitive answer but merely helpful hints. It also explains the rambling nature of my post.

Do you run your own DHCP server or does your router provide the service. There are about 3 different servers and clients that you might be using and they have different configuration files, so you might want to try more information.

Here are two DHCP howtos from the www.tldp.org website:
http://tldp.org/HOWTO/DHCP/index.html
http://www.faqs.org/docs/Linux-mini/DHCP.html

How are LAN hostnames resolved for you generally. Are you using NIS, DNS?

A dhcp client can be configured to modify NIS or DNS or smb.conf based on what the server says. However, those servers would probably use fixed address and their values wouldn't need to change. Suppose you have a linksys router for a home network. You can enter your own nameserver address and/or WINS server address (samba) in the configuration so that the DHCP server includes them when it sets up the clients on your network.

Look at the contents of /etc/nsswitch.conf. Also look at the library files matching /etc/lib/libnss_*.
Code:
grep hosts: /etc/nsswitch.conf
hosts:  files dns
jschiwal@hpmedia:/usr/share/doc/packages> locate libnss
/lib/libnss_compat-2.5.so
/lib/libnss_compat.so.2
/lib/libnss_dns-2.5.so
/lib/libnss_dns.so.2
/lib/libnss_files-2.5.so
/lib/libnss_files.so.2
/lib/libnss_hesiod-2.5.so
/lib/libnss_hesiod.so.2
/lib/libnss_mdns-0.2.so
/lib/libnss_mdns.so.2
/lib/libnss_nis-2.5.so
/lib/libnss_nis.so.2
/lib/libnss_nisplus-2.5.so
/lib/libnss_nisplus.so.2
/lib/libnss_wins.so.2
/lib64/libnss_compat-2.5.so
/lib64/libnss_compat.so.2
/lib64/libnss_dns-2.5.so
/lib64/libnss_dns.so.2
/lib64/libnss_files-2.5.so
/lib64/libnss_files.so.2
/lib64/libnss_hesiod-2.5.so
/lib64/libnss_hesiod.so.2
/lib64/libnss_mdns-0.2.so
/lib64/libnss_mdns.so.2
/lib64/libnss_nis-2.5.so
/lib64/libnss_nis.so.2
/lib64/libnss_nisplus-2.5.so
/lib64/libnss_nisplus.so.2
/lib64/libnss_winbind.so.2
/lib64/libnss_wins.so.2
I also noticed a separate /etc/nss_mdns.conf file. If you are using samba, and running winbind, you could check if you have a libnss_winbind.so library and if so, add "winbind" before the "dns" entry. Similarily, I think that you can set up on of the samba servers to supply WINS, add it's IP address to the routers WINS entry, and if a libnss_wins.so library exists, add "wins" to the "hosts: ..." entry in /etc/nsswitch.conf file.

I'm not certain if "mdns" would supply hostname information from the router's dhcp server, or if multicast DNS is just used with apple computers and equipment.

Last edited by jschiwal; 01-21-2007 at 02:31 AM.
 
  


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
changing IP address and hostname ashley75 Linux - General 7 05-19-2005 10:26 AM
hostname-------->ip address bruse Linux - Networking 2 04-18-2005 05:08 AM
how to use the hostname instead of ip address? tuxtamer Linux - Newbie 1 04-15-2005 07:29 AM
hostname to IP address bruse Linux - Networking 5 03-29-2005 11:21 PM
From IP address to hostname swmok Linux - Networking 1 08-22-2003 07:26 AM


All times are GMT -5. The time now is 09:28 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration